Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Context Root in WEB.XML

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know the syntax for setting Contect Root in Web.xml. Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Please let me know the way to set the context root irrespective of the server/container.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18157
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic