-
1. Re: Jboss EAP6.2 multiple context-root issue
jaysensharma Dec 13, 2014 3:34 AM (in response to mathewvino)Adding multiple duplicate module with different context-root inside application.xml will not help.
Rather you can try adding only one <context-root>test</context-root> and map test to test1, test2, test3 using Rewrite Valve inside the JBoss Web SubSysem as following:
<subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" native="false"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> <rewrite name="rule-1" pattern="^/test1(.*)$" substitution="/test/$1" flags="R"/> <rewrite name="rule-2" pattern="^/test2(.*)$" substitution="/test/$1" flags="R"/> <rewrite name="rule-3" pattern="^/test3(.*)$" substitution="/test/$1" flags="R"/> </virtual-server> </subsystem>
Now you should be able to access this application using any of the following URL:
-
2. Re: Jboss EAP6.2 multiple context-root issue
mathewvino Dec 13, 2014 10:55 AM (in response to jaysensharma)Thanks Jay let me try and will update.Thanks for the Input
-
3. Re: Jboss EAP6.2 multiple context-root issue
mathewvino Dec 15, 2014 1:26 PM (in response to jaysensharma)Hi Jay,
I just tried to test this. But if i do http://localhost:8080/test1 its redirect to http://localhost:8080/test
I have different config file for different context path. Is there any way I can still retain the same context path
which mean when i do http://localhost:8080/test1 it should not redirect to http://localhost:8080/test ( I mean the context path should be test1)
Thanks for the help
Vinoj
-
4. Re: Re: Jboss EAP6.2 multiple context-root issue
jaysensharma Dec 15, 2014 11:50 PM (in response to mathewvino)According to EE6 specification:
EE.8.4.1 "Assembling a Java EE Application"
Assign a context root for each web module included in the Java EE application. The context root is a relative name in the web namespace for the application. Each web module must be given a distinct and non-overlapping name for its context root. The web modules will be assigned a complete name in the namespace of the web server at deployment time. If there is only one web module in the Java EE application, the context root may be the empty string. If no deployment descriptor is included in the application package, the context root of the web module will be the module name. See the servlet specification for detailed requirements of context root naming.
As specification states that "Each web module must be given a distinct and non-overlapping name for its context root", So from Specification perspective i do not see an option of having multiple context-root for the same application.
Is there any specific need you want have multiple context-root for the same web application?
[1] http://download.oracle.com/otndocs/jcp/javaee-6.0-fr-oth-JSpec/