Lifetime filter ver. 1.4

This is a Java servlet filter (as per Servlet API 2.3). This filter lets you restrict lifetime for HTTP sessions. It is not an inactivity time supported by default, but the whole lifetime for any opened HTTP session. It means that after that time session will be invalidated and incoming request will be forwarded to some specified URL.

How to use it:

a) download lifetimeflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. You have to provide an initial parameter redirect (describes an URL for redirection) and an initial parameter time (describes life time for your sessions in seconds). Default value for time parameter is 600 (10 minutes).

Also you can exclude some of your files from the processing. An optional parameter exclude contains a commas separated list of files excluded from the processing.

Also you can dynamically exclude some of your requests from the processing (bypass the limitations). Just set a name for session scope attribute that should be presented for excluded requests. Parameter's name is flag.


c) describe a mapping for this filter in web.xml. E.g.:


in this example filter will be on for the each .jsp file. If target URL starts with http than request will be redirected. Otherwise filter assumes a local resource and forwards request.

   For downloading:

    Life Time package:  lifetimeflt.jar

In JSP you can use Lifetime taglib for getting time information.

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.


Also in JSOS: