cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Oberlies (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-5973) Response.created(URI) resolves relative URIs relative to the servlet URI instead of the request URI
Date Wed, 27 Aug 2014 11:40:58 GMT

     [ https://issues.apache.org/jira/browse/CXF-5973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tobias Oberlies updated CXF-5973:
---------------------------------

    Description: 
According to the [JavaDoc of javax.ws.rs.core.Response.created(URI)|http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/Response.html#created%28java.net.URI%29],
relative URIs should be resolved relative to the request URI.

However, CXF resolves the URI relative the the servlet path of the CXFNonSpringJaxrsServlet.

Example:
For a resource at path {{/account/someaccount/entries}} served by a servlet registered at
{{/service/b/api}}, the following code should result in a response with the HTTP header {{Location:
http://localhost/service/b/api/account/someaccount/entries/newentry}}
{noformat}
    @POST
    public Response create() {
        URI location = new URI("newentry");
        return Response.created(location).build();
    }
{noformat}
However, the header has the incorrect value {{Location: http://localhost/service/b/api/newentry}}

  was:
According to the [JavaDoc of javax.ws.rs.core.Response.created(URI)|http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/Response.html#created%28java.net.URI%29],
relative URIs should be resolved relative to the request URI.

However, CXF resolves the URI relative the the servlet path of the CXFNonSpringJaxrsServlet.

Example:
For a resource at path {{/account/someaccount/entries}} served by a servlet registered at
{{/service/b/api}}, the following code should result in a response with the HTTP header {{Location:
http:}}{{//localhost/service/b/api/account/someaccount/entries/newentry}}
{noformat}
    @POST
    public Response create() {
        URI location = new URI("newentry");
        return Response.created(location).build();
    }
{noformat}
However, the header has the incorrect value {{Location: http:}}{{//localhost/service/b/api/newentry}}


> Response.created(URI) resolves relative URIs relative to the servlet URI instead of the
request URI
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5973
>                 URL: https://issues.apache.org/jira/browse/CXF-5973
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.5, 2.7.12
>            Reporter: Tobias Oberlies
>
> According to the [JavaDoc of javax.ws.rs.core.Response.created(URI)|http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/Response.html#created%28java.net.URI%29],
relative URIs should be resolved relative to the request URI.
> However, CXF resolves the URI relative the the servlet path of the CXFNonSpringJaxrsServlet.
> Example:
> For a resource at path {{/account/someaccount/entries}} served by a servlet registered
at {{/service/b/api}}, the following code should result in a response with the HTTP header
{{Location: http://localhost/service/b/api/account/someaccount/entries/newentry}}
> {noformat}
>     @POST
>     public Response create() {
>         URI location = new URI("newentry");
>         return Response.created(location).build();
>     }
> {noformat}
> However, the header has the incorrect value {{Location: http://localhost/service/b/api/newentry}}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message