Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBoss 7: how to change a WAR context root

I have an application that is to be deployed in a WAR file (app.war). After deployment it is available from http://:8080/app I would like to have it being made available as something like http://:8080/secret/app

I searched the documentation and for JBoss'es 5 and 6 this seems to be able to do with a jboss-web.xml file. I have tried it but with no luck. It seems that JBoss 7 just ignores the element inside jboss-web.xml.

I don't know if this is relevant but this application has both JSF and PrettyFaces.

Does anyone know if this behavior is possible with JBoss 7? If so, how can it be done? I am still trying to find an answer for this.

Thank you.

like image 444
Aikanaro Avatar asked Feb 10 '12 18:02

Aikanaro


People also ask

How do you change the context of a root?

1.1 Right click on the project, select Properties , Web Project Settings , update the context root here. 1.2 Remove your web app from the server and add it back. The context root should be updated. 1.3 If step 2 is failing, delete the server, create a new server and add back the web app.

What is context root path?

A context root identifies a Web application archive (WAR) file in an application server. The context root of a Web application determines which URLs application server will delegate to your web application. When MobileFabric installed, the required components' WARs are deployed to an app server.

How do I set context root in web xml?

To Set the Context RootA context root must start with a forward slash (/) and end with a string. In a packaged web module for deployment on the GlassFish Server, the context root is stored in glassfish-web. xml.


1 Answers

this works in AS 7.0.1, WEB-INF/jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>/my_custom_root</context-root>
</jboss-web>

I don't think it is possible to have app root like "server/something/app", but you can simulate this behavior through application structure

like image 53
simkam Avatar answered Oct 06 '22 03:10

simkam