cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-6683) LinkBuilderImpl build strips last path segment with baseUri set
Date Wed, 18 Nov 2015 16:11:11 GMT

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

Sergey Beryozkin resolved CXF-6683.
-----------------------------------
    Resolution: Won't Fix
      Assignee: Sergey Beryozkin

> LinkBuilderImpl build strips last path segment with baseUri set
> ---------------------------------------------------------------
>
>                 Key: CXF-6683
>                 URL: https://issues.apache.org/jira/browse/CXF-6683
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.4
>            Reporter: Christoph Berg
>            Assignee: Sergey Beryozkin
>
> After I applied the fix I proposed in CXF-6682, I tried building a link to point to a
specific entity of a REST resource, e.g. http://localhost:8080/resource/1.
> We currently build the Link as follows:
> {code}
> new LinkBuilderImpl().baseUri("http://localhost:8080/resource/1").rel("self").build();
> {code}
> I would expect that the Link would then contain the value of the {{baseUri}}, but the
last path segment is stripped.
> The {{LinkerBuilderImpl#getResolvedUri(Object… values)}} creates an URI, which will
have an empty path. If this is given to the {{HttpUtils.resolve}} method, it strips the last
path component.
> If I change the method to look like this, everything works as expected:
> {code}
>     private URI getResolvedUri(Object... values) {
>         URI uri = ub.build(values);
>                 
>         if (!uri.isAbsolute() && baseUri != null) {
>             UriBuilder linkUriBuilder = UriBuilder.fromUri(baseUri);
>             String path = uri.getPath();
>             if (path == null || path.isEmpty()) {
>                 return linkUriBuilder.build();
>             }
>             return HttpUtils.resolve(linkUriBuilder, uri);    
>         } else {
>             return uri;
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message