views:

79

answers:

1

Hello

I have configured a filter to disable my browser back button and show the user as session expired. It is working as expected when i configure that in my application prototype but when i incorporated it to my (spring MVC) application it is not working.

I have configured my filter like this

<filter>
 <filter-name>backButtonFilter</filter-name>
 <filter-class>
  com.filters.BackButtonFilter
 </filter-class>
</filter>
<filter-mapping>
 <filter-name>backButtonFilter</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

and i had my filter contents like this

response.setHeader("cache-control",
   "no-cache, no-store, must-revalidate");
 response.setHeader("pragma", "no-cache");
 response.setDateHeader("expires", 0);
 response.setHeader("Cache-Type", "private");

I have intorduced the log statement to see if my filter is getting executed or not.I can see it executing

Could any body please help me why it is happening so.

+1  A: 

May I suggest using Firebug to check out the HTTP headers on the browser end? That should make it easier to see why they're not working as intended.

EDIT One thing to watch out for, make sure the HTTP headers are all being written out before the HTTP body.

Adam Luchjenbroers
I not not aware of fire bug. I will try to track this
Shivaji