• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Request Events and Listeners.

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello ranchers

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.
what does mean to the bold line?? filter chain is responsible for calling next filter or a resource (servlet or JSP) accodring to the mapping in DD. we pass request and response object while calling doFilter method on FilterChain object. like FilterChain.doFilter(request,response).

then how can a request become OUT OF SCOPE when it exits from the first filter from the chain??

thanks in advance
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I think you are confused here. The first filter in the chain is the filter which is executed 1st when a request enters the web application and is also executed last when a response exits the web application. Don't think the first filter in the chain as the first one which gets executed after the last servlet. This is just a confusion due to terminology. The first filter in the chain is executed as the last filter when the response is sent to the client...
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
confused
anyone??
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hopefully this will make it easier for you ...

-- request --> first filter --> second filter --> servlet/jsp --> second filter --> first filter --> (out of scope)
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Duc gave a very good way of understanding the concept. Still I would like to add my point of view to it if it makes it easier to understand

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Duc and Ankit,

Ankit you were right, I got confused by the words, used to explain this scenerio. before reading the sentence which I posted , I also got the clear Or rather sane picture described by Duc.

sometime overstudying a topic will make you lose your mind


thanks once again to both
reply
    Bookmark Topic Watch Topic
  • New Topic