Sun Microsystems Laboratories Experimental Stuff Text Document
# Main config file for www.experimentalstuff.com
# The basic strategy is to:
# - grab the content, either locally or from sun.com
# - extract the content, then stuff it into a "personalized" template

log=1
handler=main
exitOnError=on
root=html
port=80

# The main handler chain is used to install handlers whose purpose
# is to either modify the behavior of the server, or return non-filtered
# content.  The final handler "filter"
# wraps all handlers that play a part in content generation

main.class=sunlabs.brazil.server.ChainHandler
main.handlers=runas robot format raw persist poll filter

# Change the running permissions of the server

runas.class=sunlabs.brazil.sunlabs.RunAsHandler
runas.user=brazil
runas.group=staff

# All robots get a special sessionid, "robot".  We assume all user agents
# that don't match the list of "normal" user agents are to be treated
# as if they are robots.

robot.class=sunlabs.brazil.handler.SimpleSessionHandler
robot.extract=${user-agent}
robot.re=!IE|Mozilla|Opera|IBrowse
robot.value=robot

# We want to make sure robots get the "robot" template.  We'll pervert
# the session handler to do the job, by using the property that contains
# the "template name" as the session id, and setting it to the robot 
# template if we're using the robot session.
# This is a hack (fixed in the next release).

format.class=sunlabs.brazil.handler.SimpleSessionHandler
format.session=template.fileName
format.extract=${user-agent}
format.re=!IE|Mozilla|Opera|IBrowse
# the new version will be:
# format.extract=${SessionID}
# format.re=^robot$
format.value=admin/robot.template
format.force=true

# Everything here is fetched without template processing.
# It's theoretically more efficient, but I'm not sure if its a good idea.
# To access raw/XXX, the url should be /XXX
# Its used for images and robots.txt

raw.class=sunlabs.brazil.server.FileHandler
raw.root=html/raw

# Use a persistent session manager to save all session state kept
# by the SetTemplate.  We'll define a special URL that dumps out
# all current state and saves it to a file.  By putting that URL
# under /local, we can protect it from unauthorized use.

persist.class=sunlabs.brazil.session.PropertiesCacheManager
persist.storeDir=session_data
persist.match=/local/save_state.html
persist.size=5000
persist.defer=true

# Set up a background thread that will issue a url to save the
# current session state every night.  This URL should be issued "by hand"
# before shutting down the server.
# - check at least once an hour (interval)
# - save state at 2300 hours (match) == (format)
# - We'll be detected as a "robot", so we don't need to deal with cookies.

poll.class=sunlabs.brazil.handler.PollHandler
poll.url=http://localhost/local/save_state.html
poll.interval=3500
poll.format=HH
poll.match=23

# The filter handler works by obtaining content from one of a sequence
# of handlers, then filtering it through "filters".
# Each filter may also act as a handler.  The order of operation is:
# - Run the "filters" as handlers
# - Run the "handler" to get the content
# - filter the content sequentially through the filters

filter.class=sunlabs.brazil.filter.FilterHandler
filter.handler=content
filter.filters=plain process extract template integrate highlight remap session

# The next set of handlers obtain the content, which is then filtered
# and rewritten as directed
# - load:	preloads the state managed by the SetTemplate
# - badguy	restrict download access to non-EAR web domains
# - map		maps all download requests into the "authorized" subDir
# - local	restrict access to privileged ip addresses
# - file	fetches local content
# - check	prunes the web mount of www.sun.com to a fixed set of subDirs
# - sun		Web mount of www.sun.com on /sun
# - research	Web mount of research.sun.com on /sunr
# - missing	returns a default missing page

content.class=sunlabs.brazil.server.ChainHandler

content.handlers=load badguy map local file check sun research missing

# The SetTemplate keeps persistent name/value pairs for each session.
# By configuring it here as a handler, the session information is made
# available *before* the SetTemplate init() method is called in the
# filter/re-writing section.  The "querySet" parameter specifies a set
# of query parameters that may be used to set session state directly.
# Currently, its only used to set the printing template.

load.class=sunlabs.brazil.template.SetTemplate
load.sessionTable=data
load.querySet=template.fileName

# Block any downloads from one of the EAR forbidden domains

badguy.class=sunlabs.brazil.handler.RestrictClientHandler
badguy.prefix=/data/
badguy.deny=\\.(ir|iq|af|cu|ly|kp|sy|sd)$
badguy.redirect=/badguy.html

# Rewrite the urls requesting downloads to automatically add
# the name of the currently approved download directory (${download}).
# This insures that only "approved" code may be downloaded

map.class=sunlabs.brazil.handler.UrlMapperHandler
map.match=/data/(.*/)?(.+)
map.replace=/data/${download}/\\2

# Only allow clients on the local host to access these url's

local.class=sunlabs.brazil.handler.RestrictClientHandler
local.prefix=/local/
local.allow=^(127.0.0.1)$

# This fetches the content locally
# We need to make sure all (non-built-in) mime types are
# defined.  If a file suffix isn't in this list (or a built-in) then
# the server will not deliver it.

file.class=sunlabs.brazil.server.FileHandler
file.allow=true

mime.tgz=application/octetstream
mime.gz=application/octetstream
mime.bz2=application/octetstream
mime.jar=application/octetstream
mime.iso=application/octetstream
mime.zip=application/zip
mime.pdf=application/pdf
mime.css=text/css

# This controls the access to the www.sun.com site through the /sun directory.
# If a URL does not match one of the directories on this list, the user is
# redirected to a local page which will refer them directly to www.sun.com.

check.class=sunlabs.brazil.handler.AclSwitchHandler
check.prefix=/sun/
check.authName=check.ok
check.ok=research/ share/ policies/ pics/ 2001-0919/special/ /software/sunone/
check.redirect=/sun/index.html

# This is the "web mount" directive that mounts the www.sun.com site onto
# the /sun directory in our document root.

sun.class=sunlabs.brazil.handler.MultiProxyHandler
sun.host=www.sun.com
sun.prefix=/sun/

# This is the "web mount" directive that mounts the research.sun.com site onto
# the /sunr directory in our document root.

research.class=sunlabs.brazil.handler.MultiProxyHandler
research.host=research.sun.com
research.prefix=/sunr/

# No content was found matching this URL.  Return the
# Standard error page instead

missing.class=sunlabs.brazil.handler.NotFoundHandler
missing.fileName=missing.html

###################################################################
# At this point, the content has been retrieved.  Now we pass it
# Through a sequence of filters:
# - plain
#   convert text/plain to text/html
# - process 
#   Process any server-side markup in the content
# - extract
#   Do a semantic content extraction into properties
# - template
#   Select the appropriate L&F template
# - integrate
#   Integrate the extracted content into the template; do another
#   server-side markup pass to process markup in the template.
# - highlight
#   do content highlighting, if requested
# - remap
#   convert any local content containing URL's to any of our web-mounts
#   from the target site to our internal mount point
# - session
#   use cookies/url rewriting for session management for all non-robot
#   browsers

# This filter examines all locally retrieved content with URL's that point
# to www.sun.com, and rewrites them to point back here.

remap.class=sunlabs.brazil.filter.UrlMapFilter

# Set a persistent browser cookie to use as a session token.  If cookies
# are disabled, switch to URL rewriting.

session.class=sunlabs.brazil.filter.SessionFilter
session.cookie=ExperimentalStuff
session.persist=true

# Turn plain text into html, so it may be processed through the
# templates.

plain.class=sunlabs.brazil.filter.PlainFilter
plain.template= \
   <title>Text Document</title> \
   <body><div class=text> \
     <pre>%</pre> \
   </div></body>

# Process any server-side markup in the content.  Most likely this
# is from local content.

process.class=sunlabs.brazil.filter.TemplateFilter
process.templates=form set tcl debug bsl nav header subst

# This extracts the semantic information out of the content.
# The content is expected to be vanilla html. The extracted content
# is saved in the request properties, where it may be accessed by
# the SetTemplate and BSLTemplate.
# Mappings from sun need to have the headers/footers expunged

extract.class=sunlabs.brazil.filter.TemplateFilter
extract.templates=extract.tmpl
extract.tmpl.class=sunlabs.brazil.sunlabs.ExpContentTemplate
extract.tmpl.extract=.*<!-- MAIN CONTENT -->(.*)<!-- END OF MAIN CONTENT -->.*
extract.tmpl.replace=\\1
extract.tmpl.urlPrefix=/sun

# Once the content is extracted, we fetch the appropriate look and feel
# template.  This filename may be overridden on a per-request basis.

template.class=sunlabs.brazil.filter.ReplaceFilter
template.fileName=admin/main.template

# Now we integrate the content with the template

integrate.class=sunlabs.brazil.filter.TemplateFilter
integrate.templates=set bsl modified header subst

# Do a separate highlighting pass.  This is skipped entirely if there
# is nothing to highlight.

highlight.class=sunlabs.brazil.filter.TemplateFilter
highlight.mustHighlight=true
highlight.exit=true
highlight.templates=sunlabs.brazil.template.HighlightTemplate


# Template configurations
# Each template class replaces one or more XML/HTML tags in the content
# with HTML.

# Fill in the initial values of form elements
# This looks at all form elements, and causes the initial values to
# match the current property values.

form.class=	sunlabs.brazil.template.FormTemplate

# Allow HTTP headers to be manipulated from within the page
# This looks at <addheader> tags.

header.class=	sunlabs.brazil.template.AddHeaderTemplate

# "Set" and "get" properties.  Specify the properties table
# so the properties may be accessed from the Set handler
# This processes <set> and <get> tags.

set.class=	sunlabs.brazil.template.SetTemplate
set.headers=		header.
set.query=		query.
set.sessionTable=	data

# Allow scripting with tcl.
# This processes the text between <tcl>...</tcl> as a TCL script.

tcl.class=	sunlabs.brazil.tcl.TclServerTemplate
tcl.script=	init.tcl

# compute a best-guess modify time for the resultant content
# by comparing the modify times of the template, the original content, and
# the property values used to customize the template.

modified.class=	sunlabs.brazil.template.ModifiedTemplate

# enable "printf" like debugging

debug.class=	sunlabs.brazil.template.DebugTemplate

# turns on the Brazil Scripting language
# Handles <if> <elseif> <else> </if>, <foreach> ... </foreach> and <extract>.

bsl.class=	sunlabs.brazil.template.BSLTemplate

# computes URL based nav-bar entries.

nav.class=	sunlabs.brazil.template.UrlNavBarTemplate 
nav.includeDir=	on
# The main template will skip all sub-dirs after this regexp
# this is for cgi's and sub-systems that don't map url's to directories
nav.skip=mailman

# Replaces all ${...} constructs in tag attribute values.

subst.class=sunlabs.brazil.sunlabs.SubstAllTemplate
This page is: http://www.experimentalstuff.com/About_this_site/config.txt
Last Modified: Fri, 17 Oct 2003 22:06:57 GMT
copyright (c) 2000-2007, Sun Microsystems