• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question for contextPath retrieved from request

 
daniel xie
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is contextPath always refer to root directory of web application?
If yes, that means this path shares for the whole application then why define it in HttpServletRequest, i think ServletContext is a better place to hold it, right?

Could i define it in web.xml or server config files?
 
Arvind Giri
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, what if a server have different aliases(e.g. mail.xxx.com and xxxmail.com may be same server) and application needs to know which url was requested.
 
daniel xie
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
context path is the portion of the request URI that indicates the context of the request. it doesn't include domain name/ip address or port.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic