Class EagerContentHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
- All Implemented Interfaces:
Handler, Handler.Container, Handler.Singleton, Request.Handler, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.Invocable
- Direct Known Subclasses:
DelayedHandler
A ConditionalHandler that can eagerly load content asynchronously before calling the
next handler. Typically this handler is deployed before an application that uses
blocking IO to read the request body. By using this handler, such an application can be run in a way so that it
never (or seldom) blocks on request content. This gives many of the benefits of asynchronous IO without the
need to write an asynchronous application.
The handler uses the configured EagerContentHandler.FormContentLoaderFactory instances to eagerly load specific content types.
By default, this handler supports eager loading of:
FormFields- Loaded and parsed in full by the
EagerContentHandler.FormContentLoaderFactory MultiPartFormData- Loaded and parsed in full by the
EagerContentHandler.MultiPartContentLoaderFactory Content.Chunk- Retained by the
EagerContentHandler.RetainedContentLoaderFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn eager content processor, created by aEagerContentHandler.ContentLoaderFactoryto asynchronous load content from aRequestbefore calling theRequest.Handler.handle(Request, Response, Callback)method of the passedHandler.static interfaceA factory to create newEagerContentHandler.ContentLoaderinstances for a specific mime type.static classAnEagerContentHandler.ContentLoaderFactoryforMimeTypes.Type.FORM_ENCODEDcontent, that usesFormFields.onFields(Request, Charset, int, int, Promise.Invocable)to asynchronously load and parse the content.static classAnEagerContentHandler.ContentLoaderFactoryforMimeTypes.Type.MULTIPART_FORM_DATAcontent, that usesMultiPartFormData.onParts(Content.Source, Attributes, String, MultiPartConfig, Promise.Invocable)to asynchronously load and parse the content.static classAnEagerContentHandler.ContentLoaderFactoryfor any content, that usesRetainable.retain()to eagerly load content with zero copies, until all content is read or a maximum size is exceeded.Nested classes/interfaces inherited from class ConditionalHandler
ConditionalHandler.Abstract, ConditionalHandler.ConnectorPredicate, ConditionalHandler.DontHandle, ConditionalHandler.ElseNext, ConditionalHandler.InetAddressPatternPredicate, ConditionalHandler.MethodPredicate, ConditionalHandler.NextElseReject, ConditionalHandler.PathSpecPredicate, ConditionalHandler.PredicateSet, ConditionalHandler.Reject, ConditionalHandler.SkipNextNested classes/interfaces inherited from class Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendableNested classes/interfaces inherited from interface Handler
Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
org.eclipse.jetty.util.thread.Invocable.Callable, org.eclipse.jetty.util.thread.Invocable.InvocationType, org.eclipse.jetty.util.thread.Invocable.ReadyTask, org.eclipse.jetty.util.thread.Invocable.TaskNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.ListenerNested classes/interfaces inherited from interface Request.Handler
Request.Handler.AbortException -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGENDFields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP -
Constructor Summary
ConstructorsConstructorDescriptionConstruct anEagerContentHandlerwith the defaultEagerContentHandler.ContentLoaderFactorysetEagerContentHandler(Handler handler) Construct anEagerContentHandlerwith the defaultEagerContentHandler.ContentLoaderFactorysetEagerContentHandler(EagerContentHandler.ContentLoaderFactory... factories) Construct anEagerContentHandlerwith the specificEagerContentHandler.ContentLoaderFactoryinstancesEagerContentHandler(Handler handler, EagerContentHandler.ContentLoaderFactory... factories) Construct anEagerContentHandlerwith the specificEagerContentHandler.ContentLoaderFactoryinstances -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanonConditionsMet(Request request, Response response, org.eclipse.jetty.util.Callback callback) Handle a request that has met the conditions.Methods inherited from class ConditionalHandler.ElseNext
onConditionsNotMetMethods inherited from class ConditionalHandler
clear, doStart, dump, exclude, exclude, exclude, excludeInetAddressPattern, excludeMethod, excludePath, from, from, handle, include, include, include, includeInetAddressPattern, includeMethod, includePath, nextHandlerMethods inherited from class Handler.Wrapper
getHandler, getInvocationType, setHandlerMethods inherited from class Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamic, setServerMethods inherited from class Handler.Abstract
destroy, doStop, getServerMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Destroyable
destroyMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface Handler.Singleton
getHandlers, getTail, insertHandler, setHandlerMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
EagerContentHandler
public EagerContentHandler()Construct anEagerContentHandlerwith the defaultEagerContentHandler.ContentLoaderFactoryset -
EagerContentHandler
Construct anEagerContentHandlerwith the defaultEagerContentHandler.ContentLoaderFactoryset- Parameters:
handler- The next handler (also can be set withHandler.Wrapper.setHandler(Handler)
-
EagerContentHandler
Construct anEagerContentHandlerwith the specificEagerContentHandler.ContentLoaderFactoryinstances- Parameters:
factories- TheEagerContentHandler.ContentLoaderFactoryinstances used to eagerly load content.
-
EagerContentHandler
Construct anEagerContentHandlerwith the specificEagerContentHandler.ContentLoaderFactoryinstances- Parameters:
handler- The next handler (also can be set withHandler.Wrapper.setHandler(Handler)factories- TheEagerContentHandler.ContentLoaderFactoryinstances used to eagerly load content.
-
-
Method Details
-
onConditionsMet
protected boolean onConditionsMet(Request request, Response response, org.eclipse.jetty.util.Callback callback) throws Exception Description copied from class:ConditionalHandlerHandle a request that has met the conditions. Typically, the implementation will provide optional handling and then call theConditionalHandler.nextHandler(Request, Response, Callback)method to continue handling.- Specified by:
onConditionsMetin classConditionalHandler- Parameters:
request- The request to handleresponse- The response to generatecallback- The callback for completion- Returns:
- True if this handler will complete the callback
- Throws:
Exception- If there is a problem handling- See Also:
-