You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Vincenzo Vitale (JIRA)" <ji...@apache.org> on 2009/10/14 12:10:31 UTC

[jira] Created: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

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: REST
    Affects Versions: 2.2.4
            Reporter: Vincenzo Vitale


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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787418#action_12787418 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

> but now the Atom feed is not anymore rendered properly. 

do you mean XML_DIRECTIVE is not available in the output ? Even if you don't use HttpServletContext ?

cheers, Sergey


> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787467#action_12787467 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

See http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomAtomFeedProvider.java

and the output which is produced :

HTTP/1.1 200 OK
Content-Type: application/atom+xml
Date: Tue, 08 Dec 2009 13:50:13 GMT
Content-Length: 508
Server: Jetty(6.1.21)

<?xml version="1.0" encoding="ISO-8859-1"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:base="http://localhost:9081/bookstore/bookstore4/books/feed"><title type="text">Collection of Books</title><id>http://www.books.com</id><author><name>BookStore Management Company</name></author><entry><title type="text">CXF in Action</title><id>123</id><content type="application/xml"><Book xmlns=""><id>123</id><name>CXF in Action</name></Book></content></entry></feed>

Note that if you set a formattedOutput property to true then Abdera will itself add an xml directive.

See also an atomservice4 endpoint in

http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_atom/WEB-INF/beans.xml

and http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AtomBookStore.java (private Feed doGetBookAsFeed(@Context UriInfo uParam))

what is different in your case ?

> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787386#action_12787386 ] 

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

Shouldn't the issue be open again?

> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787410#action_12787410 ] 

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

The response problem is fixed but now the Atom feed is not anymore rendered properly.

I'm using a custom provider extending the org.apache.cxf.jaxrs.provider.AtomFeedProvider. This was done since the xml directive was not included in the final xml.

The custom provider is essentially this:

    @Override
    public void writeTo(Feed feed, Class<?> clazz, Type type, Annotation[] a,
                        MediaType mt, MultivaluedMap<String, Object> headers,
                        OutputStream os) throws IOException {

        // System.out.println("requested media type: " + mt.toString());

        if (!JSON_TYPE.equals(mt.toString())) {

            os.write(XML_DIRECTIVE);
        }

        // System.out.println("going normal (atom)");

        super.writeTo(feed, clazz, type, a, mt, headers, os);
    }

and than configured in spring in the jax-rs section:

    <jaxrs:server id="atomProductRestWebService" address="/product">
        <jaxrs:serviceBeans>
            <ref bean="atomProductWebService" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <bean class="com.tomtom.csl.atom.AtomFeedProviderWithXMLDirective" />
        </jaxrs:providers>
    </jaxrs:server>

I guess is not related to this issue but just  a regression (since I guess 2.2.6 is going to be backward compatible).


Thanks,
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.


[jira] Reopened: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin reopened CXF-2471:
-----------------------------------


Can you confirm please it's been now fixed with the latest snapshot ?

http://repository.apache.org/snapshots/org/apache/cxf/apache-cxf/2.2.6-SNAPSHOT/

> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787426#action_12787426 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

Actually, if you set say 403 and also return a feed then the browser won't show the feed given that it is 403...Let ne know please what exactly is happening

> 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.


[jira] Updated: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vincenzo Vitale updated CXF-2471:
---------------------------------

    Affects Version/s: 2.2.5

> 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, 2.2.5
>            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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787430#action_12787430 ] 

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

Well, our requirements (and what was happening until 2.2.4) is that we want at the same time set whatever status code in the http response and also return a proper atom feed.

But now I don't get anymore the feed serialized correctly, the only output is the XML_DIRECTIVE we are printing in the custom provider. 
BTW, the feed is neither serialized when the request is valid, maybe is some problem integrating the abdera library (we are using abdera 0.4.0-incubating).


> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798057#action_12798057 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

great, thanks for the confirmation...
around 18 Jan

> 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, 2.2.5
>            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.


[jira] Resolved: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2471.
------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.2.5)
                       (was: 2.3)
                   2.2.6

> 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, 2.2.5
>            Reporter: Vincenzo Vitale
>            Assignee: Sergey Beryozkin
>             Fix For: 2.2.6
>
>
> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797976#action_12797976 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

Hi, I was just about to close this JIRA :-)
Can you reply to my last comment please ?

cheers, Sergey

> 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, 2.2.5
>            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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798051#action_12798051 ] 

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

Just tried the last snapshot and indeed is fixed! Do you know the date for releasing 2.2.6?


Thanks a lot,
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, 2.2.5
>            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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781483#action_12781483 ] 

Sergey Beryozkin commented on CXF-2471:
---------------------------------------

JAXRSClientServerBookTest has a test which checks that one of the BookStore methods sets a 333 status on the HttpServletResponse, but the signature is different, something like

public Response getContact(@PathParam("username") String username,
            @Context HttpServletResponse httpServletResponse) {

            httpServletResponse.setStatus(333);
            return null;
} 

One more fix is needed to the JAXRSOutInterceptor...
thanks

> 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.


[jira] Resolved: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2471.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3
                   2.2.5
         Assignee: Sergey Beryozkin

> 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.


[jira] Commented: (CXF-2471) The HttpServletResponse statuses is lost after is set in a service implementation (where the response is injected through @Context).

Posted by "Vincenzo Vitale (JIRA)" <ji...@apache.org>.
    [ 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.