aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes change context-root in application.xml at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "change context-root in application.xml at runtime" Watch "change context-root in application.xml at runtime" New topic
Author

change context-root in application.xml at runtime

khuong pham
Greenhorn

Joined: Dec 15, 2005
Posts: 6
Is it possible to change the context-root in application.xml (ear) at runtime?

I would like to change the context-root from i.e. /usr to /newusr without to recompile the ear file. The changes should be set inside my application or in another configuration file (outside the ear file). Right now I have to hardcode this:

META-INF/application.xml
...
<module>
<web>
<web-uri>usr.war</web-uri>
<context-root>/usr</context-root>
</web>
</module>
...

Thx in advance
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Khuong,
You wouldn't have to rebuild the whole ear. You would have to restart the ear though. This isn't something that can get picked up at runtime.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
khuong pham
Greenhorn

Joined: Dec 15, 2005
Posts: 6
Ok. What is the solution if I have 100 customers and each customers want their own context-root i.e.

company1 = /company1/index.jsp
company2 = /company3/index.jsp
company3 = /company3/index.jsp
...
...

Do I have to applied all 100 context-root inside the application.xml if they use the same ear file. Another solution is to make ant build a application.xml for each customers but it can be differcult to manage if you have over 100 costumers. The best way is that each costumers can change the context-path in a configuration file outside the application(ear) or inside the application(ear) dynamic i.e. from web-interface via the context-path /adm
 
jQuery in Action, 2nd edition
 
subject: change context-root in application.xml at runtime