File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Can i call filter after particulate event? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can i call filter after particulate event?" Watch "Can i call filter after particulate event?" New topic
Author

Can i call filter after particulate event?

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

Hi can i call a filter after a event, say i have a logout link and it is redirecting to lo-gout servlet where i am removing all session attributes like this


is that possible or any why to clear cache after logout link is pressed..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

You don't call filters -- they are automatically invoked to bracket mapped requests. Why do you need to call a filter? Just refactor the code so that it can be called as a method.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

i want to clear all jsp cache after logout. if i use methode is it clear all my JSP cache?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

It appears to me that your question is actually "How do I clear my JSP cache (whatever that is) from Java code in a servlet or filter?" Is that right?
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

yes correct
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

You could have the same logic within a method to clear your JSP, servlets cache when you wanted to do so. Actually by calling appropriate session.invalidate(), will clear all session stored items for a particular session.


No pain, No gain.
OCJP 1.6
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

The session has nothing at all to do with the cache, so invalidating the session will have no effect not he cache.

See the ServletsFaq for information on setting cache headers.
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 530
    
    2


say i have a logout link and it is redirecting to lo-gout servlet


You can configure filters to intercept request/responses before reaching/coming from the servlet. So, upon clicking "logout" it is expected to go to servlet and you can configure a filter before it goes to the actual servlet.

But this has nothing to do with clearing cache. As Bear pointed out, you need to refer the link he provided.


Regards
KumarRaja

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can i call filter after particulate event?