org.jwall.web.audit.net
Class AuditEventURLConnectionSender

java.lang.Object
  extended by org.jwall.web.audit.net.AuditEventURLConnectionSender
All Implemented Interfaces:
EventListener<AuditEvent>, AuditEventListener

public class AuditEventURLConnectionSender
extends Object
implements AuditEventListener

This class implements a simple socket-handler which provides easy injection of audit-events to the modsecurity-console.

Author:
Christian Bockermann <chris@jwall.org>

Nested Class Summary
 class AuditEventURLConnectionSender.ZeroTrustManager
           
 
Field Summary
static String CONSOLE_CONNECTION_KEEP_ALIVE
           
static String CONSOLE_HOST
           
static String CONSOLE_PASS
           
static String CONSOLE_PORT
           
static String CONSOLE_URI
          the uri of the receiver servlet
static String CONSOLE_USER
           
 
Constructor Summary
AuditEventURLConnectionSender(String host, int port, String login, String password)
          This method creates a new console sender that sends all arriving events to the given host host using login and password for authentifaction.
 
Method Summary
 void eventArrived(AuditEvent evt)
          Simply send all arriving events to the configured console.
 void eventsArrived(Collection<AuditEvent> events)
          This method is called for notifying the listener of arrival of several events in a block.
 HttpURLConnection getConnection()
           
 void sendAuditEvent(AuditEvent evt)
          This method sends the given audit-event to the configured console.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSOLE_HOST

public static final String CONSOLE_HOST
See Also:
Constant Field Values

CONSOLE_PORT

public static final String CONSOLE_PORT
See Also:
Constant Field Values

CONSOLE_USER

public static final String CONSOLE_USER
See Also:
Constant Field Values

CONSOLE_PASS

public static final String CONSOLE_PASS
See Also:
Constant Field Values

CONSOLE_CONNECTION_KEEP_ALIVE

public static final String CONSOLE_CONNECTION_KEEP_ALIVE
See Also:
Constant Field Values

CONSOLE_URI

public static final String CONSOLE_URI
the uri of the receiver servlet

See Also:
Constant Field Values
Constructor Detail

AuditEventURLConnectionSender

public AuditEventURLConnectionSender(String host,
                                     int port,
                                     String login,
                                     String password)
This method creates a new console sender that sends all arriving events to the given host host using login and password for authentifaction.

Parameters:
host - The host on which the Console is running.
port - The port, at which the Console is listening.
login - User-name for authentication with the console.
password - Password for authentication.
Method Detail

sendAuditEvent

public void sendAuditEvent(AuditEvent evt)
                    throws Exception
This method sends the given audit-event to the configured console.

Parameters:
evt - The event to be sent to the console.
Throws:
Exception - In case an error occurs.

getConnection

public HttpURLConnection getConnection()
                                throws Exception
Throws:
Exception

eventArrived

public void eventArrived(AuditEvent evt)
Simply send all arriving events to the configured console.

Specified by:
eventArrived in interface EventListener<AuditEvent>
Specified by:
eventArrived in interface AuditEventListener
Parameters:
evt - The event which arrived.

eventsArrived

public void eventsArrived(Collection<AuditEvent> events)
Description copied from interface: AuditEventListener
This method is called for notifying the listener of arrival of several events in a block. Usually, this method is implemented by calling AuditEventListener.eventArrived(AuditEvent) for each of the given events, but may be handled in a more efficient way by implementations capable of processing blocks of events.

Specified by:
eventsArrived in interface AuditEventListener
Parameters:
events - The block of events arrived.


Copyright © 2012 jwall.org. All Rights Reserved.