File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet Container Root Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Servlet Container Root" Watch "Servlet Container Root" New topic
Author

Servlet Container Root

Nirmal Mekala Kumar
Ranch Hand

Joined: Aug 27, 2005
Posts: 63
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?


Nirmal Kumar<br />If you have to aim, aim for the moon. Even if you miss you will land among the stars
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56150
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

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....


SCJP 6. Learning more now.
Rick Roberts
Ranch Hand

Joined: Apr 07, 2005
Posts: 59

Hmmm.... where to begin?
Tomcat Context Reference

I also saw an interesting thread here:
ROOT Context Discussion

HTH,
Rick


SCJP
"Stay on the path."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Container Root
 
Similar Threads
sendRedirect after flush without IllegalStateException.
Confirmation required
response.sendRedirect()
sendRedirect problem
Response Redirection