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

Sergey Beryozkin commented on CXF-5920:
---------------------------------------

The problem was that LinkBuilderImpl was using the URI resolution to compose 
the base URI and the original relative value.
So if if we have say "http://localhost:8080/1/2"; and "a" then the "2" segment 
is lost and the final URI is "http://localhost:8080/1/a";.

This is now fixed, Paths values starting from "/" will not affect the final 
URI. ApplicationPath should be kept as part of the link URI. Please try the 
snapshots. 
By the way, can you try Jersey and check how it deal with it ? Will it lose 
ApplicationPath ? 

> JAX-RS Link implementation (LinkBuilder) looses context path  
> --------------------------------------------------------------
>
>                 Key: CXF-5920
>                 URL: https://issues.apache.org/jira/browse/CXF-5920
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.1
>            Reporter: Ioan Eugen Stan
>            Assignee: Sergey Beryozkin
>             Fix For: 3.0.2, 3.1.0
>
>
> I think I've discovered a bug in CXF, but I'm not sure. Link class
> messes links up, and doesn't include servlet and @ApplicationPath
> paths from BaseUri:
> Description:
> - I have CdiServlet deployed at '/rest',
> - I have Jax rs @ApplicationPath '/api'
> - Account resource at  /account
> I expect the following code to return links to my resources:
> ~~~
>         log.info(" -- <<>> {}", uri.getBaseUri());
>         return Response.ok().links(
> Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
>   
> Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
> ).build();
> ~~~
> However, I get this on the client side:
> ~~~
> Link=[<http://localhost:9001/>;rel="self",
> <http://localhost:9001/account>;rel="account"],
> ~~~
> And I expected links with full path. like 
> ttp://localhost:9001/rest/api/account
> UriInfo returns the correct uri. Link messes it up.
> ~~~
> INFO  PlatformResource -  -- <<>> http://localhost:9001/rest/api
> ~~~



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

Reply via email to