Issue Details (XML | Word | Printable)

Key: JERSEY-1550
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Pavel Bucek
Reporter: jan.supol
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jersey

Invocation.invoke(GenericType<Response>) throws WebApplicationException

Created: 31/Oct/12 11:37 AM   Updated: 07/Jan/13 04:28 PM   Resolved: 07/Jan/13 04:28 PM
Component/s: core
Affects Version/s: 2.0-m09
Fix Version/s: 2.0-m12, 2.0

Time Tracking:
Original Estimate: 3 hours
Original Estimate - 3 hours
Remaining Estimate: 0 minutes
Remaining Estimate - 0 minutes
Time Spent: 2 hours
Time Spent - 2 hours Time Not Required

Tags:
Participants: jan.supol and Pavel Bucek


 Description  « Hide
@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.



jan.supol added a comment - 31/Oct/12 01:44 PM

The same for SyncInvoker, AsyncInvoker