Re:Re: [Jersey] can we get a UriBuilder.addOrReplaceSegment method? Tuesday, February 2, 2010 11:51 PM

From: geoffrey hendrey <>
Date: Thu, 4 Feb 2010 18:45:10 -0800

Hi Craig,

I don't want a new view of the same resource. For example, consider a URI
like "/page/5". The resource for page 5 wants to be able to create links to
/page/4 and /page/6, it is extremely useful to be able to say
addOrReplaceSegment("/page/{page}", "6"). I can even envision a syntax like:
addOrReplaceSegment("/page/{page}", "${page}+1") but that's above and beyond
what I need.

I hope I won't see a response saying "page numbers should be query
parameters" since at that point the issue drifts toward the religious rather
than the practical. There are many reasons, such as availability of matrix
parameters to the path segments, or behaviors of web caches, that make path
parameters preferable in some situations. I just want an easy way to take a
resource's URI and mutate its path parameters so that I can easily create
links to similar resource. So far, virtually everything else is a dream with
Jersey and JSR-311, but this is one place where I think it could be

-- - RESTful Relational Database