I hava such application.xml.
<module> <web> <web-uri>services-inboxService.war</web-uri> <context-root>/services/inboxService</context-root> </web> </module>
I would like to map different context-roots to one web-uri. But there are constraints and each module should contain only one web section and each web - only one context-root section. Is there any way except copying this war file named differently?
Yegoshin Maxim- I believe you must be clear about the URI concept in a Java EE based Web application:
<hostname:port/context-root/resource-path?parameters>
Now if someone wants to use a different hostname+port combination to be served by the same installed application, they should use the concept of virtual hosting which is supported by mostly app servers like Tomcat, WebSphere.
If someone wants to use a different resource-path to map to the same resource in a web application, it is done by configuring a url-pattern in web.xml
Now if someone wants to use a different context-root for a single installation of an application, it is not possible. Even if you think from the classloader point of view. A context leads to the creation of a context classloader which is the child of the app server classloader. We can't have more than one context classloader for one web app, otherwise it is impossible to resolve resource/class references. So the only solution is to have multiple instance of an app running under different context roots.
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