when you deploy your application via CLI / Admin console you can provide different "runtime-name" of the deployment.
Which than effects the context root.
so myapp.war would be deployed to "/myapp"
only exception (as defined by servlet spec) for this is ROOT.war that gets deployed to "/"
This works if you don't have context-root set in jboss-web.xml otherwise jboss-web.xml will always win.
if you use deployments folder for deploying your app, you can control this by naming your war differently.