org.jwall.web.audit
Interface AuditEvent

All Superinterfaces:
java.lang.Comparable<AuditEvent>, java.io.Serializable
All Known Implementing Classes:
AuditEventImpl

public interface AuditEvent
extends java.io.Serializable, java.lang.Comparable<AuditEvent>

This interface defines an abstract audit-event. Specifying events as interface aims at several optimized implementations. A simple one can be found at AuditEventImpl.

Author:
Christian Bockermann <chris@jwall.org>

Method Summary
 int compareTo(AuditEvent o)
           
 java.lang.String get(java.lang.String var)
          Returns the given variable as String or an empty string if the variable is not set.
 java.lang.String getAuditHeader()
          Returns the header-section of this event.
 java.lang.String getAuditLogTrailer()
          Returns the header-section of this event.
 java.lang.Long getCount()
          This method returns the number of instances created from the underlying implementation of this interface.
 java.util.Date getDate()
          Returns the date of this events birth.
 java.lang.String getEventId()
          The unique ID, created by modsecurity.
 java.io.File getFile()
          This method returns the file from which the event has been read.
 java.util.Set<java.lang.String> getGetParameterNames()
          Returns the set of parameters (their names) that are available in the request-uri of this request.
 java.lang.String getGetParameterValue(java.lang.String name)
          Returns the value of the parameter name in the url of this request.
 long getOffset()
          This method returns the offset (bytes) from the beginning of the file from which this event has been read.
 java.util.Set<java.lang.String> getPostParameterNames()
          Returns the set of parameters (their names) that are available in the post-body of this request.
 java.lang.String getPostParameterValue(java.lang.String name)
          Returns the value of the parameter name in the post-body of this request or null there is no parameter with this name.
 java.lang.String[] getRawData()
          This method returns an array of strings that contain the section-data of the appopriate audit-log entry of this event.
 long getRelativeSessionTime()
          Gets the number of milliseconds from the time the first event of this session has been detected.
 java.lang.String getRequestBody()
          Return the body of this request.
 java.lang.String getRequestCookie(java.lang.String name)
           
 java.util.Set<java.lang.String> getRequestCookieNames()
           
 java.lang.String getRequestHeader()
          Returns the header-section of this event.
 java.lang.String getRequestHeader(java.lang.String name)
          Returns the value of the specified header-field of the request.
 java.util.Set<java.lang.String> getRequestHeaderNames()
          Returns the set of all header-fields sent in the request.
 java.net.URL getRequestURL()
          Return an URL object that matches the URL requested within this event.
 java.lang.String getResponseCookie(java.lang.String name)
           
 java.util.Set<java.lang.String> getResponseCookieNames()
           
 java.lang.String getResponseHeader()
          Returns the header-section of this event.
 java.lang.String getResponseHeader(java.lang.String name)
          Returns the value of the specified header-field of the response.
 java.util.Set<java.lang.String> getResponseHeaderNames()
          Returns the set of all header-fields sent in the response.
 java.lang.String getSection(int i)
          Returns the string, which contains the whole section of this audit-event.
 java.lang.String getSessionId()
          The session-id of this request or an empty string, if no session-id has been set.
 long getSize()
           
 boolean isSet(java.lang.String var)
          Checks wether the given variable is set or not.
 void setRelativeSessionTime(long s)
          Sets the number of milliseconds from the time the first event of this session has been detected.
 void setSessionId(java.lang.String id)
          This method sets the session-id of this event.
 

Method Detail

getCount

java.lang.Long getCount()
This method returns the number of instances created from the underlying implementation of this interface. This is used for debugging memory-leaks based on event-objects that get created somewhere and are never released.

Returns:
The number of instances of the implementing AuditEvent class.

getEventId

java.lang.String getEventId()
The unique ID, created by modsecurity.

Returns:
A unique event id.

getSection

java.lang.String getSection(int i)
Returns the string, which contains the whole section of this audit-event. The available sections are defined in ModSecurity.java.

Parameters:
i - Index of the section as defined by ModSecurity.SECTION_*.
Returns:
The string value of the appopriate section of this event.

getAuditHeader

java.lang.String getAuditHeader()
Returns the header-section of this event. This is equivalent to calling getSection(ModSecurity.AUDIT_HEADER).

Returns:
The audit-header string.

getRequestHeader

java.lang.String getRequestHeader()
Returns the header-section of this event. This is equivalent to calling getSection(ModSecurity.REQUEST_HEADER).

Returns:
The request-header string.

getRequestBody

java.lang.String getRequestBody()
Return the body of this request. If no body is available an empty string is returned.

Returns:
The request-body string.

getResponseHeader

java.lang.String getResponseHeader()
Returns the header-section of this event. This is equivalent to calling getSection(ModSecurity.FINAL_RESPONSE_HEADER).

Returns:
The final reponse-header string.

getAuditLogTrailer

java.lang.String getAuditLogTrailer()
Returns the header-section of this event. This is equivalent to calling getSection(ModSecurity.AUDIT_TRAILER).

Returns:
The audit-trailer string.

getRequestHeader

java.lang.String getRequestHeader(java.lang.String name)
Returns the value of the specified header-field of the request. Use HEADLINE to retrieve the first line of the request.

Parameters:
name - The header-field to be returned (see org.modsecurity.HttpProtocol)
Returns:
The value of this header-field, or null if not set.

getRequestHeaderNames

java.util.Set<java.lang.String> getRequestHeaderNames()
Returns the set of all header-fields sent in the request.

Returns:
The set of strings of all header-fields.

getResponseHeader

java.lang.String getResponseHeader(java.lang.String name)
Returns the value of the specified header-field of the response.

Parameters:
name - The header-field name.
Returns:
The string-value of this header field or null if not set.

getResponseHeaderNames

java.util.Set<java.lang.String> getResponseHeaderNames()
Returns the set of all header-fields sent in the response. Use HEADLINE to retrieve the first line of the response.

Returns:
The set of all header-field names.

getDate

java.util.Date getDate()
Returns the date of this events birth. The value of this date is parsed from the audit-event entry.

Returns:
The date when this event was created.

getSessionId

java.lang.String getSessionId()
The session-id of this request or an empty string, if no session-id has been set.

Returns:
The session id.

setSessionId

void setSessionId(java.lang.String id)
This method sets the session-id of this event. Its primary use is to group several events by external session-trackers.

Parameters:
id - The id of the session with which this event is associated.

isSet

boolean isSet(java.lang.String var)
Checks wether the given variable is set or not.

Parameters:
var - The name of the variable that is checked.
Returns:
true iff the variable is set.

get

java.lang.String get(java.lang.String var)
Returns the given variable as String or an empty string if the variable is not set. To test if a variable has been set use isSet(String variable).

Parameters:
var - The name of the variable.
Returns:
The value of this variable.

getGetParameterNames

java.util.Set<java.lang.String> getGetParameterNames()
Returns the set of parameters (their names) that are available in the request-uri of this request.

Returns:
Set of parameter-names.

getGetParameterValue

java.lang.String getGetParameterValue(java.lang.String name)
Returns the value of the parameter name in the url of this request.

Parameters:
name - The parameter name.
Returns:
The value of parameter name.

getPostParameterNames

java.util.Set<java.lang.String> getPostParameterNames()
Returns the set of parameters (their names) that are available in the post-body of this request.

Returns:
Set of parameter-names, parsed from the request-body.

getPostParameterValue

java.lang.String getPostParameterValue(java.lang.String name)
Returns the value of the parameter name in the post-body of this request or null there is no parameter with this name.

Parameters:
name - The name of the parameter.
Returns:
The raw value of this parameter as read in the request-body.

compareTo

int compareTo(AuditEvent o)
Specified by:
compareTo in interface java.lang.Comparable<AuditEvent>

getRequestCookieNames

java.util.Set<java.lang.String> getRequestCookieNames()

getRequestCookie

java.lang.String getRequestCookie(java.lang.String name)

getResponseCookieNames

java.util.Set<java.lang.String> getResponseCookieNames()

getResponseCookie

java.lang.String getResponseCookie(java.lang.String name)

setRelativeSessionTime

void setRelativeSessionTime(long s)
Sets the number of milliseconds from the time the first event of this session has been detected.

Parameters:
s - Time in milliseconds.

getRelativeSessionTime

long getRelativeSessionTime()
Gets the number of milliseconds from the time the first event of this session has been detected.

Returns:
The number of milliseconds since session-start.

getRawData

java.lang.String[] getRawData()
This method returns an array of strings that contain the section-data of the appopriate audit-log entry of this event.

Returns:
The list of section-strings.

getRequestURL

java.net.URL getRequestURL()
Return an URL object that matches the URL requested within this event.

Returns:
The url of the request.

getFile

java.io.File getFile()
This method returns the file from which the event has been read. This is set by one of the reader-classes. In case the event has not been read from a file null is returned.

Returns:
The file from which this event has been read.

getOffset

long getOffset()
This method returns the offset (bytes) from the beginning of the file from which this event has been read.

Returns:
The offset within the source-file.

getSize

long getSize()