Hi,
  I write a outward interceptor and put it after JAXRSOutInterceptor to
clean up some resouces. When cleaning up the resources, there might be some
exceptions happening. Then I directly set the HttpServletResponse's headers
and content to send back an appropriate response. This works even there is
a IllegalStateException thrown when later cxf's jaxrs implementation try
flush http headers to the HttpServletResponse like below. Any more
appropriate way to achieve my goal without this exception?

2016-05-13T16:58:36.514 [qtp1980982961-89] WARN
 o.a.cxf.phase.PhaseInterceptorChain - Interceptor for {
http://rs.security.xs/}Resource has thrown exception, unwinding now

java.lang.IllegalStateException: WRITER

at org.eclipse.jetty.server.Response.getOutputStream(Response.java:906)
~[na:na]

at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractHTTPDestination.java:585)
[cxf-rt-transports-http-2.7.11.jar:2.7.11]

at
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.close(AbstractHTTPDestination.java:743)
~[cxf-rt-transports-http-2.7.11.jar:2.7.11]

Reply via email to