• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
mansi sac
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18469
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Bartender
Posts: 18469
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!