In my IntelliJ web app, I have set the application context to myapp as shown below
When I set the Application context, it doesn't seem to have any effect. I was expecting the app to be deployed to myapp, or at least the generated context.xml file to set my app's context to myapp. Any thoughts on why this doesn't work (does it have something to do with the fact that this is an exploded war)?
The typical way of getting the context path is through the HttpServletRequest class. Simply you can add a HttpServletRequest parameter to your controller method and then get the context path using getContextPath() method. Now that you get the context path, you can pass it to the services that need it.
To change the context root of a web application that is already available in the Eclipse workspace, simply right-click on the web project and call the “Properties” action from the context menu.
The context path is the portion of the request URI that is used to select the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "".
Overriding CATALINA_BASE
in Tomcat startup script may break IDEA deployment as it works by supplying custom CATALINA_BASE
location where the modified configuration is placed so that Tomcat loads artifacts directly from the location specified as the artifact output directory.
See the related question:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With