URL path segments containing parameters

Asked by At

We know that it is possible to pass parameters in the URL path segments using the syntax ;param=value. I wonder what this is good for, taking into account that parameters can also be passed

  • without the ;param= tag,

  • in the query segment.

The Wikipedia article doesn't even mention the possibility of including parameters in the path segments.

Another site mentions this possibility but it also adds that it is almost never used:

Each of the path segments can contain parameters which are separated from the segment by a ; (semi-colon) character e.g.:

http://www.blah.com/some;param1=foo/crazy;param2=bar/path.html

The URL above is perfectly valid, although this ability of path segments to hold parameters is almost never used (I've never seen it personally).

I found an explanation on Stackoverflow "when to use @QueryParam vs @PathParam" but it seems to me that any parameters could be passed in the query, making path parameters redundant. And above all, I don't have an idea why somebody would use the above syntax to pass parameters in the URL.

The example quoted above also raises the question whether param1 and param2 have anything to do with some and crazy, respectively. Or why is it useful that we can include parameters in each path segment?

Thank you in advance.

0 Answers