• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getContextpath + getServletpath + getPathinfo

 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

getContextpath + getServletpath + getPathinfo

can i get any document/source/link/post where i can get good explaination for them with different type of examples.

I am afraid, i am not getting this concept at all. bit scared about missing this question in exam

Regards,
Ravi
 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from some online mock exam.....

/myapp getContextPath
/account getServletPath
/* getPathInfo

General Comments
A URI is composed of three parts: contextpath + servletpath + pathinfo
All the three parts start with a /. Context path is the part that is mapped to the webapplication. It is returned by getContextPath() method of HttpServletRequest. Servlet Path is the part that causes the servlet to be invoked. Here, /account/* is mapped to the servlet. Therefore, out of /account/*, only the /account part matches the mapping (Note: a * in the URI does not work as a wild card character. It is treated just as any other character) and thus causes the servlet to be invoked. Hence, /account is the servletpath, which is returned by getServletPath() method of HttpServletRequest. Rest of the uri, /*, is the Path Info, which is returned by getPathInfo() method of HttpServletRequest.

Thanks, Naveen.
 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the explaination from Enthuware, anyways thanks for your information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic