Interface Handler.Singleton
- All Superinterfaces:
Destroyable, Handler, Handler.Container, Invocable, LifeCycle, Request.Handler
- All Known Implementing Classes:
BufferedResponseHandler, ConditionalHandler, ConditionalHandler.Abstract, ConditionalHandler.DontHandle, ConditionalHandler.ElseNext, ConditionalHandler.Reject, ConditionalHandler.SkipNext, ConnectHandler, ConstraintSecurityHandler, ContextHandler, ContextHandler.CoreContextHandler, ContextHandler.CoreContextHandler, CrossOriginHandler, DebugHandler, DelayedHandler, EagerFormHandler, EventsHandler, GracefulHandler, GzipHandler, Handler.Wrapper, HotSwapHandler, HttpSpiContextHandler, IdleTimeoutHandler, InetAccessHandler, LatencyRecordingHandler, MovedContextHandler, QoSHandler, ResourceHandler, ResourceHandler.ResourceContext, RewriteHandler, SecuredRedirectHandler, SecurityHandler, SecurityHandler.PathMapped, Server, ServletContextHandler, ServletHandler, SessionHandler, SessionHandler, ShutdownHandler, SizeLimitHandler, SizeLimitHandler, StateTrackingHandler, StatisticsHandler, StatisticsHandler.MinimumDataRateHandler, ThreadLimitHandler, TryPathsHandler, WebAppContext, WebSocketUpgradeHandler, WebSocketUpgradeHandler
- Enclosing interface:
Handler
A Handler.Container that can contain one single other Handler.
This is a "singleton" in the sense of Collections.singleton(Object) and not
in the sense of the singleton pattern of a single instance per JVM.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface Request.Handler
Request.Handler.AbortException -
Field Summary
Fields inherited from interface Invocable
__nonBlocking, NOOP -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlercheckHandler(Handler.Singleton singleton, Handler handler) Utility method to perform sanity checks on a {Handlerto be added to the givenSingleton.default Handler.SingletongetTail()default voidinsertHandler(Handler.Singleton handler) Inserts the givenHandler(and possible chain ofHandlers) between thisHandlerand its currentchild.default voidsetHandler(Supplier<Handler> supplier) Sets the childHandlersupplied by the givenSupplier.voidsetHandler(Handler handler) static HandlerupdateHandler(Handler.Singleton singleton, Handler handler) Utility method to perform sanity checks before updating the givenHandlerto the givenSingleton, typically used in implementations ofsetHandler(Handler).Methods inherited from interface Destroyable
destroyMethods inherited from interface Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stopMethods inherited from interface Request.Handler
getInvocationType, handle
-
Method Details
-
getHandler
- Returns:
- the child
Handler
-
setHandler
- Parameters:
handler- TheHandlerto set as a child
-
setHandler
-
getHandlers
- Specified by:
getHandlersin interfaceHandler.Container- Returns:
- an immutable collection of
Handlers directly contained by thisHandler.
-
insertHandler
Inserts the given
Handler(and possible chain ofHandlers) between thisHandlerand its currentchild.For example, if this
HandlerAhas a childB, insertingHandlerXbuilt as a chainHandlersX-Y-Zresults in the structureA-X-Y-Z-B.- Parameters:
handler- theHandlerto insert
-
getTail
- Returns:
- the tail
Handler.Singletonof a chain ofHandler.Singletons
-
updateHandler
Utility method to perform sanity checks before updating the given
Handlerto the givenSingleton, typically used in implementations ofsetHandler(Handler).The sanity checks are:
- Check for the server start state and whether the invocation type is compatible
- Check for
Handlerloops - Sets the
Serveron theHandler - Update the beans on the
Singletonif it is aContainerLifeCycle
- Parameters:
singleton- theSingletonto set theHandlerhandler- theHandlerto set- Returns:
- The
Handlerto set - See Also:
-
checkHandler
Utility method to perform sanity checks on a {
Handlerto be added to the givenSingleton.The sanity checks are:
- Check for the server start state and whether the invocation type is compatible
- Check for
Handlerloops - Sets the
Serveron theHandler - Update the beans on the
Singletonif it is aContainerLifeCycle
- Parameters:
singleton- theSingletonto set theHandlerhandler- theHandlerto set- Returns:
- The
Handlerto set
-