tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: tomcat 5.x context path priority
Date Wed, 21 Dec 2005 19:29:54 GMT
That passage hasn't changed since Tomcat 4. 

Think of it this way.  When the request comes in, the very first 
decision tomcat has to make is what context should handle the request.  
It compares the incoming URI to it's list of context paths and sends the 
request to the context with the longest match.  The next decision tomcat 
makes is what servlet mapping within a context is to handle the 
request.  Again, the longest match wins.

This is how index.html of the admin webapp trumps /admin/index.html of 
the ROOT context when the admin webapp is installed.  The ROOT context 
path is simply "" while the admin webapp's context path is "/admin".  
Admin being the longest match wins.  By extension if you had a context 
named admins and the request is to /admins/index.html, it would go to 
the admins context instead of the admin context.  Again, longest match wins.

--David


foo java wrote:

>Hi David,
>
>Thanks for your reply. But i didn't got it properly;
>
>How do you say that the defined context with "/myapps/conf" will get
>precedence over "/myapps" and subfolder conf in this application ??
>The document you referred is for tomcat 5.5, is that also same for tomcat
>5.0.x versions?
>
>Any tomcat developers wish to contribute?
>
>foojava
>
>
>
>
>On 12/20/05, David Smith <dns4@cornell.edu> wrote:
>  
>
>>Just looking up some other info, I ran accross this which directly
>>answers your question:
>>
>>http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
>>
>>--David
>>
>>David Smith wrote:
>>
>>    
>>
>>>I'm not sure there is a documented spec on this at the container
>>>(tomcat) level.  One of the tomcat developers would know best about
>>>this, but I would imagine tomcat handles such issues the same way
>>>servlet mappings within a webapp are handled.  The longest matching
>>>path is the one that's chosen.
>>>
>>>
>>>--David
>>>
>>>foo java wrote:
>>>
>>>      
>>>
>>>>Hi,
>>>>
>>>>I am trying to find a "documented" solution for one of my problems with
>>>>tomcat contexts.
>>>>
>>>> I would like to ask about the tomcat servlet container( 5.x) and it's
>>>>prioritised handling of the context paths in the following situation. A
>>>>pointer to official documentation will be of much help to me.
>>>>
>>>> If you consider the following structure for my application(web)
>>>>        
>>>>
>>source:
>>    
>>
>>>> myapps
>>>> myapps--conf
>>>> myapps--JSP
>>>> myapps--WEB-INF
>>>> myapps--WEB-INF/classes
>>>> ....
>>>>
>>>>
>>>> The conf directory in my application holds css and images.
>>>> Suppose, i deployed one of my context in tomcat as
>>>> <context path="/myapps" docBase="/path/to/source" >
>>>> </context>
>>>>
>>>>The situation is there are many contexts deployed in the tomcat using
>>>>the
>>>>same source (myapps). But, if i want to make some of the contexts to
>>>>have
>>>>it's own conf directory and using the docbase as normal for sources.
>>>>I am
>>>>planning to do it the following way:
>>>>
>>>> if i deploy one more context say /myapps/conf
>>>>
>>>> <context path="/myapps/conf" docBase="/external/path/to/conf/dir">
>>>> </context>
>>>>
>>>> P.S: i have used a "/" to add conf path to the new context.
>>>>
>>>> FINAL DOUBT
>>>>
>>>> Is it ensured by the tomcat container that any request that comes for
>>>>"/myapps/conf" will be directed to the new context deployed and not
>>>>within
>>>>the sources. I have tested it and it seems to work as fine. But i need
>>>>official documentation (for my superiors not to say that i assume!!)
>>>>which
>>>>shows the priority in which tomcat considers the request processing.
>>>>
>>>> I hope i m able to convey my query.
>>>>
>>>> thanks and regards,
>>>>foojava
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>    
>>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message