- All Implemented Interfaces:
org.eclipse.jetty.io.Content.Source,Request,org.eclipse.jetty.util.Attributes
- Direct Known Subclasses:
ContextRequest,ErrorHandler.ErrorRequest,GzipRequest,HeaderWrappingRequest,SecureRequestCustomizer.SecureRequest,StatisticsHandler.MinimumDataRateHandler.MinimumDataRateRequest
- Enclosing interface:
Request
A wrapper for Request instances.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
org.eclipse.jetty.util.Attributes.Layer, org.eclipse.jetty.util.Attributes.Lazy, org.eclipse.jetty.util.Attributes.Mapped, org.eclipse.jetty.util.Attributes.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.server.Request
Request.AuthenticationState, Request.Handler, Request.ServeAs, Request.Wrapper -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULLFields inherited from interface org.eclipse.jetty.server.Request
CACHE_ATTRIBUTE, COOKIE_ATTRIBUTE, DEFAULT_LOCALES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFailureListener(Consumer<Throwable> onFailure) Adds a listener for asynchronous hard errors.voidaddHttpStreamWrapper(Function<HttpStream, HttpStream> wrapper) voidaddIdleTimeoutListener(Predicate<TimeoutException> onIdleTimeout) Adds a listener for idle timeouts.booleanConsume any available content.voidvoidlongGet the nanoTime at which the request arrived to a connector, obtained viaSystem.nanoTime().Get theContextassociated with thisRequest.org.eclipse.jetty.http.HttpFieldslongGet the nanoTime at which the request headers were parsed, obtained viaSystem.nanoTime().org.eclipse.jetty.http.HttpURIgetId()an ID unique within the lifetime scope of theConnectionMetaData.getId()).longgetSession(boolean create) Get aSessionassociated with the request.org.eclipse.jetty.http.HttpFieldsbooleanisSecure()voidpush(org.eclipse.jetty.http.MetaData.Request resource) Pushes the givenresourceto the client.org.eclipse.jetty.io.Content.Chunkread()Methods inherited from class org.eclipse.jetty.util.Attributes.Wrapper
clearAttributes, equals, getAttribute, getAttributeNameSet, hashCode, removeAttribute, setAttributeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, clearAttributes, getAttribute, getAttributeNameSet, removeAttribute, setAttributeMethods inherited from interface org.eclipse.jetty.io.Content.Source
fail, rewind
-
Constructor Details
-
Wrapper
-
-
Method Details
-
getId
Description copied from interface:Requestan ID unique within the lifetime scope of theConnectionMetaData.getId()). This may be a protocol ID (e.g. HTTP/2 stream ID) or it may be unrelated to the protocol. -
getComponents
- Specified by:
getComponentsin interfaceRequest- Returns:
- the
Componentsto be used with thisRequest.
-
getConnectionMetaData
- Specified by:
getConnectionMetaDatain interfaceRequest- Returns:
- the
ConnectionMetaDataassociated to thisRequest
-
getMethod
-
getHttpURI
public org.eclipse.jetty.http.HttpURI getHttpURI()- Specified by:
getHttpURIin interfaceRequest- Returns:
- the HTTP URI of this
Request - See Also:
-
getContext
Description copied from interface:RequestGet theContextassociated with thisRequest.Note that a
Requestshould always have an associatedContextsince if theRequestis not being handled by aContextHandlerthen theContextfromServer.getContext()will be used.- Specified by:
getContextin interfaceRequest- Returns:
- the
Contextassociated with thisRequest. Nevernull. - See Also:
-
getHeaders
public org.eclipse.jetty.http.HttpFields getHeaders()- Specified by:
getHeadersin interfaceRequest- Returns:
- the HTTP headers of this
Request
-
getTrailers
public org.eclipse.jetty.http.HttpFields getTrailers()- Specified by:
getTrailersin interfaceRequest- Returns:
- the HTTP trailers of this
Request, ornullif they are not present
-
getBeginNanoTime
public long getBeginNanoTime()Description copied from interface:RequestGet the nanoTime at which the request arrived to a connector, obtained via
System.nanoTime(). This method can be used when measuring latencies.- Specified by:
getBeginNanoTimein interfaceRequest- Returns:
- The nanoTime at which the request was received/created in nanoseconds
-
getHeadersNanoTime
public long getHeadersNanoTime()Description copied from interface:RequestGet the nanoTime at which the request headers were parsed, obtained via
System.nanoTime(). This method can be used when measuring latencies.- Specified by:
getHeadersNanoTimein interfaceRequest- Returns:
- The nanoTime at which the request was ready in nanoseconds
-
isSecure
public boolean isSecure() -
getLength
public long getLength()- Specified by:
getLengthin interfaceorg.eclipse.jetty.io.Content.Source
-
read
public org.eclipse.jetty.io.Content.Chunk read()Description copied from interface:RequestIn addition, the returned
Content.Chunkmay be aTrailersinstance, in case of request content trailers. -
consumeAvailable
public boolean consumeAvailable()Description copied from interface:RequestConsume any available content. This bypasses any request wrappers to process the content inRequest.read()and reads directly from theHttpStream. This reads until there is no content currently available, or it reaches EOF. TheHttpConfiguration.setMaxUnconsumedRequestContentReads(int)configuration can be used to configure how many reads will be attempted by this method.- Specified by:
consumeAvailablein interfaceRequest- Returns:
- true if the content was fully consumed.
-
demand
Description copied from interface:Request- Specified by:
demandin interfaceorg.eclipse.jetty.io.Content.Source- Specified by:
demandin interfaceRequest- Parameters:
demandCallback- the demand callback to invoke when there is a content chunk available. In addition to the invocation guarantees ofContent.Source.demand(Runnable), this implementation serializes the invocation of theRunnablewith invocations of anyResponse.write(boolean, ByteBuffer, Callback)Callbackinvocations.- See Also:
-
fail
- Specified by:
failin interfaceorg.eclipse.jetty.io.Content.Source
-
push
public void push(org.eclipse.jetty.http.MetaData.Request resource) Description copied from interface:RequestPushes the given
resourceto the client. -
addIdleTimeoutListener
Description copied from interface:RequestAdds a listener for idle timeouts.
The listener is a predicate function that should return
trueto indicate that the idle timeout should be handled by the container as a hard failure (seeRequest.addFailureListener(Consumer)); orfalseto ignore that specific timeout and for another timeout to occur after another idle period.Any pending
Request.demand(Runnable)orResponse.write(boolean, ByteBuffer, Callback)operations are not affected by this call. Applications need to be mindful of any such pending operations if attempting to make new operations.Listeners are processed in sequence, and the first that returns
truestops the processing of subsequent listeners, which are therefore not invoked.- Specified by:
addIdleTimeoutListenerin interfaceRequest- Parameters:
onIdleTimeout- the predicate function- See Also:
-
addFailureListener
Description copied from interface:RequestAdds a listener for asynchronous hard errors.
When a listener is called, the effects of the error will already have taken place:
- Pending
Request.demand(Runnable)will be woken up. - Calls to
Request.read()will return theThrowable. - Pending and new
Response.write(boolean, ByteBuffer, Callback)calls will be failed by callingCallback.failed(Throwable)on the callback passed towrite(...). - Any call to
Callback.succeeded()on the callback passed toRequest.Handler.handle(Request, Response, Callback)will effectively be a call toCallback.failed(Throwable)with the notifiedThrowable.
Listeners are processed in sequence. When all listeners are invoked then
Callback.failed(Throwable)will be called on the callback passed toRequest.Handler.handle(Request, Response, Callback).- Specified by:
addFailureListenerin interfaceRequest- Parameters:
onFailure- the consumer function- See Also:
- Pending
-
getTunnelSupport
- Specified by:
getTunnelSupportin interfaceRequest
-
addHttpStreamWrapper
- Specified by:
addHttpStreamWrapperin interfaceRequest
-
getSession
Description copied from interface:RequestGet a
Sessionassociated with the request. Sessions may not be supported by a given configuration, in which casenullwill be returned.- Specified by:
getSessionin interfaceRequest- Parameters:
create- True if the session should be created for the request.- Returns:
- The session associated with the request or
null.
-
getWrapped
- Overrides:
getWrappedin classorg.eclipse.jetty.util.Attributes.Wrapper
-