• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about path elements

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just trying to bring up to the top, does no one really know about the above?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most of the answer is in SRV.4.4. Assume, for example,
  • The web-app is mapped to /myapp
  • In the web-app, there's a servlet called FooServlet mapped to /foo
  • The browser requests http://www.myserver.com/myapp/foo/bar.html?param=value
  • In 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 ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic