I think you can do it in both application.xml(xxx.ear) and jboss-web.xml(xxx.war)
(a) application.xml (I tested it in my projects, it works well)
<?xml version="1.0" encoding="UTF-8"?>
(b) jboss-web.xml (NOT tested)
Although I does NOT test it, I think you can find answer from jboss-as-7.2.0.Final\docs\schema\jboss-web_7_1.xsd.
There is an element definition:
<xsd:element name="context-root" type="jboss:context-rootType" minOccurs="0" maxOccurs="1"/>
Moreover, please read some files in jboss-as-7.2.0.Final\docs\schema if you meet similar questions.
also you can use system properties inside application.xml / web.xml / jboss-web.xml and parametrize context root also with that.
How to parametrize? Would you please post some code here?
I am very interested in it.
at first, thanks for you suggestions!
I guess I need to clarify a bit more, since adopting the application.xml or the jboss-web.xml does not sound like a solution for me.
I'm taking care about the operations of some applications. We get "ready to use" application packages (EAR or WAR) from our software supplier. this package cannot be changed for support reasons - otherwise we loose support.
but unfortunately we need to deploy this package with different contexts (because of the connecting systems in 3 staging environments) and therefore i would like to to deploy the same EAR/WAR package (whatever is defined in application.xml or jboss-web.xml) using my own defined context.
I think this should be possible with "deployment overlay" feature in WildFly. I am not sure if there is some documentation for it though. I'll have to dig through some mails to confirm.
This sounds very interesting.
I'm using jboss-as-7.1.1.Final. Does the overlay - way also apply? I couldn't find it in the documentation
It was done post 7.1.1.Final release. So no, it's not in 7.1.1.