... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2004-06-01

Brazil Framework

I was playing with the Brazil Framework, a fairly lightweight HTTP stack.  It is useful for piecing together HTTP servers.  For example, one can serve up static content protected by HTTP basic authentication by chaining to built-in handlers together.  Brazil is configured using a Java properties file, eg:

port=8080
handler=chain

chain.class=sunlabs.brazil.server.ChainHandler
chain.handlers=auth content

auth.class=sunlabs.brazil.handler.BasicAuthHandler
auth.realm=Test Content Realm
auth.message=You are not authorized!
auth.mapFile=auth.mapfile

content.class=sunlabs.brazil.server.FileHandler
content.root=test-content
content.default=index.html
content.mime.html=text/html

Brazil would be invoked from the command line using this configuration thus:

java -jar brazil.jar -config myconfig.conf

For completeness, auth.mapfile contains a mapping of HTTP basic authentication strings (in Base64) to 'session identifiers' (which are more like user identifiers), eg:

bWU6bXlzZWxm=someuser

which encodes me/myself as a user/password pair, mapped to someuser.

Blog Archive