cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincenzo Vitale (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).
Date Mon, 23 Nov 2009 13:40:39 GMT

    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781400#action_12781400
] 

Vincenzo Vitale commented on CXF-2471:
--------------------------------------

I tried 2.2.5 doing something like this:

    @GET
    @Path("/{username}")
    public Feed getContact(@PathParam("username") String username,
            @Context HttpServletResponse httpServletResponse) {

            ....
            ....
            httpServletResponse.setStatus(Status.NOT_FOUND.getStatusCode());
            return feed;
}

but the status code returned is always 200.


It works fine only adding this:
                     
                     throw new WebApplicationException(Response.status(Status.NOT_FOUND)
                    .entity(feed).build());


Cheers,
V.

> The HttpServletResponse statuses is lost after is set in a service implementation (where
the response is injected through @Context).
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2471
>                 URL: https://issues.apache.org/jira/browse/CXF-2471
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.4
>            Reporter: Vincenzo Vitale
>            Assignee: Sergey Beryozkin
>             Fix For: 2.2.5, 2.3
>
>
> After injecting the the HttpServletResponse with the @Context annotation:
>     @POST
>     @Path("/login")
>     public Feed login(@FormParam("username") String username,
>             @FormParam("password") String password,
>             @Context HttpServletResponse httpServletResponse) 
> and than setting a status code (for example 401 if the user is not authorized), the status
code get lost.
> See here for workarounds and more detials:
> http://www.nabble.com/Setting-the-status-code-in-the-injected-(via-the-jax-rs-@context)--HttpServletResponse-td25883621.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message