public abstract class AbstractProcessor extends AbstractProcessorLight implements ActionHook
Modifier and Type | Field and Description |
---|---|
protected Adapter |
adapter |
protected AsyncStateMachine |
asyncStateMachine |
protected AbstractEndpoint<?> |
endpoint |
protected char[] |
hostNameC |
protected Request |
request |
protected Response |
response |
protected SocketWrapperBase<?> |
socketWrapper |
protected SSLSupport |
sslSupport |
protected UserDataHelper |
userDataHelper |
Modifier | Constructor and Description |
---|---|
|
AbstractProcessor(AbstractEndpoint<?> endpoint) |
protected |
AbstractProcessor(AbstractEndpoint<?> endpoint,
Request coyoteRequest,
Response coyoteResponse) |
Modifier and Type | Method and Description |
---|---|
protected void |
ack()
Deprecated.
Unused. This will be removed in Tomcat 10 onwards. Use
ack(ContinueResponseTiming) . |
protected abstract void |
ack(ContinueResponseTiming continueResponseTiming) |
void |
action(ActionCode actionCode,
Object param)
Send an action to the connector.
|
AbstractEndpoint.Handler.SocketState |
asyncPostProcess() |
protected abstract int |
available(boolean doRead) |
boolean |
checkAsyncTimeoutGeneration()
Check to see if the async generation (each cycle of async increments the
generation of the AsyncStateMachine) is the same as the generation when
the most recent async timeout was triggered.
|
protected abstract void |
disableSwallowRequest() |
AbstractEndpoint.Handler.SocketState |
dispatch(SocketEvent status)
Process an in-progress request that is not longer in standard HTTP mode.
|
protected abstract AbstractEndpoint.Handler.SocketState |
dispatchEndRequest()
Perform any necessary clean-up processing if the dispatch resulted in the
completion of processing for the current request.
|
protected void |
dispatchNonBlockingRead()
Perform any necessary processing for a non-blocking read before
dispatching to the adapter.
|
protected void |
doHttpUpgrade(UpgradeToken upgradeToken)
Process an HTTP upgrade.
|
protected void |
doPush(Request pushTarget)
Process a push.
|
protected void |
executeDispatches() |
protected abstract void |
finishResponse() |
protected abstract void |
flush() |
protected abstract boolean |
flushBufferedWrite()
Flush any pending writes.
|
Adapter |
getAdapter()
Get the associated adapter.
|
long |
getAsyncTimeout() |
protected Object |
getConnectionID()
Protocols that support multiplexing (e.g.
|
protected ErrorState |
getErrorState() |
protected Executor |
getExecutor() |
ByteBuffer |
getLeftoverInput()
Allows retrieving additional input during the upgrade process.
|
protected boolean |
getPopulateRequestAttributesFromSocket()
Processors that populate request attributes directly (e.g.
|
Request |
getRequest() |
protected SocketWrapperBase<?> |
getSocketWrapper() |
protected Object |
getStreamID()
Protocols that support multiplexing (e.g.
|
UpgradeToken |
getUpgradeToken()
Generate an upgrade token.
|
boolean |
isAsync() |
protected boolean |
isPushSupported()
Protocols that support push should override this method and return
true . |
protected boolean |
isReadyForRead() |
protected abstract boolean |
isReadyForWrite() |
protected abstract boolean |
isRequestBodyFullyRead() |
boolean |
isUpgrade()
Processors that implement HTTP upgrade must override this method.
|
protected void |
logAccess(SocketWrapperBase<?> socketWrapper)
Add an entry to the access log for a failed connection attempt.
|
protected void |
parseHost(MessageBytes valueMB) |
protected void |
populateHost()
Called when a host header is not present in the request (e.g.
|
protected void |
populatePort()
Called when a host header is not present or is empty in the request (e.g.
|
protected void |
populateRequestAttributeRemoteHost()
Populate the remote host request attribute.
|
protected void |
populateSslRequestAttributes()
Populate the TLS related request attributes from the
SSLSupport
instance associated with this processor. |
protected abstract void |
prepareResponse() |
protected void |
processSocketEvent(SocketEvent event,
boolean dispatch) |
void |
recycle()
Recycle the processor, ready for the next request which may be on the
same connection or a different connection.
|
protected abstract void |
registerReadInterest() |
void |
setAdapter(Adapter adapter)
Set the associated adapter.
|
void |
setAsyncTimeout(long timeout) |
protected void |
setErrorState(ErrorState errorState,
Throwable t)
Update the current error state to the new error state if the new error
state is more severe than the current error state.
|
protected abstract void |
setRequestBody(ByteChunk body) |
protected void |
setSocketWrapper(SocketWrapperBase<?> socketWrapper)
Set the socket wrapper being used.
|
void |
setSslSupport(SSLSupport sslSupport)
Set the SSL information for this HTTP connection.
|
protected abstract void |
setSwallowResponse() |
protected void |
sslReHandShake()
Processors that can perform a TLS re-handshake (e.g.
|
void |
timeoutAsync(long now)
Check this processor to see if the timeout has expired and process a
timeout if that is that case.
|
addDispatch, clearDispatches, getIteratorAndClearDispatches, getLog, process, service
protected char[] hostNameC
protected Adapter adapter
protected final AsyncStateMachine asyncStateMachine
protected final AbstractEndpoint<?> endpoint
protected final Request request
protected final Response response
protected volatile SocketWrapperBase<?> socketWrapper
protected volatile SSLSupport sslSupport
protected final UserDataHelper userDataHelper
public AbstractProcessor(AbstractEndpoint<?> endpoint)
protected AbstractProcessor(AbstractEndpoint<?> endpoint, Request coyoteRequest, Response coyoteResponse)
protected void setErrorState(ErrorState errorState, Throwable t)
errorState
- The error status detailst
- The error which occurredprotected ErrorState getErrorState()
public Request getRequest()
getRequest
in interface Processor
public void setAdapter(Adapter adapter)
adapter
- the new adapterpublic Adapter getAdapter()
protected void setSocketWrapper(SocketWrapperBase<?> socketWrapper)
socketWrapper
- The socket wrapperprotected final SocketWrapperBase<?> getSocketWrapper()
public final void setSslSupport(SSLSupport sslSupport)
Processor
setSslSupport
in interface Processor
sslSupport
- The SSL support object to use for this connectionprotected Executor getExecutor()
public AbstractEndpoint.Handler.SocketState asyncPostProcess()
asyncPostProcess
in class AbstractProcessorLight
public final AbstractEndpoint.Handler.SocketState dispatch(SocketEvent status) throws IOException
AbstractProcessorLight
dispatch
in class AbstractProcessorLight
status
- The event to processIOException
- If an I/O error occurs during the processing of the
requestprotected void parseHost(MessageBytes valueMB)
protected void populateHost()
The default implementation is a NO-OP.
protected void populatePort()
The default implementation is a NO-OP.
public final void action(ActionCode actionCode, Object param)
ActionHook
action
in interface ActionHook
actionCode
- Type of the actionparam
- Action parameterprotected void dispatchNonBlockingRead()
public void timeoutAsync(long now)
Note: The name of this method originated with the Servlet 3.0 asynchronous processing but evolved over time to represent a timeout that is triggered independently of the socket read/write timeouts.
Sub-classes of this base class represent a single request/response pair. The timeout to be processed is, therefore, the Servlet asynchronous processing timeout.
timeoutAsync
in interface Processor
now
- The time (as returned by System.currentTimeMillis()
to
use as the current time to determine whether the timeout has
expired. If negative, the timeout will always be treated as ifq
it has expired.public boolean checkAsyncTimeoutGeneration()
Processor
checkAsyncTimeoutGeneration
in interface Processor
true
If the async generation has not changed since the
async timeout was triggeredpublic void setAsyncTimeout(long timeout)
public long getAsyncTimeout()
public void recycle()
Processor
protected abstract void prepareResponse() throws IOException
IOException
protected abstract void finishResponse() throws IOException
IOException
@Deprecated protected void ack()
ack(ContinueResponseTiming)
.protected abstract void ack(ContinueResponseTiming continueResponseTiming)
protected abstract void flush() throws IOException
IOException
protected abstract int available(boolean doRead)
protected abstract void setRequestBody(ByteChunk body)
protected abstract void setSwallowResponse()
protected abstract void disableSwallowRequest()
protected boolean getPopulateRequestAttributesFromSocket()
false
.true
if the SocketWrapper should be used to populate the
request attributes, otherwise false
.protected void populateRequestAttributeRemoteHost()
protected void populateSslRequestAttributes()
SSLSupport
instance associated with this processor. Protocols that populate TLS
attributes from a different source (e.g. AJP) should override this
method.protected void sslReHandShake() throws IOException
IOException
- If authentication is required then there will be I/O
with the client and this exception will be thrown if
that goes wrongprotected void processSocketEvent(SocketEvent event, boolean dispatch)
protected boolean isReadyForRead()
protected abstract boolean isRequestBodyFullyRead()
protected abstract void registerReadInterest()
protected abstract boolean isReadyForWrite()
protected void executeDispatches()
public UpgradeToken getUpgradeToken()
getUpgradeToken
in interface Processor
protected void doHttpUpgrade(UpgradeToken upgradeToken)
upgradeToken
- Contains all the information necessary for the
Processor to process the upgradeUnsupportedOperationException
- if the protocol does not support
HTTP upgradepublic ByteBuffer getLeftoverInput()
getLeftoverInput
in interface Processor
public boolean isUpgrade()
protected boolean isPushSupported()
true
.true
if push is supported by this processor, otherwise
false
.protected void doPush(Request pushTarget)
pushTarget
- Contains all the information necessary for the Processor
to process the push requestUnsupportedOperationException
- if the protocol does not support
pushprotected Object getConnectionID()
null
if a
multiplexing protocol is not being usedprotected Object getStreamID()
null
if a
multiplexing protocol is not being usedprotected abstract boolean flushBufferedWrite() throws IOException
true
if data remains to be flushed at the end of
methodIOException
- If an I/O error occurs while attempting to flush the
dataprotected abstract AbstractEndpoint.Handler.SocketState dispatchEndRequest() throws IOException
IOException
- If an I/O error occurs while attempting to end the
requestprotected final void logAccess(SocketWrapperBase<?> socketWrapper) throws IOException
AbstractProcessorLight
logAccess
in class AbstractProcessorLight
socketWrapper
- The connection to processIOException
- If an I/O error occurs during the processing of the
requestCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.