Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Tomcat and sequence of events

Thread view: 
pvsnmp@yahoo.com - 04 Dec 2005 15:32 GMT
Hi,
I have a web application with a number of servlets. I am using Tomcat.
I have configured a filter for the web application in its web.xml file.
The url pattern which the filter will match is /*. The application
servlets are present in ROOT directory, the default  web application
path.  I have also enabled the invoker servlet. It matches the default
url pattern /servlet/*.
Can someone explain the sequence of events that happen as a request
arrives for a servlet , with URL /servlet/xyz ? How does the filter
know where to hand the request to when it reaches
chain.doFilter(req,res) ? There are no other filters and none of the
servlets are defined in the web.xml file, so its the invoker servlet
which hands the request to servlets i guess. But how to the various
components know what is to be done next???

rgds,
Prashant
Hiran Chaudhuri - 04 Dec 2005 23:46 GMT
> I have a web application with a number of servlets. I am using Tomcat.
> I have configured a filter for the web application in its web.xml file.
> The url pattern which the filter will match is /*. The application
> servlets are present in ROOT directory, the default  web application
> path.  I have also enabled the invoker servlet. It matches the default
> url pattern /servlet/*.

What do you mean by 'The application servlets are present in ROOT directory?

> Can someone explain the sequence of events that happen as a request
> arrives for a servlet , with URL /servlet/xyz ? How does the filter
> know where to hand the request to when it reaches
> chain.doFilter(req,res) ?

Tomcat fist checks the first part of the url to find the correct web
application (context).
Then it executes all the registered listeners, if their URL pattern matches.
Then it executes the servlet whose URL pattern matches.
Then it returns the response through the filters back to the browser.

> There are no other filters and none of the
> servlets are defined in the web.xml file, so its the invoker servlet
> which hands the request to servlets i guess. But how to the various
> components know what is to be done next???

That is what you specified in your web.xml. There are some more components,
such as valves. They are Tomcat internal and probably not interesting for
you.

Hiran
pvsnmp@yahoo.com - 05 Dec 2005 00:18 GMT
>Tomcat fist checks the first part of the url to find the correct web
>application (context).
>Then it executes all the registered listeners, if their URL pattern matches.
>Then it executes the servlet whose URL pattern matches.
>Then it returns the response through the filters back to the browser.
>Hiran

Hi,
what abt request going through filter?? How does the filter know where
handout the request once its job is done ?? In my case i am not
defining the servlets in the web.xml file.

rgds,
Prashant


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.