Class HttpChannelOverHttp
- All Implemented Interfaces:
Runnable
,HttpParser.ComplianceHandler
,HttpParser.HttpHandler
,HttpParser.RequestHandler
,HttpOutput.Interceptor
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.HttpChannel
HttpChannel.Dispatchable, HttpChannel.Listener, HttpChannel.TransientListeners
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HttpField
private boolean
private boolean
private boolean
private final HttpFields
private final HttpConnection
private final MetaData.Request
private HttpFields
private boolean
private HttpField
private static final Logger
private static final HttpField
Fields inherited from class org.eclipse.jetty.server.HttpChannel
NOOP_LISTENER
-
Constructor Summary
ConstructorsConstructorDescriptionHttpChannelOverHttp
(HttpConnection httpConnection, Connector connector, HttpConfiguration config, EndPoint endPoint, HttpTransport transport) -
Method Summary
Modifier and TypeMethodDescriptionvoid
If a write or similar operation to this channel fails, then this method should be called.void
badMessage
(BadMessageException failure) Called to signal that a bad HTTP message has been received.boolean
content
(ByteBuffer content) boolean
void
continue100
(int available) If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.void
earlyEOF()
Called to signal that an EOF was received unexpectedly during the parsing of an HTTP messageint
protected void
Sends an error 500, performing a special logic to detect whether the request is suspended, to avoid concurrent writes from the application.boolean
boolean
boolean
boolean
protected HttpInput
newHttpInput
(HttpChannelState state) void
void
void
onBlockWaitForContentFailure
(Throwable failure) void
onComplianceViolation
(HttpCompliance compliance, HttpComplianceSection violation, String reason) (package private) boolean
onIdleTimeout
(Throwable timeout) void
parsedHeader
(HttpField field) This is the method called by parser when an HTTP Header name and value is foundvoid
parsedTrailer
(HttpField field) This is the method called by parser when an HTTP Trailer name and value is foundvoid
recycle()
boolean
startRequest
(String method, String uri, HttpVersion version) This is the method called by parser when the HTTP request line is parsedprivate boolean
upgrade()
Attempts to perform an HTTP/1.1 upgrade.Methods inherited from class org.eclipse.jetty.server.HttpChannel
addListener, addRequestLog, commit, ensureConsumeAllOrNotPersistent, execute, getByteBufferPool, getBytesWritten, getCommittedMetaData, getConnection, getConnector, getEndPoint, getHttpConfiguration, getHttpTransport, getIdleTimeout, getLocalAddress, getNextInterceptor, getRemoteAddress, getRequest, getRequestLog, getRequests, getResponse, getScheduler, getServer, getState, getTransientListeners, handle, isCommitted, isOptimizedForDirectBuffers, isPersistent, isRequestCompleted, isResponseCompleted, isSendError, newHttpOutput, onBadMessage, onCompleted, onContent, onContentComplete, onEarlyEOF, onRequest, onRequestComplete, onTrailers, removeListener, resetBuffer, run, sendResponse, sendResponse, sendResponseAndComplete, setIdleTimeout, setRequestLog, toString, unwrap, useDirectBuffers, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.http.HttpParser.ComplianceHandler
onComplianceViolation
Methods inherited from interface org.eclipse.jetty.http.HttpParser.HttpHandler
badMessage
-
Field Details
-
LOG
-
PREAMBLE_UPGRADE_H2C
-
_fields
-
_metadata
-
_httpConnection
-
_connection
-
_upgrade
-
_delayedForContent
private boolean _delayedForContent -
_unknownExpectation
private boolean _unknownExpectation -
_expect100Continue
private boolean _expect100Continue -
_expect102Processing
private boolean _expect102Processing -
_complianceViolations
-
_trailers
-
-
Constructor Details
-
HttpChannelOverHttp
public HttpChannelOverHttp(HttpConnection httpConnection, Connector connector, HttpConfiguration config, EndPoint endPoint, HttpTransport transport)
-
-
Method Details
-
newHttpInput
- Overrides:
newHttpInput
in classHttpChannel
-
recycle
public void recycle()- Overrides:
recycle
in classHttpChannel
-
isExpecting100Continue
public boolean isExpecting100Continue()- Overrides:
isExpecting100Continue
in classHttpChannel
-
isExpecting102Processing
public boolean isExpecting102Processing()- Overrides:
isExpecting102Processing
in classHttpChannel
-
startRequest
Description copied from interface:HttpParser.RequestHandler
This is the method called by parser when the HTTP request line is parsed- Specified by:
startRequest
in interfaceHttpParser.RequestHandler
- Parameters:
method
- The methoduri
- The raw bytes of the URI. These are copied into a ByteBuffer that will not be changed until this parser is reset and reused.version
- the http version in use- Returns:
- true if handling parsing should return.
-
parsedHeader
Description copied from interface:HttpParser.HttpHandler
This is the method called by parser when an HTTP Header name and value is found- Specified by:
parsedHeader
in interfaceHttpParser.HttpHandler
- Parameters:
field
- The field parsed
-
parsedTrailer
Description copied from interface:HttpParser.HttpHandler
This is the method called by parser when an HTTP Trailer name and value is found- Specified by:
parsedTrailer
in interfaceHttpParser.HttpHandler
- Parameters:
field
- The field parsed
-
continue100
If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.- Overrides:
continue100
in classHttpChannel
- Parameters:
available
- estimate of the number of bytes that are available- Throws:
IOException
- if the InputStream cannot be created
-
earlyEOF
public void earlyEOF()Description copied from interface:HttpParser.HttpHandler
Called to signal that an EOF was received unexpectedly during the parsing of an HTTP message- Specified by:
earlyEOF
in interfaceHttpParser.HttpHandler
-
content
- Specified by:
content
in interfaceHttpParser.HttpHandler
-
onAsyncWaitForContent
public void onAsyncWaitForContent()- Overrides:
onAsyncWaitForContent
in classHttpChannel
-
onBlockWaitForContent
public void onBlockWaitForContent()- Overrides:
onBlockWaitForContent
in classHttpChannel
-
onBlockWaitForContentFailure
- Overrides:
onBlockWaitForContentFailure
in classHttpChannel
-
badMessage
Description copied from interface:HttpParser.HttpHandler
Called to signal that a bad HTTP message has been received.- Specified by:
badMessage
in interfaceHttpParser.HttpHandler
- Parameters:
failure
- the failure with the bad message information
-
headerComplete
public boolean headerComplete()- Specified by:
headerComplete
in interfaceHttpParser.HttpHandler
-
onIdleTimeout
-
upgrade
Attempts to perform an HTTP/1.1 upgrade.
The upgrade looks up a
ConnectionFactory.Upgrading
from the connector matching the protocol specified in theUpgrade
header.The upgrade may succeed, be ignored (which can allow a later handler to implement) or fail with a
BadMessageException
.- Returns:
- true if the upgrade was performed, false if it was ignored
- Throws:
BadMessageException
- if the upgrade failed
-
handleException
Description copied from class:HttpChannel
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
ErrorHandler
mechanisms and the response OutputStream.- Overrides:
handleException
in classHttpChannel
- Parameters:
x
- the Throwable that caused the problem
-
abort
Description copied from class:HttpChannel
If a write or similar operation to this channel fails, then this method should be called.The standard implementation calls
HttpTransport.abort(Throwable)
.- Overrides:
abort
in classHttpChannel
- Parameters:
failure
- the failure that caused the abort.
-
contentComplete
public boolean contentComplete()- Specified by:
contentComplete
in interfaceHttpParser.HttpHandler
-
messageComplete
public boolean messageComplete()- Specified by:
messageComplete
in interfaceHttpParser.HttpHandler
-
getHeaderCacheSize
public int getHeaderCacheSize()- Specified by:
getHeaderCacheSize
in interfaceHttpParser.HttpHandler
- Returns:
- the size in bytes of the per parser header cache
-
onComplianceViolation
public void onComplianceViolation(HttpCompliance compliance, HttpComplianceSection violation, String reason) - Specified by:
onComplianceViolation
in interfaceHttpParser.ComplianceHandler
-