cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincenzo Vitale <vincenzo.vit...@gmail.com>
Subject Setting the status code in the injected (via the jax-rs @context) HttpServletResponse
Date Wed, 14 Oct 2009 01:01:28 GMT
Hi,

in my service implementation I'm injecting the HttpServletResponse with the
@Context annotation:

    @POST
    @Path("/login")
    public Feed login(@PathParam("username") String username,
            @PathParam("password") String password,
            @Context HttpServletResponse httpServletResponse)

and than I set the 401 status code when the user is not authorized. The
problem is that the status code is than overwritten in the
AbstractHTTPDestination class during the headers flushing:

            Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
            if (i != null) {
                int status = i.intValue();
               ... ... ...
                response.setStatus(status);

is this the expected behaviour or is this a bug?



Thanks in advance,
Vincenzo.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message