jersey
  1. jersey
  2. JERSEY-1550

Invocation.invoke(GenericType<Response>) throws WebApplicationException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m09
    • Fix Version/s: 2.0-m12, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      @Path("resource")
      public class Resource {
         @GET
         public Response fail(){
           Response r = Response.status(Status.NOT_ACCEPTABLE).build();
           return r;
         }
      }
      
      Response r = invocation.invoke(new GenericType<Response>() {});
      

      An invocation of the resource method throws WebApplicationException. Though javadoc does not state that in an invoke method, with respect to other javadoc occurences (such as submit), the GenericType<Response> should not throw an exception, because the status code is included in the response. Similarily to invoke(Response.class) which does not throw the exception either.

      javadoc for Invocation#submit says:

      Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either an ClientException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response.

      Although:

      public class GenericTypeResponse extends GenericType<Response> {
      };
      Future<Response> future = invocation.submit(new GenericTypeResponse());
      future.get();
      

      does not work either.

        Activity

        Hide
        jan.supol added a comment -

        The same for SyncInvoker, AsyncInvoker

        Show
        jan.supol added a comment - The same for SyncInvoker, AsyncInvoker

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours Time Not Required
              2h