Package org.eclipse.jetty.servlet
Class BaseHolder<T>
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.servlet.BaseHolder<T>
-
- Type Parameters:
T
- the type of holder
- Direct Known Subclasses:
Holder
,ListenerHolder
public abstract class BaseHolder<T> extends AbstractLifeCycle implements Dumpable
AbstractHolder Base class for all servlet-related classes that may be lazily instantiated (eg servlet, filter, listener), and/or require metadata to be held regarding their origin (web.xml, annotation, programmatic api etc).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseHolder(Source source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doStart()
void
doStop()
java.lang.String
dump()
void
dump(java.lang.Appendable out, java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.java.lang.String
getClassName()
java.lang.Class<? extends T>
getHeldClass()
protected T
getInstance()
ServletHandler
getServletHandler()
Source
getSource()
protected void
illegalStateIfContextStarted()
void
initialize()
Do any setup necessary after startingboolean
isInstance()
void
setClassName(java.lang.String className)
void
setHeldClass(java.lang.Class<? extends T> held)
protected void
setInstance(T instance)
void
setServletHandler(ServletHandler servletHandler)
protected T
unwrap(T component)
protected <W> T
wrap(T component, java.lang.Class<W> wrapperFunctionType, java.util.function.BiFunction<W,T,T> function)
Wrap component using component specific Wrapper Function beans.-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
-
-
-
Constructor Detail
-
BaseHolder
protected BaseHolder(Source source)
-
-
Method Detail
-
getSource
public Source getSource()
-
initialize
public void initialize() throws java.lang.Exception
Do any setup necessary after starting- Throws:
java.lang.Exception
- if unable to initialize
-
doStart
public void doStart() throws java.lang.Exception
- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
java.lang.Exception
-
doStop
public void doStop() throws java.lang.Exception
- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
java.lang.Exception
-
getClassName
@ManagedAttribute(value="Class Name", readonly=true) public java.lang.String getClassName()
-
getHeldClass
public java.lang.Class<? extends T> getHeldClass()
-
getServletHandler
public ServletHandler getServletHandler()
- Returns:
- Returns the servletHandler.
-
setServletHandler
public void setServletHandler(ServletHandler servletHandler)
- Parameters:
servletHandler
- TheServletHandler
that will handle requests dispatched to this servlet.
-
setClassName
public void setClassName(java.lang.String className)
- Parameters:
className
- The className to set.
-
setHeldClass
public void setHeldClass(java.lang.Class<? extends T> held)
- Parameters:
held
- The class to hold
-
illegalStateIfContextStarted
protected void illegalStateIfContextStarted()
-
setInstance
protected void setInstance(T instance)
-
getInstance
protected T getInstance()
-
isInstance
public boolean isInstance()
- Returns:
- True if this holder was created for a specific instance.
-
wrap
protected <W> T wrap(T component, java.lang.Class<W> wrapperFunctionType, java.util.function.BiFunction<W,T,T> function)
Wrap component using component specific Wrapper Function beans.- Type Parameters:
W
- the "wrapper function" implementation. (eg:ServletHolder.WrapperFunction
orFilterHolder.WrapperFunction
, etc)- Parameters:
component
- the component to optionally wrapwrapperFunctionType
- the bean class type to look for in theServletContextHandler
function
- the BiFunction to execute for eachwrapperFunctionType
Bean found (passing in the component and component type)- Returns:
- the component that has passed through all Wrapper Function beans found.
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
-
-