Hi all,

I am working on a problem with the way we handled errors in previous
versions of Jetty (7.6.7).  We would trap a 403 error (SC_FORBIDDEN) and
check the content type of the request, if it was "application/json" we
would return a JSON response (the trapping of the error is done in the
context of Jersey). That worked great, we got a nice JSON response for our
REST/JSON clients.

However, in 9.0.7, we are seeing them wrapped in html, presumably by jetty,
e.g.:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 403 {"rc": 403, "msg": "Access is denied."}</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /bmmadmin/wmq/connections/CCHINGFC1801/localqueues/.
Reason:
<pre>    {"rc": 403, "msg": "Access is
denied."}</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>

We are setting the response content type to "application/json", and using
HttpServletResponse.sendError with SC_FORBIDDEN and a String containing the
JSON response seen there.

What's the right way to handle this situation in jetty 9.0.7?  Any
suggestions?

Cheers,
Craig
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to