Top Inners Fields Constructors Methods
org.eclipse.jetty.server.handler

public Class ContextRequest

extends Wrapper
implements Invocable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.thread.Invocable
Imports
java.util.concurrent.TimeoutException, java.util.function.Consumer, .Predicate, org.eclipse.jetty.server.Context, .Request, org.eclipse.jetty.util.thread.Invocable, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final ContextHandler.ScopedContext
private static final Logger

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addFailureListener(Consumer<Throwable>
the failure listener as a consumer function
onFailure
)

Overrides org.eclipse.jetty.server.Request.Wrapper.addFailureListener.

Implements org.eclipse.jetty.server.Request.addFailureListener.

Adds a listener for asynchronous fatal failures.

public void
addIdleTimeoutListener(Predicate<TimeoutException>
the idle timeout listener as a predicate function
onIdleTimeout
)

Overrides org.eclipse.jetty.server.Request.Wrapper.addIdleTimeoutListener.

Implements org.eclipse.jetty.server.Request.addIdleTimeoutListener.

Adds a listener for idle timeouts.

public void
demand(Runnable
the demand callback to invoke when there is a content chunk available.
demandCallback
)

Overrides org.eclipse.jetty.server.Request.Wrapper.demand.

Implements org.eclipse.jetty.server.Request.demand.

Demands to invoke the given demand callback parameter when a chunk of content is available.

public Context
Inherited from org.eclipse.jetty.server.Request.Wrapper:
addHttpStreamWrapperasAttributeMapclearAttributesconsumeAvailablefailgetAttributegetAttributeNameSetgetBeginNanoTimegetComponentsgetConnectionMetaDatagetHeadersgetHeadersNanoTimegetHttpURIgetIdgetLengthgetMethodgetSessiongetTrailersgetTunnelSupportgetWrappedisSecurepushreadremoveAttributesetAttribute

Field Detail

_contextback to summary
private final ContextHandler.ScopedContext _context
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.server.Request.LOG.

Constructor Detail

ContextRequestback to summary
protected ContextRequest(ContextHandler.ScopedContext context, Request request)

Method Detail

addFailureListenerback to summary
public void addFailureListener(Consumer<Throwable> onFailure)

Overrides org.eclipse.jetty.server.Request.Wrapper.addFailureListener.

Implements org.eclipse.jetty.server.Request.addFailureListener.

Doc from org.eclipse.jetty.server.Request.addFailureListener.

Adds a listener for asynchronous fatal failures.

When a listener is called, the effects of the failure have already taken place:

Listeners are processed in the same order they are added.

Parameters
onFailure:Consumer<Throwable>

the failure listener as a consumer function

Annotations
@Override
addIdleTimeoutListenerback to summary
public void addIdleTimeoutListener(Predicate<TimeoutException> onIdleTimeout)

Overrides org.eclipse.jetty.server.Request.Wrapper.addIdleTimeoutListener.

Implements org.eclipse.jetty.server.Request.addIdleTimeoutListener.

Doc from org.eclipse.jetty.server.Request.addIdleTimeoutListener.

Adds a listener for idle timeouts.

The listener is a predicate function that should return true to indicate that the idle timeout should be handled by the container as a fatal failure (see addFailureListener(Consumer)); or false to 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 demand(Runnable) or Response#write(boolean, ByteBuffer, Callback) operations.

Listeners are processed in the same order they are added, and the first that returns true stops the processing of subsequent listeners, which are therefore not invoked.

Parameters
onIdleTimeout:Predicate<TimeoutException>

the idle timeout listener as a predicate function

Annotations
@Override
demandback to summary
public void demand(Runnable demandCallback)

Overrides org.eclipse.jetty.server.Request.Wrapper.demand.

Implements org.eclipse.jetty.server.Request.demand.

Doc from org.eclipse.jetty.server.Request.demand.

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 passed Runnable are serialized and a callback for demand call is not invoked until any previous demand callback has returned. Thus the Runnable should not block waiting for a callback of a future demand call.

The demand callback may be invoked spuriously: a subsequent call to read() may return null.

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 fail(Throwable) is called.

Parameters
demandCallback:Runnable

the demand callback to invoke when there is a content chunk available.

Annotations
@Override
getContextback to summary
public Context getContext()

Overrides org.eclipse.jetty.server.Request.Wrapper.getContext.

Implements org.eclipse.jetty.server.Request.getContext.

Doc from org.eclipse.jetty.server.Request.getContext.

Get the Context associated with this Request.

Note that a Request should always have an associated Context since if the Request is not being handled by a org.eclipse.jetty.server.handler.ContextHandler then the Context from Server#getContext() will be used.

Returns:Context

the Context associated with this Request. Never null.

Annotations
@Override
org.eclipse.jetty.server.handler back to summary

private Class ContextRequest.OnContextDemand

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.server.handler.ContextRequest.OnContextDemand
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final Runnable

Constructor Summary

AccessConstructor and Description
public
OnContextDemand(Runnable demandCallback)

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_demandCallbackback to summary
private final Runnable _demandCallback

Constructor Detail

OnContextDemandback to summary
public OnContextDemand(Runnable demandCallback)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override