| java.lang.Object sunlabs.brazil.filter.SessionFilter
SessionFilter | public class SessionFilter implements Filter(Code) | | Filter to manage browser sessions.
This should be used as the last filter in the filter chain.
It attempts to use browser cookies. If they don't work,
it rewrites the URL's instead, tacking the session info onto
the end of the URL.
The following server properties are used:
- cookie
- The name of the cookie to use (defaults to "cookie").
If the name is "none", then no cookies are used. Instead,
session rewriting will occur for every session.
- session
- The name of the request property that the Session ID will be stored
in, to be passed to downstream handler. The default value is
"SessionID".
- persist
- If set, cookies persist across browser sessions.
If cookies are disabled, no persistence is available.
- suffix
- A regular expression that matches url suffix we process.
Defaults to
html|xml|txt .
The Following request properties are set:
- gotCookie
- An id was retrieved out of a cookie header
- UrlID
- Set to the string tacked onto the end of each URL, if
session ID's are managed by URL rewriting.
author: Stephen Uhler version: 1.9, 01/01/14 |
persist | public boolean persist(Code) | | |
fetchCookie | String fetchCookie(Request request)(Code) | | Try to Get the cookie out of the http header. Cookies can be
on separate lines or all combined on one line.
When multiple cookies are on one line, they are separated
by ';' characters.
The cookie value, or null if not found. |
filter | public byte[] filter(Request request, MimeHeaders headers, byte[] content)(Code) | | Rewrite all the url's, adding the session id to the end
|
respond | public boolean respond(Request request) throws IOException(Code) | | This is called by the filterHandler before the content generation
step. It is responsible for extracting the session information,
then (ifd required) restoring the URL's to their original form.
It tries relatively hard to use cookies if they are available
through a series or redirects.
|
shouldFilter | public boolean shouldFilter(Request request, MimeHeaders headers)(Code) | | We have the results, only filter if html and we're rewriting
|
|
|