- All Implemented Interfaces:
org.eclipse.jetty.io.Content.Source,Request,org.eclipse.jetty.util.Attributes
- Direct Known Subclasses:
ContextRequest,GzipRequest,HeaderWrappingRequest,Request.AttributesWrapper,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.Synthetic, org.eclipse.jetty.util.Attributes.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.server.Request
Request.AttributesWrapper, 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
COOKIE_ATTRIBUTE, DEFAULT_LOCALES, LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFailureListener(Consumer<Throwable> onFailure) Adds a listener for asynchronous fatal failures.voidaddHttpStreamWrapper(Function<HttpStream, HttpStream> wrapper) Add aHttpStream.Wrapperto the currentHttpStream.voidaddIdleTimeoutListener(Predicate<TimeoutException> onIdleTimeout) Adds a listener for idle timeouts.voidbooleanConsume any available content.voidvoidgetAttribute(String name) longGet 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()removeAttribute(String name) setAttribute(String name, Object attribute) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Attributes
equals, hashCodeMethods 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 -
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 fatal failure (seeRequest.addFailureListener(Consumer)); orfalseto ignore that specific timeout and for another timeout to occur after another idle period.Idle timeout listeners are only invoked if there are no pending
Request.demand(Runnable)orResponse.write(boolean, ByteBuffer, Callback)operations.Listeners are processed in the same order they are added, and the first that returns
truestops the processing of subsequent listeners, which are therefore not invoked.- Specified by:
addIdleTimeoutListenerin interfaceRequest- Parameters:
onIdleTimeout- the idle timeout listener as a predicate function- See Also:
-
addFailureListener
Description copied from interface:RequestAdds a listener for asynchronous fatal failures.
When a listener is called, the effects of the failure have already taken place:
- Pending
Request.demand(Runnable)have been woken up. - Calls to
Request.read()will return theThrowablefailure. - Pending and new
Response.write(boolean, ByteBuffer, Callback)calls will be failed by callingCallback.failed(Throwable)on the callback passed toResponse.write(boolean, ByteBuffer, Callback).
Listeners are processed in the same order they are added.
- Specified by:
addFailureListenerin interfaceRequest- Parameters:
onFailure- the failure listener as a consumer function- See Also:
- Pending
-
getTunnelSupport
- Specified by:
getTunnelSupportin interfaceRequest
-
addHttpStreamWrapper
Description copied from interface:RequestAdd aHttpStream.Wrapperto the currentHttpStream.- Specified by:
addHttpStreamWrapperin interfaceRequest- Parameters:
wrapper- A function that wraps the passed stream.- See Also:
-
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.
-
removeAttribute
- Specified by:
removeAttributein interfaceorg.eclipse.jetty.util.Attributes
-
setAttribute
- Specified by:
setAttributein interfaceorg.eclipse.jetty.util.Attributes
-
getAttribute
- Specified by:
getAttributein interfaceorg.eclipse.jetty.util.Attributes
-
getAttributeNameSet
- Specified by:
getAttributeNameSetin interfaceorg.eclipse.jetty.util.Attributes
-
asAttributeMap
- Specified by:
asAttributeMapin interfaceorg.eclipse.jetty.util.Attributes
-
clearAttributes
public void clearAttributes()- Specified by:
clearAttributesin interfaceorg.eclipse.jetty.util.Attributes
-
getWrapped
-