David
David

Reputation: 1107

JBoss Rename ROOT.WAR to default

I have a jboss 4 webserver and if I deploy a webapp into

www/webapps/ROOT.WAR/

it loads on the domain as http://www.mywebsite.com/

If I deploy a webapp into

www/webapps/internal

it loads on the domain as http://www.mywebsite.com/internal/

So somewhere jboss detects ROOT.WAR as a magic keyword indicating '/'.

Is this configurable? If I needed my folder structure to be:

www/webapps/default

Can I change a setting to make Jboss load it as http://www.mywebsite.com/ instead of http://www.mywebsite.com/default/

Thanks

Upvotes: 1

Views: 3059

Answers (1)

Michael
Michael

Reputation: 7438

ROOT.war being the default web application is part of the Java EE Servlet Specification.

Basically if your web application doesn't explicitly specific the context root, it'll use the name of the war file by default. The "root" context is a special case, which will be assigned to the root of your site. I.e. "/". The easiest way to change the context root would be for you to rename your war file to something other than "ROOT".

For JBoss specifically, you can create a jboss-web.xml in your applications WEB-INF folder like this:

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

The above would be how you'd explicitly set root context. Here's how to set "internal" as the context:

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

Here's the JBoss guide on how to configure it:

http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch06.html

Upvotes: 3

Related Questions