Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting contextpath without request

 
Robert Willems
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
is there a way to get the contextpath a webapplication is configured to without a request? You configure your app-server with that path before getting requests....
In other words can is there anyway i can get the contextpath with only a javax.servlet.http.HttpServlet object?
Thanks in advance...
Regards,
Robert Willems
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the getServletContextName() of the ServletContext which you get from the ServletConfig object passed to you in the init() method.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!