Resteasy client should throw according to JAXRS 2.0 spec (4.5.2 Client Runtime):
ProcessingException if thrown while processing a request, and to a ResponseProcessingException if thrown while processing a response.
But Custom implementation of ClientRequestFilter which throws WebApplicationException doesn't get mapped into ProcessingException as the spec says but into WebApplicationException.
WebApplicationException should be thrown by client only when ( JAXRS 2.0 spec - 4.5.2 Client Runtime):
Note that the client runtime will only throw an instance of WebApplicationException (or any of its subclasses) as a result of a response from the server with status codes 3xx, 4xx or 5xx.
The example of ClientRequestFilter:
public class RequestFilterThrowCustomException implements ClientRequestFilter { @Override public void filter(ClientRequestContext requestContext) { throw new WebApplicationException(); } }
Client call:
ClientBuilder.newClient().target(dummyUrl).register(RequestFilterThrowCustomException.class).request().get();
Results to WebApplicationException being thrown.
Opposite to this when WebApplicationException is thrown by ClientResponseFilter, Resteasy client throws ResponseProcessingException as described in the spec.
- is cloned by
-
RESTEASY-1685 Resteasy client throws WebApplicationException when ClientRequestFilter is used
- Closed
- is incorporated by
-
JBEAP-12230 Upgrade RESTEasy to 3.0.24.Final
- Closed