# Sample web server + rewriting proxy # User's go to the web site to register, then set the site # as their proxy. The proxy adds a "highlight" form onto # every html page, which can be used to highlight all all matches # to a specified search string. port=8082 log=3 handler=main host=localhost main.class=sunlabs.brazil.server.ChainHandler main.handlers=map cookie template auth import content main.glob=* # filter all text/html proxy requests to "highlight" the specified regexp content.class= sunlabs.brazil.filter.FilterHandler content.handler= proxy content.filters= content.highlight content.glob=* content.highlight.class= sunlabs.brazil.filter.HighlightFilter content.highlight.re=${highlight} content.highlight.sub=& content.highlight.trailer=
\ \
\ highlight (re): \
# this is a web site and a web proxy. # if we come to our site though us as a proxy, then skip the # proxy step by removing the protocol and host part of the request map.class=sunlabs.brazil.handler.UrlMapperHandler map.match=^http://${host}:${port}/(.*) map.replace=/\\1 # we use a cookie for a sessionID when we are a web server, and # our proxy credentials id when we are a proxy cookie.class=sunlabs.brazil.handler.CookieSessionHandler cookie.cookie=HighlightProxy cookie.prefix=/ # do this if we came to our web site directly # gather user credentials and a telephone number for later use template.class=sunlabs.brazil.template.TemplateHandler template.prefix=/ template.templates=set bsl add debug template.debug=true set.class=sunlabs.brazil.template.SetTemplate set.headers=headers. set.query=query. set.track=true bsl.class=sunlabs.brazil.template.BSLTemplate add.class=sunlabs.brazil.template.AddHeaderTemplate debug.class=sunlabs.brazil.template.DebugTemplate debug.debug=true # use digest authentication to authenticate to the proxy # This leaves a "username" property in the request, identifying the user auth.class=sunlabs.brazil.handler.DigestAuthHandler auth.isProxy=true auth.prefix=http:// auth.ident=auth:template. auth.realm=highlighter # use this for static credentials auth.credentials=cred.txt # Import the namespace for for our proxy authentication id, so we can # refer to variables that were set when we were a web server. import.class=sunlabs.brazil.template.SetTemplate import.session=auth.username import.sessionTable=template. # The proxy proxy.class=sunlabs.brazil.proxy.ProxyHandler # proxy.proxylog=true