This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Servlet Request Events and Listeners. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Servlet Request Events and Listeners. " Watch "Servlet Request Events and Listeners. " New topic
Author

Servlet Request Events and Listeners.

Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
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

Thanks <br />Poonam Agarwal SCWCD 86%
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
confused
anyone??
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Hopefully this will make it easier for you ...

-- request --> first filter --> second filter --> servlet/jsp --> second filter --> first filter --> (out of scope)


“Everything should be as simple as it is, but not simpler.” Albert Einstein
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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

Joined: May 12, 2008
Posts: 323
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Request Events and Listeners.
 
Similar Threads
Request in and out of scope
specs doubt
Question 65 Final mock exam - HFSJ
A couple of questions about ServletRequestListener
A Question about ServletRequestListener behaviour