sunlabs.brazil.handler
Class ChainSawHandler

java.lang.Object
  extended by sunlabs.brazil.server.ChainHandler
      extended by sunlabs.brazil.handler.ChainSawHandler (view source)
All Implemented Interfaces:
Handler

public class ChainSawHandler
extends ChainHandler

Variant of the chain handler for doing standard logging. Don't use on fine furniture.

Output is a variant of the common logfile format. The common logfile format is as follows:

 remotehost rfc931 authuser [date] "request" status bytes
 
remotehost
Remote hostname (or IP number if DNS hostname is not available, or if DNSLookup is Off.
rfc931
The remote logname of the user.
authuser
The username as which the user has authenticated himself.
[date]
Date and time of the request.
"request"
The request line exactly as it came from the client.
status
The HTTP status code returned to the client.
bytes
The content-length of the document transferred.
"referrer" (optional)
the referring url
"user agent" (optional)
"The user agent making the request

Additional Configuration options:

logFile
The name of the file to write the logs to.
flush
The number of requests between flushes to the file
If the logFile is removed, the server creates a new one. Thus logs may be truncated by periodically moving them to another name (at least on unix).

See the LogHandler handler for generating logs whose contents are configurable.


Field Summary
static int BUFSIZE
           
static String FLUSH
           
static String LOG
           
 
Fields inherited from class sunlabs.brazil.server.ChainHandler
exitOnError, handlers, isMine, names, prefix, report
 
Constructor Summary
ChainSawHandler()
           
 
Method Summary
 boolean init(Server server, String prefix)
          Initializes this ChainHandler by initializing all the "wrapped" handlers in the list of handlers.
 boolean respond(Request request)
          Run the chain-handler, counting the # of bytes of output generated by its chained handlers.
 
Methods inherited from class sunlabs.brazil.server.ChainHandler
initHandler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final String LOG
See Also:
Constant Field Values

FLUSH

public static final String FLUSH
See Also:
Constant Field Values

BUFSIZE

public static final int BUFSIZE
See Also:
Constant Field Values
Constructor Detail

ChainSawHandler

public ChainSawHandler()
Method Detail

init

public boolean init(Server server,
                    String prefix)
Description copied from class: ChainHandler
Initializes this ChainHandler by initializing all the "wrapped" handlers in the list of handlers. If a wrapped handler cannot be initialized, this method logs a message and skips it. If no handlers were specified, or no handlers were successfully initialized, then the initialization of this ChainHandler is considered to have failed.

Specified by:
init in interface Handler
Overrides:
init in class ChainHandler
Parameters:
server - The HTTP server that created this ChainHandler.
prefix - The prefix for this ChainHandler's properties.
Returns:
true if at least one of the wrapped handlers was successfully initialized.

respond

public boolean respond(Request request)
                throws IOException
Run the chain-handler, counting the # of bytes of output generated by its chained handlers.

Specified by:
respond in interface Handler
Overrides:
respond in class ChainHandler
Parameters:
request - The HTTP request.
Returns:
true if one of the Handlers returns true, false otherwise.
Throws:
IOException - if one of the Handlers throws an IOException while responding.

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.