Re: [Jersey] can we get a UriBuilder.addOrReplaceSegment method?

From: Craig McClanahan <>
Date: Tue, 2 Feb 2010 23:51:08 -0800

On Tue, Feb 2, 2010 at 10:46 PM, geoffrey hendrey <> wrote:
> Hi,
> I posted along these lines a while back, but I continue to run into cases
> where I need to make modifications to a URI, and there doesn't seem to be an
> easy way to do it.
> For instance, if my resource has URI .../color/red/width/10/height/5, I find
> myself needing to redirect the client after an "edit" operation to
> .../color/BLUE/width/10/height/2.
> What I really want is
> UriInfo.getAbsolutePathBuilder().addOrReplaceSegment("color/${color}","BLUE").addOrReplaceSegment("height/${height}","2");
> Can you please consider this feature, or help me understand why I don't need
> it?

I don't have the full context from your previous comments, but from
the example above I think you are trying to encode "view" related
information into a URL that should (in general REST terms) represent a

Think about a URI of the form "...?color=red&width=10&height=5" and
you'll likely get a different perspective on things. The "..." part
identifies *what* you are trying to display, and the query parameters
influence *how* it is displayed.


> -geoff
> --
> - RESTful Relational Database