-
Bug
-
Resolution: Done
-
Major
-
2.3.1, 2.3.3.Final, 2.3.4.Final
-
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(); } }