> -----Original Message-----
> From: Sergey Beryozkin [mailto:[email protected]]
> Sent: Tuesday, February 22, 2011 3:05 AM
> To: [email protected]
> Subject: Re: Convenience features for generating HATEOAS urls?
> 
> Hi
> 
> On Mon, Feb 21, 2011 at 7:41 PM, KARR, DAVID (ATTSI) <[email protected]>
> wrote:
> > I'm now at the point where I'm going to need to generate HATEOAS URLs
> in
> > my responses.  These will refer to other operations in my controller.
> > What features does CXF provide to make it easier to generate those
> URLs?
> > I looked in the doc and I didn't see any obvious pointers to this.
> >
> > This would include generating the "root" URL for the controller,
> along
> > with the extra path for a particular method, and plugging in any
> > required or optional parameters.
> >
> 
> JAX-RS UriInfo and UriBuilder is what JAX-RS provides. UriInfo will
> give the base URI builder, ex :
> 
> UriBuilder builder = uriInfo.getBaseUriBuilder();
> 
> ex, if you have a services.war deployed then this buider will
> encapsulate a URI like http://localhost:8080/services.
> Next you can do say
> 
> builder.path(Controller.class).build()
> 
> This will represent the root URI which can be used to match the
> controller resource.
> UriBuilder has methods like path(Method) which can be used to capture
> a path segment a given resource method handles, etc...

Are UriBuilder instances thread-safe?  If I assembled a cache of UriBuilder 
instances mapped to the public methods of my class (which have the @GET or 
@POST annotation), can I then use that and call "build()" and other methods on 
that instance?  For instance, does "build()" on a UriBuilder return the same 
instance, or a new one?

Reply via email to