sunlabs.brazil.filter
public class SessionFilter extends Object implements Filter
This Filter works by first examining the request as a handler. If the request contains an ID, either in the "browser cookie" or written into the URL, the session ID is extracted. In the id-in-the-url case, the ID is removed from the URL. When called later as a filter, the SessionFilter rewrites all relevent URL's in the page to incorporate the ID.
If an ID can't be found either in the cookie or URL, a couple the session creation sequence starts. First, the browser is send a "set-cookie" request along with a redirect that contains the cookie value encoded into the redirected URL. When the browser follows the redirect, the request is examined to se if the cookie value was sent. If so, the browser is redirected back to the original URL, and normal "cookie" processing takes place. If no cookie is found, the browser is redirected back to the original URL, modified to embed the ID into it, and normal URL session rewriting takes place.
The following server properties are used:
html|xml|txt
.
Version: 2.4
Field Summary | |
---|---|
String | cookieName |
String | encoding |
boolean | persist |
String | redirectToken |
String | session |
String | urlSep |
Method Summary | |
---|---|
byte[] | filter(Request request, MimeHeaders headers, byte[] content)
Rewrite all the url's, adding the session id to the end |
boolean | init(Server server, String propsPrefix) |
boolean | respond(Request request)
This is called by the filterHandler before the content generation
step. |
boolean | shouldFilter(Request request, MimeHeaders headers)
We have the results, only filter if html and we're rewriting |