When you execute a web module on the Tomcat server, the server uses a context path setting to derive the path to the web module. For example, if the context path is /directives, then you can access a file named index.html under the web module's document base (root directory) using the URL http://host:port/directives/index.html.
You should set a context path for a web module if you plan to execute different web modules on the same server. Otherwise, files with the same name will overwrite files from other web modules.
![]() |
When you create a web module from the New wizard, the IDE automatically derives the context path from the name of the document base (root directory). |
To Set a Web Module's Context Path:
![]() |
When you change the Context Path in the property sheet, the IDE updates the Tomcat context descriptor (META-INF/context.xml) to match. |
When the server receives the HTTP request, the server selects the web module for processing the request by matching the longest possible prefix of the Request URI against all of the defined context paths. A host can have an unlimited number of unique context paths.
See Also | |
---|---|
Running a Web Module Using Tomcat Tomcat Context Descriptor Node Tomcat Web Modules Node Removing a Web Module from the Tomcat Server |