public abstract class ValveBase extends LifecycleMBeanBase implements Contained, Valve
invoke()
method to provide the required functionality, and MAY
implement the Lifecycle
interface to provide configuration
management and lifecycle support.Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected boolean |
asyncSupported
Does this valve support Servlet 3+ async requests?
|
protected Container |
container
The Container whose pipeline this Valve is a component of.
|
protected Log |
containerLog
Container log
|
protected static String |
info
Descriptive information about this Valve implementation.
|
protected Valve |
next
The next Valve in the pipeline this Valve is a component of.
|
protected static StringManager |
sm
The string manager for this package.
|
mserver
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
ValveBase() |
ValveBase(boolean asyncSupported) |
Modifier and Type | Method and Description |
---|---|
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc.
|
void |
event(Request request,
Response response,
CometEvent event)
Process a Comet event.
|
Container |
getContainer()
Return the Container with which this Valve is associated, if any.
|
String |
getDomainInternal()
Method implemented by sub-classes to identify the domain in which MBeans
should be registered.
|
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. |
String |
getObjectNameKeyProperties()
Allow sub-classes to specify the key properties component of the
ObjectName that will be used to register this component. |
protected void |
initInternal()
Sub-classes wishing to perform additional initialization should override
this method, ensuring that super.initInternal() is the first call in the
overriding method.
|
abstract void |
invoke(Request request,
Response response)
The implementation-specific logic represented by this Valve.
|
boolean |
isAsyncSupported() |
void |
setAsyncSupported(boolean asyncSupported) |
void |
setContainer(Container container)
Set the Container with which this Valve is associated, if any.
|
void |
setNext(Valve valve)
Set the Valve that follows this one in the pipeline it is part of.
|
protected void |
startInternal()
Start this component and implement the requirements
of
LifecycleBase.startInternal() . |
protected void |
stopInternal()
Stop this component and implement the requirements
of
LifecycleBase.stopInternal() . |
String |
toString()
Return a String rendering of this object.
|
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
protected boolean asyncSupported
protected Container container
protected Log containerLog
protected static final String info
protected Valve next
protected static final StringManager sm
public Container getContainer()
getContainer
in interface Contained
null
if not associated with a Containerpublic boolean isAsyncSupported()
isAsyncSupported
in interface Valve
public void setAsyncSupported(boolean asyncSupported)
public void setContainer(Container container)
setContainer
in interface Contained
container
- The new associated containerpublic String getInfo()
public Valve getNext()
null
if this
is the last Valve in the pipeline.public void setNext(Valve valve)
public void backgroundProcess()
backgroundProcess
in interface Valve
public abstract void invoke(Request request, Response response) throws IOException, ServletException
This method MUST be provided by a subclass.
invoke
in interface Valve
request
- The servlet request to be processedresponse
- The servlet response to be createdIOException
- if an input/output error occursServletException
- if a servlet error occurspublic void event(Request request, Response response, CometEvent event) throws IOException, ServletException
event
in interface Valve
request
- The servlet request to be processedresponse
- The servlet response to be createdevent
- The Comet event to be processedIOException
- if an input/output error occurs, or is thrown
by a subsequently invoked Valve, Filter, or ServletServletException
- if a servlet error occurs, or is thrown
by a subsequently invoked Valve, Filter, or Servletprotected void initInternal() throws LifecycleException
LifecycleMBeanBase
initInternal
in class LifecycleMBeanBase
LifecycleException
- If the initialisation failsprotected void startInternal() throws LifecycleException
LifecycleBase.startInternal()
.startInternal
in class LifecycleBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedprotected void stopInternal() throws LifecycleException
LifecycleBase.stopInternal()
.stopInternal
in class LifecycleBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic String toString()
public String getObjectNameKeyProperties()
LifecycleMBeanBase
ObjectName
that will be used to register this component.getObjectNameKeyProperties
in class LifecycleMBeanBase
ObjectName
public String getDomainInternal()
LifecycleMBeanBase
getDomainInternal
in class LifecycleMBeanBase
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.