Class ErrorHandler.ErrorRequest
- All Implemented Interfaces:
Content.Source
,Request
,Attributes
- Enclosing class:
- ErrorHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic
Nested 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
NULL
Fields inherited from interface org.eclipse.jetty.server.Request
COOKIE_ATTRIBUTE, DEFAULT_LOCALES, LOG
-
Constructor Summary
-
Method Summary
Methods inherited from class org.eclipse.jetty.server.Request.AttributesWrapper
asAttributeMap, clearAttributes, getAttribute, getAttributeNameSet, removeAttribute, setAttribute
Methods inherited from class org.eclipse.jetty.server.Request.Wrapper
addFailureListener, addHttpStreamWrapper, addIdleTimeoutListener, consumeAvailable, fail, getBeginNanoTime, getComponents, getConnectionMetaData, getContext, getHeaders, getHeadersNanoTime, getHttpURI, getId, getLength, getMethod, getSession, getTrailers, getTunnelSupport, getWrapped, isSecure, push
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Attributes
equals, hashCode
Methods inherited from interface org.eclipse.jetty.io.Content.Source
fail, rewind
-
Constructor Details
-
ErrorRequest
-
-
Method Details
-
read
Description copied from interface:Request
Reads a chunk of content.
See how to use this method idiomatically.
The returned chunk could be:
null
, to signal that there isn't a chunk of content available- an
Content.Chunk
instance with non nullContent.Chunk.getFailure()
, to signal that there was a failure trying to produce a chunk of content, or that the content production has beenfailed
externally - a
Content.Chunk
instance, containing the chunk of content.
Once a read returns an
Content.Chunk
instance with non-nullContent.Chunk.getFailure()
then if the failure islast
further reads will continue to return the same failure chunk instance, otherwise furtherread()
operations may return different non-failure chunks.Once a read returns a
last chunk
, further reads will continue to return a last chunk (although the instance may be different).The content reader code must ultimately arrange for a call to
Retainable.release()
on the returnedContent.Chunk
.Additionally, prior to the ultimate call to
Retainable.release()
, the reader code may make additional calls toRetainable.retain()
, that must ultimately be matched by a correspondent number of calls toRetainable.release()
.Concurrent reads from different threads are not recommended, as they are inherently in a race condition.
Reads performed outside the invocation context of a
demand callback
are allowed. However, reads performed with a pending demand are inherently in a race condition (the thread that reads with the thread that invokes the demand callback).In addition, the returned
Content.Chunk
may be aTrailers
instance, in case of request content trailers.- Specified by:
read
in interfaceContent.Source
- Specified by:
read
in interfaceRequest
- Overrides:
read
in classRequest.Wrapper
- Returns:
- a chunk of content, possibly a failure instance, or
null
- See Also:
-
demand
Description copied from interface:Request
Demands to invoke the given demand callback parameter when a chunk of content is available.
See how to use this method idiomatically.
Implementations guarantee that calls to this method are safely reentrant so that stack overflows are avoided in the case of mutual recursion between the execution of the
Runnable
callback and a call to this method. Invocations of the passedRunnable
are serialized and a callback fordemand
call is not invoked until any previousdemand
callback has returned. Thus theRunnable
should not block waiting for a callback of a future demand call.The demand callback may be invoked spuriously: a subsequent call to
Content.Source.read()
may returnnull
.Calling this method establishes a pending demand, which is fulfilled when the demand callback is invoked.
Calling this method when there is already a pending demand results in an
IllegalStateException
to be thrown.If the invocation of the demand callback throws an exception, then
Content.Source.fail(Throwable)
is called.- Specified by:
demand
in interfaceContent.Source
- Specified by:
demand
in interfaceRequest
- Overrides:
demand
in classRequest.Wrapper
- Parameters:
demandCallback
- the demand callback to invoke when there is a content chunk available.- See Also:
-
toString
- Overrides:
toString
in classRequest.Wrapper
-