Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A couple of questions about ServletRequestListener  RSS feed

 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I studied about ServletRequestListener and I thought it will work like this - whenever a Servlet receives a request it triggers but what happend is this -Even I request for a static html page it triggers

Is it how it will work ? or I have made any mistake ?

Further more couple of questions :

Is there anyway to make listener as servlet specific ?

if so how to ?

Please clarify me.

Thanks in advance

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the ServletRequestFilter documentation:

A ServletRequestListener can be implemented by the developer interested in being notified of requests coming in and out of scope in a web component. A request is defined as coming into scope when it is about to enter the first servlet or filter in each web application, as going out of scope when it exits the last servlet or the first filter in the chain.


So anything in your web application is in scope. You can't narrow it any further.


Is there anyway to make listener as servlet specific ?

If its is Servlet specific why use a listener? What does it give you that mapping a Servlet to a specific url doesn't?
 
Romit Bose
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Maybe I am missing something(please correct me if i am wrong) but, can we not use different URL patterns to route the requests to different servlets in this case?
 
Romit Bose
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,
I didnt notice that I am reiterating Paul's comments only.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!