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, 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, StateTrackingHandler, StatisticsHandler, StatisticsHandler.MinimumDataRateHandler, ThreadLimitHandler, TryPathsHandler, WebAppContext, WebSocketUpgradeHandler, WebSocketUpgradeHandler
Enclosing interface:
Handler

@ManagedObject public static interface Handler.Singleton extends Handler.Container

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:
  • Method Details

    • getHandler

      @ManagedAttribute(value="The child Handler of this Container", readonly=true) Handler getHandler()
      Returns:
      the child Handler
    • setHandler

      void setHandler(Handler handler)
      Parameters:
      handler - The Handler to set as a child
    • setHandler

      default void setHandler(Supplier<Handler> supplier)

      Sets the child Handler supplied by the given Supplier.

      Parameters:
      supplier - the Handler supplier
    • getHandlers

      default List<Handler> getHandlers()
      Specified by:
      getHandlers in interface Handler.Container
      Returns:
      an immutable collection of Handlers directly contained by this Handler.
    • insertHandler

      default void insertHandler(Handler.Singleton handler)

      Inserts the given Handler (and possible chain of Handlers) between this Handler and its current child.

      For example, if this Handler A has a child B, inserting Handler X built as a chain Handlers X-Y-Z results in the structure A-X-Y-Z-B.

      Parameters:
      handler - the Handler to insert
    • getTail

      default Handler.Singleton getTail()
      Returns:
      the tail Handler.Singleton of a chain of Handler.Singletons
    • updateHandler

      static Handler updateHandler(Handler.Singleton singleton, Handler handler)

      Utility method to perform sanity checks before updating the given Handler to the given Singleton, typically used in implementations of setHandler(Handler).

      The sanity checks are:

      • Check for the server start state and whether the invocation type is compatible
      • Check for Handler loops
      • Sets the Server on the Handler
      • Update the beans on the Singleton if it is a ContainerLifeCycle
      Parameters:
      singleton - the Singleton to set the Handler
      handler - the Handler to set
      Returns:
      The Handler to set
      See Also:
    • checkHandler

      static Handler checkHandler(Handler.Singleton singleton, Handler handler)

      Utility method to perform sanity checks on a {Handler to be added to the given Singleton.

      The sanity checks are:

      • Check for the server start state and whether the invocation type is compatible
      • Check for Handler loops
      • Sets the Server on the Handler
      • Update the beans on the Singleton if it is a ContainerLifeCycle
      Parameters:
      singleton - the Singleton to set the Handler
      handler - the Handler to set
      Returns:
      The Handler to set