RESTEasy ignores the response set on HttpServletResponse in EAP 5.1

Solution Verified - Updated -

Issue

We would like to change the server response using the HttpServletResponse injected in our JAX-RS resource. Here is an example code:

@Path("test")
public class TestResource {
    @Context
    HttpServletResponse theResponse;

    @GET
    public String test(@Context HttpServletRequest theRequest) throws Exception {
        theResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        return "hello";
    }
}

But RESTEasy is ignoring the response code set on HttpServletResponse object. What am I doing wrong?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In