Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getContexPath Issue  RSS feed

 
Souvik Dasgupta
Ranch Hand
Posts: 95
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All,

Say I have an url : http://localhost:8080/youarehere and I want to take out '/youarehere' from it. I tried request.getContextPath() but instead it gives me an empty string. Could somebody please help me here?



Thanks in advance
 
Souvik Dasgupta
Ranch Hand
Posts: 95
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

One more point here. My WAR name is ROOT.war and It can not be changes anyways.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
143
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the root application, the context path is the empty string. To test whether your code works when the app is not the root app, deploy it as anything other than the root app and make sure that the context path is set appropriately.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!