Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] setStatus() vs. sendError(), custom error feedback

Christian,

I see no reason why your approach would fail with a gzip filter?
Which filter do you use and how does it fail?  what status codes are
you trying to send?

regards

On 22 April 2012 23:34, Christian Grün <christian.gruen@xxxxxxxxx> wrote:
> Hi all,
>
> in our project, we are using Jetty for various HTTP services. If
> anything goes wrong, we are currently using the following code to set
> the status code and send a plain error message:
>
>  HttpServletResponse res = ... (Jetty  response)
>  res.setStatus(code);
>  res.getOutputStream().write(message);
>
> This approach fails if we add a GzipFilter to the Jetty context. I
> have read that sendError() should be used for all kinds of error
> messages, but it returns a pre-formatted HTML page, while we'd prefer
> a plain text message (as e.g. our REST services doesn't return HTML
> by default). I assume that attaching a custom error message is the
> correct way of dealing with the issue, but I wanted to ask if there is
> a more convenient way you would recommend? If no, how should such
> an error handler look like? Is it the best approach to just copy and
> paste the original Jetty sources of sendError() and modify the
> contents?
>
> Thanks for the attention,
>
> Christian
> BaseX Team
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top