org.apache.catalina.valves
Class ValveBase

java.lang.Object
  extended byorg.apache.catalina.valves.ValveBase
All Implemented Interfaces:
Contained, javax.management.MBeanRegistration, Valve
Direct Known Subclasses:
AccessLogValve, AuthenticatorBase, ErrorReportValve, ExtendedAccessLogValve, FastCommonAccessLogValve, JDBCAccessLogValve, JvmRouteBinderValve, PersistentValve, ReplicationValve, RequestDumperValve, RequestFilterValve, SemaphoreValve, SingleSignOn

public abstract class ValveBase
extends java.lang.Object
implements Contained, Valve, javax.management.MBeanRegistration

Convenience base class for implementations of the Valve interface. A subclass MUST implement an invoke() method to provide the required functionality, and MAY implement the Lifecycle interface to provide configuration management and lifecycle support.

Version:
$Id: ValveBase.java 939526 2010-04-30 00:39:28Z kkolinko $
Author:
Craig R. McClanahan

Field Summary
protected  Container container
          The Container whose pipeline this Valve is a component of.
protected  org.apache.commons.logging.Log containerLog
          Container log
protected  javax.management.ObjectName controller
           
protected  java.lang.String domain
           
protected static java.lang.String info
          Descriptive information about this Valve implementation.
protected  javax.management.MBeanServer mserver
           
protected  Valve next
          The next Valve in the pipeline this Valve is a component of.
protected  javax.management.ObjectName oname
           
protected static StringManager sm
          The string manager for this package.
 
Constructor Summary
ValveBase()
           
 
Method Summary
 void backgroundProcess()
          Execute a periodic task, such as reloading, etc.
 javax.management.ObjectName createObjectName(java.lang.String domain, javax.management.ObjectName parent)
           
 Container getContainer()
          Return the Container with which this Valve is associated, if any.
 javax.management.ObjectName getContainerName()
           
 javax.management.ObjectName getController()
           
 java.lang.String getDomain()
           
 java.lang.String getInfo()
          Return descriptive information about this Valve implementation.
 Valve getNext()
          Return the next Valve in this pipeline, or null if this is the last Valve in the pipeline.
 javax.management.ObjectName getObjectName()
           
 javax.management.ObjectName getParentName(javax.management.ObjectName valveName)
          From the name, extract the parent object name
abstract  void invoke(Request request, Response response)
          The implementation-specific logic represented by this Valve.
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 void setContainer(Container container)
          Set the Container with which this Valve is associated, if any.
 void setController(javax.management.ObjectName controller)
           
 void setNext(Valve valve)
          Set the Valve that follows this one in the pipeline it is part of.
 void setObjectName(javax.management.ObjectName oname)
           
 java.lang.String toString()
          Return a String rendering of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

container

protected Container container
The Container whose pipeline this Valve is a component of.


containerLog

protected org.apache.commons.logging.Log containerLog
Container log


info

protected static java.lang.String info
Descriptive information about this Valve implementation. This value should be overridden by subclasses.


next

protected Valve next
The next Valve in the pipeline this Valve is a component of.


sm

protected static final StringManager sm
The string manager for this package.


domain

protected java.lang.String domain

oname

protected javax.management.ObjectName oname

mserver

protected javax.management.MBeanServer mserver

controller

protected javax.management.ObjectName controller
Constructor Detail

ValveBase

public ValveBase()
Method Detail

getContainer

public Container getContainer()
Return the Container with which this Valve is associated, if any.

Specified by:
getContainer in interface Contained

setContainer

public void setContainer(Container container)
Set the Container with which this Valve is associated, if any.

Specified by:
setContainer in interface Contained
Parameters:
container - The new associated container

getInfo

public java.lang.String getInfo()
Return descriptive information about this Valve implementation.

Specified by:
getInfo in interface Valve

getNext

public Valve getNext()
Return the next Valve in this pipeline, or null if this is the last Valve in the pipeline.

Specified by:
getNext in interface Valve

setNext

public void setNext(Valve valve)
Set the Valve that follows this one in the pipeline it is part of.

Specified by:
setNext in interface Valve
Parameters:
valve - The new next valve

backgroundProcess

public void backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.

Specified by:
backgroundProcess in interface Valve

invoke

public abstract void invoke(Request request,
                            Response response)
                     throws java.io.IOException,
                            javax.servlet.ServletException
The implementation-specific logic represented by this Valve. See the Valve description for the normal design patterns for this method.

This method MUST be provided by a subclass.

Specified by:
invoke in interface Valve
Parameters:
request - The servlet request to be processed
response - The servlet response to be created
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet error occurs

toString

public java.lang.String toString()
Return a String rendering of this object.


getObjectName

public javax.management.ObjectName getObjectName()

setObjectName

public void setObjectName(javax.management.ObjectName oname)

getDomain

public java.lang.String getDomain()

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

getController

public javax.management.ObjectName getController()

setController

public void setController(javax.management.ObjectName controller)

getParentName

public javax.management.ObjectName getParentName(javax.management.ObjectName valveName)
From the name, extract the parent object name

Parameters:
valveName - The valve name
Returns:
ObjectName The parent name

createObjectName

public javax.management.ObjectName createObjectName(java.lang.String domain,
                                                    javax.management.ObjectName parent)
                                             throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException

getContainerName

public javax.management.ObjectName getContainerName()


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