ServletChannelState to coordinate the states of dispatch state, input and
output according to the servlet specification. The combined state so obtained
is reflected in the behaviour of the contained HttpInput implementation of
jakarta.servlet.ServletInputStream .
This class is reusable over multiple requests for the same ServletContextHandler
and is recycled after each use before being
associated with a new ServletContextRequest
and then associated with possibly wrapped
request, response and callback.
ServletChannelState, HttpInput
| Modifier and Type | Field and Description |
|---|---|
| private Callback | |
| private final ConnectionMetaData | |
| private final ServletContextHandler. | |
| pack-priv final HttpInput | |
| private final HttpOutput | |
| private Request | |
| private final AtomicLong | |
| private Response | |
| private final ServletContextHandler. | |
| private ServletContextRequest | |
| private final ServletChannelState | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | associate(ServletContextRequest
The servlet context request to associate servletContextRequest)Associate this channel with a specific request. |
| public void | associate(Request
The request, which may have been wrapped
after # request, Response ServletContextHandler#wrapRequest(Request, Response)The response, which may have been wrapped
after # response, Callback ServletContextHandler#wrapResponse(ContextRequest, Response)The context, which may have been wrapped
after callback)ServletContextHandler#handle(Request, Response, Callback)Associate this channel with possibly wrapped values for
|
| private void | |
| public void | |
| protected void | |
| protected String | Returns: Default implementation returnsHostPort#normalizeHost(String)The address or host addr)Format the address or host returned from Request methods |
| private long | |
| public Callback | |
| public Connection | |
| public ConnectionMetaData | |
| public ServletContextHandler. | |
| public EndPoint | |
| public HttpConfiguration | |
| public HttpInput | |
| public HttpOutput | |
| public long | |
| public InetSocketAddress | |
| public String | |
| public int | Returns: the local port, or 0 if unspecifiedReturn the Local Port of the connected channel. |
| public InetSocketAddress | |
| public Request | |
| public Response | |
| public Server | |
| public HostPort | Returns: return the HttpConfiguration server authority overrideGet return the HttpConfiguration server authority override. |
| public ServletContextHandler. | |
| public ServletContextHandler | |
| public ServletContextRequest | getServletContextRequest()
Returns: The |
| public ServletContextResponse | getServletContextResponse()
Returns: The ServetContextResponse as wrapped by the |
| public ServletChannelState | |
| public void | |
| protected void | handleException(Throwable
the Throwable that caused the problem failure)Sends an error 500, performing a special logic to detect whether the request is suspended, to avoid concurrent writes from the application. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| private boolean | sendErrorOrAbort(String
the error message. message)Returns: true if we have sent an error, false if we have aborted. |
| public void | |
| public void | |
| public String | |
| protected Throwable |
| _callback | back to summary |
|---|---|
| private Callback _callback | |
| _connectionMetaData | back to summary |
|---|---|
| private final ConnectionMetaData _connectionMetaData | |
| _context | back to summary |
|---|---|
| private final ServletContextHandler. | |
| _httpInput | back to summary |
|---|---|
| pack-priv final HttpInput _httpInput | |
| _httpOutput | back to summary |
|---|---|
| private final HttpOutput _httpOutput | |
| _request | back to summary |
|---|---|
| private Request _request | |
| _requests | back to summary |
|---|---|
| private final AtomicLong _requests | |
| _response | back to summary |
|---|---|
| private Response _response | |
| _servletContextApi | back to summary |
|---|---|
| private final ServletContextHandler. | |
| _servletContextRequest | back to summary |
|---|---|
| private ServletContextRequest _servletContextRequest | |
| _state | back to summary |
|---|---|
| private final ServletChannelState _state | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| ServletChannel | back to summary |
|---|---|
| public ServletChannel(ServletContextHandler servletContextHandler, Request request) | |
| ServletChannel | back to summary |
|---|---|
| public ServletChannel(ServletContextHandler servletContextHandler, ConnectionMetaData connectionMetaData) | |
| abort | back to summary |
|---|---|
| public void abort(Throwable failure) If a write or similar operation to this channel fails, then this method should be called.
| |
| associate | back to summary |
|---|---|
| public void associate(ServletContextRequest servletContextRequest) Associate this channel with a specific request.
This method is called by the
| |
| associate | back to summary |
|---|---|
| public void associate(Request request, Response response, Callback callback) Associate this channel with possibly wrapped values for
| |
| dispatch | back to summary |
|---|---|
| private void dispatch() throws Exception | |
| dispatchAsync | back to summary |
|---|---|
| public void dispatchAsync() throws Exception | |
| execute | back to summary |
|---|---|
| protected void execute(Runnable task) | |
| formatAddrOrHost | back to summary |
|---|---|
| protected String formatAddrOrHost(String addr) Format the address or host returned from Request methods
| |
| getBytesWritten | back to summary |
|---|---|
| private long getBytesWritten() | |
| getCallback | back to summary |
|---|---|
| public Callback getCallback() | |
| getConnection | back to summary |
|---|---|
| public Connection getConnection() | |
| getConnectionMetaData | back to summary |
|---|---|
| public ConnectionMetaData getConnectionMetaData() | |
| getContext | back to summary |
|---|---|
| public ServletContextHandler. | |
| getEndPoint | back to summary |
|---|---|
| public EndPoint getEndPoint() | |
| getHttpConfiguration | back to summary |
|---|---|
| public HttpConfiguration getHttpConfiguration() | |
| getHttpInput | back to summary |
|---|---|
| public HttpInput getHttpInput() | |
| getHttpOutput | back to summary |
|---|---|
| public HttpOutput getHttpOutput() | |
| getIdleTimeout | back to summary |
|---|---|
| public long getIdleTimeout() Get the idle timeout. This is implemented as a call to
| |
| getLocalAddress | back to summary |
|---|---|
| public InetSocketAddress getLocalAddress() | |
| getLocalName | back to summary |
|---|---|
| public String getLocalName() Return the local name of the connected channel. This is the host name after the connector is bound and the connection is accepted.
Value can be overridden by Note some connectors are not based on IP networking, and default behavior here will
result in a null return. Use
| |
| getLocalPort | back to summary |
|---|---|
| public int getLocalPort() Return the Local Port of the connected channel. This is the port the connector is bound to and is accepting connections on.
Value can be overridden by Note some connectors are not based on IP networking, and default behavior here will
result in a value of 0 returned. Use
| |
| getRemoteAddress | back to summary |
|---|---|
| public InetSocketAddress getRemoteAddress() | |
| getRequest | back to summary |
|---|---|
public Request getRequest()
| |
| getResponse | back to summary |
|---|---|
public Response getResponse()
| |
| getServer | back to summary |
|---|---|
| public Server getServer() | |
| getServerAuthority | back to summary |
|---|---|
| public HostPort getServerAuthority() Get return the HttpConfiguration server authority override.
| |
| getServletContextApi | back to summary |
|---|---|
| public ServletContextHandler. | |
| getServletContextHandler | back to summary |
|---|---|
| public ServletContextHandler getServletContextHandler() | |
| getServletContextRequest | back to summary |
|---|---|
public ServletContextRequest getServletContextRequest()
| |
| getServletContextResponse | back to summary |
|---|---|
public ServletContextResponse getServletContextResponse()
| |
| getServletRequestState | back to summary |
|---|---|
| public ServletChannelState getServletRequestState() | |
| handle | back to summary |
|---|---|
| public void handle() Handle the servlet request. This is called on the initial dispatch and then again on any asynchronous events. | |
| handleException | back to summary |
|---|---|
| protected void handleException(Throwable failure) Sends an error 500, performing a special logic to detect whether the request is suspended, to avoid concurrent writes from the application. It may happen that the application suspends, and then throws an exception, while an application
spawned thread writes the response content; in such case, we attempt to commit the error directly
bypassing the
| |
| isAborted | back to summary |
|---|---|
| public boolean isAborted() | |
| isCommitted | back to summary |
|---|---|
| public boolean isCommitted() | |
| isRequestCompleted | back to summary |
|---|---|
public boolean isRequestCompleted()
| |
| isResponseCompleted | back to summary |
|---|---|
public boolean isResponseCompleted()
| |
| isSendError | back to summary |
|---|---|
| public boolean isSendError() | |
| onCompleted | back to summary |
|---|---|
public void onCompleted()
| |
| onTrailers | back to summary |
|---|---|
| pack-priv void onTrailers(HttpFields trailers) | |
| recycle | back to summary |
|---|---|
| pack-priv void recycle(Throwable x) Prepare to be reused.
| |
| reopen | back to summary |
|---|---|
| private void reopen() | |
| sendErrorOrAbort | back to summary |
|---|---|
private boolean sendErrorOrAbort(String message)
| |
| sendErrorResponseAndComplete | back to summary |
|---|---|
| public void sendErrorResponseAndComplete() | |
| setIdleTimeout | back to summary |
|---|---|
| public void setIdleTimeout(long timeoutMs) Set the idle timeout. This is implemented as a call to
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| unwrap | back to summary |
|---|---|
| protected Throwable unwrap(Throwable failure, Class<?>... targets) Unwrap failure causes to find target class | |