> -----Original Message-----
> From: Sergey Beryozkin [mailto:[email protected]]
> Sent: Tuesday, April 26, 2011 3:11 AM
> To: [email protected]
> Subject: Re: How to append file extent to end of path, before query
> parameters?
> 
> Hi
> 
> On Tue, Apr 26, 2011 at 12:19 AM, KARR, DAVID (ATTSI) <[email protected]>
> wrote:
> > I'm currently using UriBuilder to generate a HATEOAS URL.  I need to
> be able to add a file extent to the last component, before the query
> parameters.
> >
> > For instance, if I would have generated
> "http://host:port/stuff/something?param=junk";, I need to instead make
> "http://host:port/stuff/something.extent?param=junk";.
> >
> > The last field in the URL is from a parameter value.  I figured out
> at least a way to do this, which is to simply modify the value of the
> last parameter to append the extent to it, but that seems pretty wonky.
> >
> > I'd really like to call "getRawPath()" on the return from "build(xxx,
> xxx)", modify the result, and then call "setRawPath()" (if such a
> method existed).
> >
> > Is there a reasonable way to do this, or is my workaround the only
> way?
> >
> Can you add ".extent" as a path segment to the builder instance ?
> Example,
> 
> builder.path(".extent");
> builder.query("param", "junk");
> builder.build();
> 
> Will it work for you ?

Afraid not.

For instance, here's an approximation of my @Path:

    @Path("stuff/{productId}/{zip}")

Here's a paraphrased version of the method that builds the URL:

    private String  buildStuffURL(String productId, String zip) {
        UriBuilder  builder = 
getUriInfo().getBaseUriBuilder().path(getClass()).path(getMethodMap().get("getStuff")).path(buildFileExtent());
        return builder.build(productId, zip).toString();
    }

The ".path(buildFileExtent)" is what I added on your advice (I used to just 
append "buildFileExtent()" to the end of "zip", which is not optimal).

What I get is this (minus "http://";):

    host:port/initialpath/stuff/1/98077/.en-us.xml

I needed to have this:

    host:port/initialpath/stuff/1/98077.en-us.xml

Reply via email to