Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic