• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Context Root in WEB.XML

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please let me know the syntax for setting Contect Root in Web.xml. Thanks.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The context root is not set in the web.xml. It's set by how you deploy the web app in your container. Your web app itself has (or should have) no knowledge of what the actually context path will be.

If you've hard-coded the context path anywhere within your web app, you've done it wrong.

And it's web.xml, not Web.xml or WEB.XML. Case counts.
 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I want to know a generic way to configure context root. As i am using tomcat in my dev and wl 10.3 in a test env. Please clarify.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have moved this to the Tomcat forum.

Please reference the Tomcat documentation on how to deploy web apps. It's pretty easy.

Post back with question you might have.
 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please let me know the way to set the context root irrespective of the server/container.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no way. Each container has its own means of setting up web apps. You'll need to follow the rules of the specific container that you are using.
 
Saloon Keeper
Posts: 27764
196
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
J2EE defines 2 separate sources for deployment information. One is web.xml. One is container-dependent, and is usually, but not always an XML file. It's format and content is defined by the application server provider. You can find out details on this under the JSR-88 spec.

Tomcat's deployment descriptor is the <Context> element which can be defined in Tomcat's server.xml (please don't), an XML file in Tomcat's conf/Catalina/localhost directory, or in the WAR as a file named context.xml. Container-supplied definitions will override context.xml.

ONLY Tomcat and product with embedded Tomcat (like JBoss) use this context.xml file. Products such as IBM's WebSphere have their own deployment descriptor file names and formats.
 
reply
    Bookmark Topic Watch Topic
  • New Topic