On 25/06/14 10:13, Sergey Beryozkin wrote:
Hi

I'm not sure sure how it can be done with CXF 2.6.9 but I think it can
be with CXF 3.0.0 and JAX-RS 2.0 AsyncResponse.

You'd use AsyncResponse as one of the method parameters, set a timeout,
shorter than 15 sec, say 5 sec, and then if the response is not ready
then set another timeout for 3 secs, all with JAX-RS 2.0 TimeoutHandler,
and also you'd set ConnectionCallback on AsyncResponse - this callback
will be called if, when attempting to send the data back, the runtime
determines that a client has disconnected, see

Sorry, it is called CompletionCallback

https://fisheye6.atlassian.com/browse/cxf/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java?r=28b53b095af7e53e9bf6f4265ca39ff405619eee


for some examples

HTH, Sergey



On 24/06/14 22:03, harald wrote:
I hope somebody can point me in the right direction with the following:

Think of a simple restful webservice which just echos the data - for sure
the real WS is much more complex running on ServiceMix (4.5.3 with CXF
2.6.9). The answer is delayed by 15 seconds to simulate processing
time. The
test client calling the WS has a requestTimeout of 10 seconds. As
expected
the client drops the connection and throws an exception. On the server
side
the process waits until the 15 seconds are over and tries to send the
data
back to the client - which is not longer listening. As expected the
server
throws an IOException (connection reset by peer).

The problem is that I want to catch this exception and forward the not
delivered answer to a JMS queue. For now I would be lucky to log the WS
response which could not be delivered.

I have already tried to define an ExceptionMapper which did not work.
Than I
tried an implementation of the AbstractPhaseInterceptor using different
phases. All I see is that it's been initialised. But I do not see that
the
Interceptor is invoked by the server. The interceptor is configured as an
jaxrs:outFaultInterceptors within the blueprint and implements
handleMessage
and handleFault.

So what's the "right way" of catching the java.io.IOException on the
server
side?
Is the AbstractPhaseInterceptor the right way and which phase is the
right
one?

Thanks in advance for helping,
harald




--
View this message in context:
http://cxf.547215.n5.nabble.com/Catching-java-io-IOException-on-the-server-side-tp5745530.html

Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to