org.apache.turbine.services.logging
Class BaseRunDataFilter

java.lang.Object
  |
  +--org.apache.turbine.services.logging.BaseRunDataFilter
All Implemented Interfaces:
RunDataFilter

public class BaseRunDataFilter
extends java.lang.Object
implements RunDataFilter

This class extracts data from RunData object. It is configured by a string describing format of output.

Format description
Each token should be seperate by space. In output known token will be replaced by coresponding data from RunData, unkonwn will be returned unchanged on output.
Conversion token:

Version:
$Id: BaseRunDataFilter.java,v 1.1.1.1 2001/08/16 05:09:02 jvanzyl Exp $
Author:
Tomasz Zielinski, Michal Majdan, Jon S. Stevens

Field Summary
protected  java.lang.String DELIM
           
protected  java.lang.String format
          applied format
protected static java.util.Map methodNamesMap
          table matching conversion tokens to methods names
protected  java.util.List pattern
          parsed format
 
Constructor Summary
BaseRunDataFilter()
           
 
Method Summary
(package private) static void ()
          initialization of the conversion table
private static java.lang.String getAuthType(RunData data)
          Retrives the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the servlet was not protected.
private static java.lang.String getBannerInfo(RunData data)
          Retrives the banner info asociated with the user making the request.
private static java.lang.String getCharacterEncoding(RunData data)
          Retrives the name of the character encoding used in the body of this request.
private static java.lang.String getContentLength(RunData data)
          Retrives the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
private static java.lang.String getContentType(RunData data)
          Retrives the MIME type of the body of the request, or null if the type is not known.
private static java.lang.String getContextPath(RunData data)
          Retrives the portion of the request URI that indicates the context of the request.
private static java.lang.String getCookies(RunData data)
          Retrives cookies.
private static java.lang.String getHeader(RunData data, java.lang.String symbol)
          Retrives the value of the specified request header.
private static java.lang.String getMethod(RunData data)
          Retrives the cached method that is stored in the ServerData object
private static java.lang.String getProtocol(RunData data)
          Retrives the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion
private static java.lang.String getQueryString(RunData data)
          Retrives the query string that is contained in the request URL after the path.
private static java.lang.String getRemoteAddr(RunData data)
          Retrives remote host address.
private static java.lang.String getRemoteHost(RunData data)
          Retrives remote host name.
private static java.lang.String getRemoteUser(RunData data)
          Retrives the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
private static java.lang.String getScheme(RunData data)
          Retrives the name of the scheme used to make this request, for example, http, https, or ftp.
private static java.lang.String getServerName(RunData data)
          Retrives the cached serverName that is stored in the ServerData object
private static java.lang.String getServerPort(RunData data)
          Retrives the cached serverPort that is stored in the ServerData object
private static java.lang.String getSessionId(RunData data)
          Retrives a string containing the unique identifier assigned to this session
 java.lang.String getString(RunData data)
          For each field in tha pattern looking for method extracting data from RunData, invokes the method, and adds return value to return value.
private static java.lang.String getTime(RunData data)
          Retrives current system time.
private static java.lang.String getURLRequested(RunData data)
          Retrives the url requested by the client
private static java.lang.String getUser(RunData data)
          Retrives first and last name of the user making the request.
private static java.lang.String getUserAgent(RunData data)
          Retrives the user agent name.
 void setFormat(java.lang.String format)
          parses format string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

methodNamesMap

protected static java.util.Map methodNamesMap
table matching conversion tokens to methods names

format

protected java.lang.String format
applied format

pattern

protected java.util.List pattern
parsed format

DELIM

protected final java.lang.String DELIM
Constructor Detail

BaseRunDataFilter

public BaseRunDataFilter()
Method Detail

static void ()
initialization of the conversion table

setFormat

public void setFormat(java.lang.String format)
parses format string
Specified by:
setFormat in interface RunDataFilter
Following copied from interface: org.apache.turbine.services.logging.RunDataFilter
Parameters:
format - - description which data should be extracted

getString

public java.lang.String getString(RunData data)
For each field in tha pattern looking for method extracting data from RunData, invokes the method, and adds return value to return value. If there is no method for the token, adds token to return value
Specified by:
getString in interface RunDataFilter
Parameters:
data - - RunDate from which data will be extracted

getTime

private static java.lang.String getTime(RunData data)
Retrives current system time.
Parameters:
data - RunData object associated with this request
Returns:
date and time

getURLRequested

private static java.lang.String getURLRequested(RunData data)
Retrives the url requested by the client
Parameters:
data - RunData object associated with this request
Returns:
url requested by the client

getRemoteHost

private static java.lang.String getRemoteHost(RunData data)
Retrives remote host name.
Parameters:
data - RunData object associated with this request
Returns:
name of the host that sent the request

getRemoteAddr

private static java.lang.String getRemoteAddr(RunData data)
Retrives remote host address.
Parameters:
data - RunData object associated with this request
Returns:
address of the host that sent the request

getRemoteUser

private static java.lang.String getRemoteUser(RunData data)
Retrives the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
Parameters:
data - RunData object associated with this request
Returns:
remote user login name if he/she has been authenticated

getServerPort

private static java.lang.String getServerPort(RunData data)
Retrives the cached serverPort that is stored in the ServerData object
Parameters:
data - RunData object associated with this request
Returns:
port that this request was recived on

getServerName

private static java.lang.String getServerName(RunData data)
Retrives the cached serverName that is stored in the ServerData object
Parameters:
data - RunData object associated with this request
Returns:
name of the server that served the request

getMethod

private static java.lang.String getMethod(RunData data)
Retrives the cached method that is stored in the ServerData object
Parameters:
data - RunData object associated with this request
Returns:
method used by the request

getHeader

private static java.lang.String getHeader(RunData data,
                                          java.lang.String symbol)
Retrives the value of the specified request header.
Parameters:
data - RunData object associated with this request
symbol - pattern element containig header line name between {} brackets
Returns:
header line contents

getQueryString

private static java.lang.String getQueryString(RunData data)
Retrives the query string that is contained in the request URL after the path.
Parameters:
data - RunData object associated with this request
Returns:
query string

getContextPath

private static java.lang.String getContextPath(RunData data)
Retrives the portion of the request URI that indicates the context of the request.
Parameters:
data - RunData object associated with this request
Returns:
the portion of the request URI that indicates the context of the request.

getSessionId

private static java.lang.String getSessionId(RunData data)
Retrives a string containing the unique identifier assigned to this session
Parameters:
data - RunData object associated with this request
Returns:
Session Id

getAuthType

private static java.lang.String getAuthType(RunData data)
Retrives the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the servlet was not protected.
Parameters:
data - RunData object associated with this request
Returns:
authentication scheme used

getContentType

private static java.lang.String getContentType(RunData data)
Retrives the MIME type of the body of the request, or null if the type is not known.
Parameters:
data - RunData object associated with this request
Returns:
content type of the request

getCharacterEncoding

private static java.lang.String getCharacterEncoding(RunData data)
Retrives the name of the character encoding used in the body of this request.
Parameters:
data - RunData object associated with this request
Returns:
character encoding

getProtocol

private static java.lang.String getProtocol(RunData data)
Retrives the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion
Parameters:
data - RunData object associated with this request
Returns:
protocol

getScheme

private static java.lang.String getScheme(RunData data)
Retrives the name of the scheme used to make this request, for example, http, https, or ftp.
Parameters:
data - RunData object associated with this request
Returns:
scheme

getContentLength

private static java.lang.String getContentLength(RunData data)
Retrives the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
Parameters:
data - RunData object associated with this request
Returns:
content length or -1 if not yet known

getUserAgent

private static java.lang.String getUserAgent(RunData data)
Retrives the user agent name.
Parameters:
data - RunData object associated with this request
Returns:
user agent string

getBannerInfo

private static java.lang.String getBannerInfo(RunData data)
Retrives the banner info asociated with the user making the request.
Parameters:
data - RunData object associated with this request
Returns:
banner info or empty stirng

getUser

private static java.lang.String getUser(RunData data)
Retrives first and last name of the user making the request.
Parameters:
data - RunData object associated with this request
Returns:
user

getCookies

private static java.lang.String getCookies(RunData data)
Retrives cookies.
Parameters:
data - RunData object associated with this request
Returns:
cookies


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.