Question

Consider these two URLs:

www.g.com/flow;a=1
www.g.com/flow?a=1

What's the difference between semicolon and question mark?

Does the a=1 have the same meaning in both?

Was it helpful?

Solution

The ? delimits the query portion of the URL, whereas the ;, in this case, is consider a parameter of the path itself.

Most libraries do not expose this. Ostensibly it is part of routing the request (since the path is part of the overall resource location), vs the query portion (which affects the processing of the query).

The only commonplace I've seen it is in Java Servlet containers, which qualify the path with the JSESSIONID parameter.

You can see how that makes sense in this case:

http://www.example.com/context;JSESSIONID=12345?query_param1=ABC

From a servlet container POV, the JSESSIONID binds an internal session to the request during the routing phase, but the processing logic is ignorant of this, seeing only the query parameters, and the rest of the path.

I actually do no know if the path parameter is at all exposed in the Servlet container, perhaps if you get the entire URL, but the internal Java URL classes have no concept of path parameters, so I can't say.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top