aspose file tools*
The moose likes Servlets and the fly likes Can filters be invoked AFTER servlets? 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 » Java » Servlets
Bookmark "Can filters be invoked AFTER servlets?" Watch "Can filters be invoked AFTER servlets?" New topic
Author

Can filters be invoked AFTER servlets?

Qand Davaatsedev
Ranch Hand

Joined: Feb 06, 2002
Posts: 36
Following is a quote from "Hibernate in Action" book:

<quote>The job of the servlet filter is to close the Session before the
response is sent to the client (and after all views are rendered and actions are executed).</quote>

Is this approach feasible? As I understand, container invokes a filter BEFORE forwarding to a controller servlet. Can filters be invoked AFTER servlets and JSP pages finish their work to commit work and close Hibernate Session?


Qand
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
A filter sees the request BEFORE the servlet is called and the response AFTER the call returns from the servlet so the answer is yes. Take a look at the doFilter method in the javax.servlet.Filter interface.
Bill


Java Resources at www.wbrogden.com
Qand Davaatsedev
Ranch Hand

Joined: Feb 06, 2002
Posts: 36
Thank you, Bill.

Everything's clear now
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can filters be invoked AFTER servlets?
 
Similar Threads
Filters
Filter mapping in web.xml
Regarding filter invocation
can any body tell about the filter in servlet
Question about Filter trigger sequence