Class Handler.AbstractContainer

All Implemented Interfaces:
Handler, Handler.Container, Request.Handler, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Invocable
Direct Known Subclasses:
AbstractHandlerContainer, Handler.Sequence, Handler.Wrapper, HotSwapHandler, PathMappingsHandler
Enclosing interface:
Handler

@ManagedObject public abstract static class Handler.AbstractContainer extends Handler.Abstract implements Handler.Container

A Handler.Abstract that implements Handler.Container.

An Handler.AbstractContainer may be dynamic, that is allow Handlers to be added after it has been started.

If this Handler.AbstractContainer is dynamic, then its invocation type is by default Invocable.InvocationType.BLOCKING.

See Also:
  • Constructor Details

    • AbstractContainer

      protected AbstractContainer()

      Creates an instance that is dynamic.

    • AbstractContainer

      protected AbstractContainer(boolean dynamic)

      Creates an instance with the given dynamic argument.

      Parameters:
      dynamic - whether this container is dynamic
  • Method Details

    • isDynamic

      @ManagedAttribute("Whether this Handler container is dynamic") public boolean isDynamic()
      Returns:
      whether this container is dynamic
    • setDynamic

      public void setDynamic(boolean dynamic)
      Parameters:
      dynamic - whether this container is dynamic
    • getDescendants

      public <T extends Handler> List<T> getDescendants(Class<T> type)
      Specified by:
      getDescendants in interface Handler.Container
      Type Parameters:
      T - the type of the descendant Handler
      Parameters:
      type - the class of the descendant Handler
      Returns:
      an immutable collection of Handlers of the given type, descendants of this Handler
    • getDescendant

      public <T extends Handler> T getDescendant(Class<T> type)
      Specified by:
      getDescendant in interface Handler.Container
      Type Parameters:
      T - the type of the descendantHandler
      Parameters:
      type - the class of the descendant Handler
      Returns:
      the first Handler of the given type, descendants of this Handler, or null if no such Handler exist
    • setServer

      public void setServer(Server server)
      Description copied from interface: Handler
      Set the Server to associate to this Handler.
      Specified by:
      setServer in interface Handler
      Overrides:
      setServer in class Handler.Abstract
      Parameters:
      server - the Server to associate to this Handler
    • getInvocationType

      public Invocable.InvocationType getInvocationType()
      Specified by:
      getInvocationType in interface Invocable
      Specified by:
      getInvocationType in interface Request.Handler
      Overrides:
      getInvocationType in class Handler.Abstract
      Returns:
      The InvocationType of this object
    • findContainerOf

      public static <T extends Handler.Container> T findContainerOf(Handler.Container root, Class<T> type, Handler handler)