Hi Martin,
If you know there is a parent child relationship then i think you could
do this in the child resource:
_uriInfo.getAbsolutePathBuilder().
path("..").
build().normalize().toString();
There has been a request to the EG to have parent() method on the
builder which would make it easier than normalizing.
Paul.
Martin Grotzke wrote:
> Hi,
>
> is it possible to "navigate" to get the path to the parent resource from
> UriBuilder?
>
> E.g. I have a resource with path "/parent/pId/child/cId" where pId is
> the identifier of a "parent" resource and cId the id of "child". Then I
> want to get "/parent/pId/child/" from UriBuilder. Is there any
> possibility to achieve this? (Ok, I could cut off everything that
> follows the last slash, but that doesn't feel good :))
>
> Right now I do the following, but this requires a lot of "knowledge"
> about the context of a resource:
>
> _uriInfo.getBaseUriBuilder()
> .path( ParentResource.class )
> .path( "{p1}" )
> .path( "child/" )
> .build( "pId" ).toString()
>
> Thanx for your help,
> cheers,
> Martin
>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109