| Author |
about path elements
|
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Hi, ranchers: I am not clear about path elements of an ServletRequest object: request_uri, context_path, servlet_path. What is their use? Could anyone comment on these? Thanks I checked Specs trying to find javax.servlet.include.request_uri, but it's not there. Where to find the explanations of these attributes? [ April 12, 2002: Message edited by: rick collette ]
|
 |
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
|
Just trying to bring up to the top, does no one really know about the above?
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Most of the answer is in SRV.4.4. Assume, for example,The web-app is mapped to /myappIn the web-app, there's a servlet called FooServlet mapped to /fooThe browser requests http://www.myserver.com/myapp/foo/bar.html?param=valueIn that case, FooServlet will be invoked with the following request attributes:request.getContentPath() will return "/myapp"request.getServletPath() will return "/foo"request.getPathInfo() will return "/bar.html"request.getQueryString() will return "param=value"request.getParameter("param") will return "value"request.getRequestURI() will return either "/myapp/foo/bar.html" or "http://www.myserver.com/myapp/foo/bar.html", depending on the precise format of the browser request.See the spec quoted above for more details. Does this help? - Peter [ April 16, 2002: Message edited by: Peter den Haan ]
|
 |
 |
|
|
subject: about path elements
|
|
|