Hi Martin,
The reason for getAbsolutePath is sometimes query parameters are used to
scope the representation that is returned and one may not be interested
in using those same query parameters for constructing a new URI. The URI
returned corresponds to that of the request URI minus any query
parameters. Thus can be used for building URIs with direct parent/child
relationships that are embedded in the returned representation, e.g.
GETing an Atom feed containing URIs referencing Atom entries.
It is hard to say what is exactly the correct use for UriInfo, i think
it can very much depend on your application. We want to ensure that
UriInfo captures many of the common the use-cases around
accessing/manipulating URIs e.g. a common pattern like the
container/entry of Atom.
From what you said below it appears there is something missing from
UriInfo: the ability to get a URI for the current 'calling context' i.e.
a sub-path of the complete request URI path. For example if a
sub-resource locator is invoked perhaps we should allow the getting of
the current URI path for that locator. In general i think this could be
expanded to a breadcrumbs concept of being able to get the current list
of URI paths (which can be used to show the hierarchical traversal history).
Hope this helps,
Paul.
Martin Grotzke wrote:
> Hi,
>
> I have some root resource, that creates child resources by itself, not
> by using some IoC-features. The parent resource get's the UriInfo
> injected, and passes it down to the child resources (e.g. user/widgets
> and user/products).
>
> When some resource invokes UriInfo.getAbsolutePathBuilder, the
> absoluteUri is set in AbstractContainerRequest and used for all
> subsequent calls to UriInfo.getAbsolutePathBuilder - which might be
> ".../user/widgets/" if it has been called for the widgets resource the
> first time, even if the absolutePathBuilder was requested from the
> products resource.
>
> What is the intended way of using UriInfo.getAbsolutePathBuilder or more
> generally - the usage of UriInfo?
>
> Thanx && cheers,
> Martin
>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109