sunlabs.brazil.filter

Class UrlSessionFilter

public class UrlSessionFilter extends Object implements Filter

Sample filter to use url's instead of cookies for sessions. When html files are delivered, all URL's back to this host are changed to add in the session information. When requests are made, the session info is stripped off the URL, which is passed to the rest of the handlers.

Note: This fiter has been superceded by the SessionFilter. It is included for illustrative purposes only.

Version: 2.3

Author: Stephen Uhler

Field Summary
Stringsession
Method Summary
byte[]filter(Request request, MimeHeaders headers, byte[] content)
Rewrite all the url's, adding the session id to the end
booleaninit(Server server, String propsPrefix)
booleanrespond(Request request)
Extract the cookie out of the URL, rewriting the url as needed.
booleanshouldFilter(Request request, MimeHeaders headers)
We have the results, only filter if html

Field Detail

session

public String session

Method Detail

filter

public byte[] filter(Request request, MimeHeaders headers, byte[] content)
Rewrite all the url's, adding the session id to the end

init

public boolean init(Server server, String propsPrefix)

respond

public boolean respond(Request request)
Extract the cookie out of the URL, rewriting the url as needed. Add the session info at the end of the url: /a/b.html -> /a/b.html$xxxx where xxx is the session This gets called before the original request is made.

shouldFilter

public boolean shouldFilter(Request request, MimeHeaders headers)
We have the results, only filter if html