SK.gnome.dwarf.http.log
Class HTTPLogFormat

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.http.log.HTTPLogFormat
All Implemented Interfaces:
SK.gnome.dwarf.Service
Direct Known Subclasses:
CommonLogFormat, DwarfLogFormat, ExtendedLogFormat

public abstract class HTTPLogFormat
extends SK.gnome.dwarf.GenericService

This class provides a generic format of the HTTP transfer logs.

Subclasses must override the abstract format(long, Request, Response) method to implement a real log format.

A HTTPLogFormat instance can be added either to the Host or the Application object to setup the desired format of the HTTP log messages.


Field Summary
protected  boolean host
          Whether or not to log the "Host" request header.
protected  boolean protocol
          Whether or not to log the request protocol.
protected  boolean referer
          Whether or not to log the "Referer" request header.
protected  boolean userAgent
          Whether or not to log the "User-Agent" request header.
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
HTTPLogFormat(java.lang.String name)
          Creates a new HTTPLogFormat.
 
Method Summary
abstract  java.lang.String format(long time, Request request, Response response)
          Formats the HTTP transfer log message.
 void setHost(boolean enable)
          Enables or dissable logging of the "Host" request header.
 void setProtocol(boolean enable)
          Enables or dissable logging of the request protocol.
 void setReferer(boolean enable)
          Enables or dissable logging of the "Referer" request header.
 void setUserAgent(boolean enable)
          Enables or dissable logging of the "User-Agent" request header.
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, init, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

host

protected boolean host
Whether or not to log the "Host" request header.

Default value: true

See Also:
setHost(boolean)

protocol

protected boolean protocol
Whether or not to log the request protocol.

Default value: true

See Also:
setProtocol(boolean)

referer

protected boolean referer
Whether or not to log the "Referer" request header.

Default value: false

See Also:
setReferer(boolean)

userAgent

protected boolean userAgent
Whether or not to log the "User-Agent" request header.

Default value: false

See Also:
setUserAgent(boolean)
Constructor Detail

HTTPLogFormat

public HTTPLogFormat(java.lang.String name)
Creates a new HTTPLogFormat.

Method Detail

setHost

public void setHost(boolean enable)
Enables or dissable logging of the "Host" request header.

Parameters:
enable - true to enable logging
See Also:
host

setProtocol

public void setProtocol(boolean enable)
Enables or dissable logging of the request protocol.

Parameters:
enable - true to enable logging
See Also:
protocol

setReferer

public void setReferer(boolean enable)
Enables or dissable logging of the "Referer" request header.

Parameters:
enable - true to enable logging
See Also:
referer

setUserAgent

public void setUserAgent(boolean enable)
Enables or dissable logging of the "User-Agent" request header.

Parameters:
enable - true to enable logging
See Also:
userAgent

format

public abstract java.lang.String format(long time,
                                        Request request,
                                        Response response)
Formats the HTTP transfer log message.

This method must be overriden in order to implement a custom log format. It should read the HTTP-related information from the given request and response objects and create the log message according to them.

The log message returned by this method should include also the date and time information according to the given time argument.

Parameters:
time - the current time
request - the finished request
response - the finished response
Returns:
the log message


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.