Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-11939

Resteasy client throws WebApplicationException when ClientRequestFilter is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.ER3
    • 7.1.0.ER1
    • REST
    • None

      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.

              rhn-support-asoldano Alessio Soldano
              kanovotn Katerina Odabasi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: