Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-721

ExceptionMapper waits for timeout of AsynchronousResponse

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3.7.Final
    • 2.3.1, 2.3.3.Final, 2.3.4.Final
    • jaxrs
    • None

      When using AsynchronousResponse the client needs to wait for the specified timeout in case the ExceptionMapper is triggered. This is unexpected behaviour since the exception should be returned immediately. (In fact this is done, but the client keeps waiting for the server to close the connection).

      Example.java
      import org.jboss.resteasy.annotations.Suspend;
      import org.jboss.resteasy.spi.AsynchronousResponse;
      
      @Path("/")
      public class SimpleResource {
      
         @GET
         @Path("test")
         @Produces("text/plain")
         public void test(final @Suspend(10000) AsynchronousResponse response) throws Exception {
            //Throw an exception
            throw new RuntimeException();
         }
      }
      
      ExampleMapper.java
      import javax.ws.rs.core.Response;
      import javax.ws.rs.core.Response.Status;
      import javax.ws.rs.ext.ExceptionMapper;
      
      @Provider
      public class EJBExceptionMapper implements ExceptionMapper<RuntimeException> { 
        
         public Response toResponse(EJBException exception) {
            return Response.status(500).build();
         }
      }
      

            rsigal@redhat.com Ronald Sigal
            vdweij Aede van der Weij (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: