users@jersey.java.net

[Jersey] Using a ContainerResponseFilter to capture HttpServletResponse errors?

From: Behrooz Nobakht <nobeh5_at_gmail.com>
Date: Thu, 19 Mar 2015 21:37:30 +0100

Hi,

Is there a way (best practice) to use a ContainerResponseFilter at Jersey
server layer,
to capture the potential exceptions that might happen when writing the
response
at the level HttpServletResponse?

For example, I have an application that returns an InputStream as the
response entity.
Jersey is used in an embedded Jetty. If by any chance, the peer (client)
connection
is closed before writing the InputStream to HttpServletResponse output
stream,
Jetty throws an EofException. Can I capture this at the level of Jersey
using a
ContainerResponseFilter?

Thanks,
Behrooz