Package sunlabs.brazil.handler
Class ChainSawHandler
- java.lang.Object
-
- sunlabs.brazil.server.ChainHandler
-
- sunlabs.brazil.handler.ChainSawHandler
-
- 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
See the
LogHandlerhandler for generating logs whose contents are configurable.- Version:
- 2.1, 02/10/01
- Author:
- Stephen Uhler
-
-
Field Summary
Fields Modifier and Type Field Description static intBUFSIZEstatic java.lang.StringFLUSHstatic java.lang.StringLOG-
Fields inherited from class sunlabs.brazil.server.ChainHandler
exitOnError, handlers, isMine, names, prefix, report
-
-
Constructor Summary
Constructors Constructor Description ChainSawHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleaninit(Server server, java.lang.String prefix)Initializes thisChainHandlerby initializing all the "wrapped" handlers in the list of handlers.booleanrespond(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
-
-
-
-
Field Detail
-
LOG
public static final java.lang.String LOG
- See Also:
- Constant Field Values
-
FLUSH
public static final java.lang.String FLUSH
- See Also:
- Constant Field Values
-
BUFSIZE
public static final int BUFSIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public boolean init(Server server, java.lang.String prefix)
Description copied from class:ChainHandlerInitializes thisChainHandlerby 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 thisChainHandleris considered to have failed.- Specified by:
initin interfaceHandler- Overrides:
initin classChainHandler- Parameters:
server- The HTTP server that created thisChainHandler.prefix- The prefix for thisChainHandler's properties.- Returns:
trueif at least one of the wrapped handlers was successfully initialized.
-
respond
public boolean respond(Request request) throws java.io.IOException
Run the chain-handler, counting the # of bytes of output generated by its chained handlers.- Specified by:
respondin interfaceHandler- Overrides:
respondin classChainHandler- Parameters:
request- The HTTP request.- Returns:
trueif one of theHandlers returnstrue,falseotherwise.- Throws:
java.io.IOException- if one of theHandlers throws anIOExceptionwhile responding.
-
-