• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Servlet Container Root

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read the following in J2EE documentation for HttpResponse.sendRedirect()
Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.

can you tell me what servlet container root means. Is it the Catalina Home directory. Or my Tomcat webapps directory?
 
Marshal
Posts: 67280
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nirmal Mekala Kumar:
Is it the Catalina Home directory. Or my Tomcat webapps directory?



Neither.

The servlet container root does not correspond to any physical folder. Rather, it it is the root of all web apps loaded in the system. Many of these apps may be within the webapps folder, so you might think that it corresponds to that folder, but it doesn't really.

A web app does not have to be in webapps and be configured elsewhere on the system (I routinely do this because I want more control over deployment than Tomcat gives me). These apps too are relative to the servlet context root.

The easiest way to interpret this is that the path is expected to contain the context path of the targetted web application.
 
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:
The servlet container root does not correspond to any physical folder. Rather, it it is the root of all web apps loaded in the system. Many of these apps may be within the webapps folder, so you might think that it corresponds to that folder, but it doesn't really.



I did not understand the part "it it is the root of all web apps loaded in the system". How to visualize this root ? What is the meaning of root ?

Bear Bibeault wrote:
A web app does not have to be in webapps and be configured elsewhere on the system (I routinely do this because I want more control over deployment than Tomcat gives me). These apps too are relative to the servlet context root.



Can you give me an example of a simple app that was made using your approach ? It is new to me. Also, why do books and tutorials tell us to put it in web-apps folder and not like your way ? Will it create difficulties for newbies (like me) ?

Bear Bibeault wrote:
The easiest way to interpret this is that the path is expected to contain the context path of the targeted web application.



Please tell me what is this "context path" ?

PS : 2011, long time....
 
Ranch Hand
Posts: 59
Hibernate Redhat Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm.... where to begin?
Tomcat Context Reference

I also saw an interesting thread here:
ROOT Context Discussion

HTH,
Rick
 
What's that smell? I think this tiny ad may have stepped in something.
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!