aspose file tools*
The moose likes Tomcat and the fly likes How to change url(context-root) of a web application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to change url(context-root) of a web application?" Watch "How to change url(context-root) of a web application?" New topic
Author

How to change url(context-root) of a web application?

mansi sac
Greenhorn

Joined: Nov 15, 2010
Posts: 4
Hello all

I am currently working with Tomcat 5.5 and deploying one web application on it which is developed using jersey.
The url to the webservice is as follows :

http://localhost:8080/HelloJersey1/hellojersey/hello

Now I want the url to be as follows :

http://localhost:8080/s2/HelloJersey1/hellojersey/hello

How do I do that?I guess this is not a url-pattern which we configure by web-xml.

Thanks in advance
Mansi
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

You are correct. web.xml does not define the context root, and in fact, no J2EE-standard component does.

The Tomcat Context element defines the context root in its "path=" attribute. The Context Element can be defined in one of 3 places:

1. In a file in the WAR: META-INF/context.xml

2. In the Tomcat configuration: TOMCAT_HOME/conf/Catalina/localhost/xxxxxxx.xml (the "xxxxxxx" can be any valid filename)

3. In the Tomcat server.xml file (STRONGLY discouraged!)

If you deploy a WAR without a Tomcat Context definition, one is synthesized, but then you don't have control over the context root pathname.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

You are correct. web.xml does not define the context root, and in fact, no J2EE-standard component does.

The Tomcat Context element defines the context root in its "path=" attribute. The Context Element can be defined in one of 3 places:

1. In a file in the WAR: META-INF/context.xml

2. In the Tomcat configuration: TOMCAT_HOME/conf/Catalina/localhost/xxxxxxx.xml (the "xxxxxxx" can be any valid filename)

3. In the Tomcat server.xml file (STRONGLY discouraged!)

If you deploy a WAR without a Tomcat Context definition, one is synthesized, but then you don't have control over the context root pathname.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change url(context-root) of a web application?