sunlabs.brazil.proxy

Class CookieFilter

public class CookieFilter extends Object implements Filter

The CookieFilter keeps a record of all the browser cookies associated with a given session. This can be used to make the user's cookies "mobile" as follows. A user's cookies are normally stored with the browser being used, on the user's machine. If the user runs a different browser or goes to a different machine, the user's cookies will not be there. Instead, the user can access the web via a proxy that keeps all their cookies. No matter which browser the user chooses or machine the user is at, a proxy running with the CookieFilter will automatically remember and add in their appropriate cookies. The CookieFilter also supports multiple, concurrent users, keeping each user's cookies separate. Properties:
session
The request property to find the session id. Defaults to "SessionID"
nosession
The name of the session to use if no session id is found. defaults to "common".
admin
A URL prefix that causes status information to be placed in the request properties.

Version: 2.5

Author: Stephen Uhler (stephen.uhler@sun.com) Colin Stevens (colin.stevens@sun.com)

Field Summary
Stringadmin
Stringnosession
Stringsession
Method Summary
byte[]filter(Request request, MimeHeaders headers, byte[] content)
Returns the original content, since this filter does not change content; it changes the headers.
booleaninit(Server server, String prefix)
booleanrespond(Request request)
booleanshouldFilter(Request request, MimeHeaders headers)
Saves all "Set-Cookie" headers from the target in the client's local storage, then removes those headers before allowing the response to go back to the client.

Field Detail

admin

public String admin

nosession

public String nosession

session

public String session

Method Detail

filter

public byte[] filter(Request request, MimeHeaders headers, byte[] content)
Returns the original content, since this filter does not change content; it changes the headers.

init

public boolean init(Server server, String prefix)

respond

public boolean respond(Request request)

shouldFilter

public boolean shouldFilter(Request request, MimeHeaders headers)
Saves all "Set-Cookie" headers from the target in the client's local storage, then removes those headers before allowing the response to go back to the client. The client never sees cookies on their local machine.