Class HistoryFilter
HistoryFilter is both a Handler and a
Filter that keeps a record of all pages visited by a
given session.
The HistoryFilter can be used to
make a user's session "mobile" as follows: A user's history
is 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 history will not be there. Instead, the user can access the web
via a proxy that keeps track of their history. No matter which browser
the user chooses or machine the user is at, a server running with the
HistoryFilter will automatically remember and be able to
present the user's history.
The history is kept with respect to a Session ID.
This filter uses the following configuration properties:
-
prefix - This handler will only process URLs beginning with this string. The default value is "", which matches all URLs.
-
session - The name of the request property that holds the Session ID. The default value is "SessionID".
-
nosession - The Session ID to use if the Session ID was not specified. The default value is "common".
-
admin - URLs beginning with this prefix cause the
HistoryFilterto store the history information for the current Session in the request properties -
filter - If specified, then this is a
Regexppattern to match against the "Content-Type" of the result. Setting this also implies that theHistoryFilterwill be invoked as aFilterand not aHandler. The default value is "", which indicates that the "Content-Type" is not examined and that thisHistoryFilterwill be invoked as aHandler.
- Version:
- 2.2
- Author:
- Colin Stevens (colin.stevens@sun.com)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]filter(Request request, MimeHeaders headers, byte[] content) Returns the original content, since this filter does not change content.booleanInitializes this filter by reading all its configuration properties.booleanIf theadminprefix is seen, store the history information associated with the session in the request properties.booleanshouldFilter(Request request, MimeHeaders headers) Called when invoked as aFilter.
-
Field Details
-
urlPrefix
-
session
-
nosession
-
admin
-
filter
-
-
Constructor Details
-
HistoryFilter
public HistoryFilter()
-
-
Method Details
-
init
Initializes this filter by reading all its configuration properties.It is an error if the
filteris specified but malformed. -
respond
If theadminprefix is seen, store the history information associated with the session in the request properties.If invoked as a
Handlerand the URL matches theprefix, records this page's address in the history. -
shouldFilter
Called when invoked as aFilter. If the URL matches theprefixand the returned "Content-Type" matches thefilter, records this page's address in the history.- Specified by:
shouldFilterin interfaceFilter- Parameters:
request- The in-progress HTTP request.headers- The MIME headers from the result.- Returns:
falseindicating that thisFilterdoes not want to modify the content.
-
filter
Returns the original content, since this filter does not change content. Won't actually be invoked.- Specified by:
filterin interfaceFilter- Parameters:
request- The finished HTTP request.headers- The MIME headers generated by theHandler.content- The output from theHandlerthat thisFiltermay rewrite.- Returns:
- The rewritten content. The
Filtermay return the originalcontentunchanged. TheFiltermay returnnullto indicate that theFilterHandlershould stop processing the request and should not return any content to the client.
-