- 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, AbstractLifeCycle.StopException
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseHolder(Source source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TcreateInstance()voiddoStart()Method to override to start the lifecyclevoiddoStop()Method to override to stop the lifecyclejava.lang.Stringdump()voiddump(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.StringgetClassName()java.lang.Class<? extends T>getHeldClass()protected TgetInstance()javax.servlet.ServletContextgetServletContext()ServletHandlergetServletHandler()SourcegetSource()protected voidillegalStateIfContextStarted()voidinitialize()Do any setup necessary after startingbooleanisInstance()voidsetClassName(java.lang.String className)voidsetHeldClass(java.lang.Class<? extends T> held)protected voidsetInstance(T instance)voidsetServletHandler(ServletHandler servletHandler)-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toString
-
-
-
-
Constructor Detail
-
BaseHolder
protected BaseHolder(Source source)
-
-
Method Detail
-
getSource
public Source getSource()
-
initialize
public void initialize() throws java.lang.ExceptionDo any setup necessary after starting- Throws:
java.lang.Exception- if unable to initialize
-
doStart
public void doStart() throws java.lang.ExceptionDescription copied from class:AbstractLifeCycleMethod to override to start the lifecycle- Overrides:
doStartin classAbstractLifeCycle- Throws:
AbstractLifeCycle.StopException- If thrown, the lifecycle will immediately be stopped.java.lang.Exception- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
public void doStop() throws java.lang.ExceptionDescription copied from class:AbstractLifeCycleMethod to override to stop the lifecycle- Overrides:
doStopin classAbstractLifeCycle- Throws:
java.lang.Exception- If there was a problem stopping. Will cause a transition to FAILED state
-
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- TheServletHandlerthat 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()
-
createInstance
protected T createInstance() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getServletContext
public javax.servlet.ServletContext getServletContext()
-
isInstance
public boolean isInstance()
- Returns:
- True if this holder was created for a specific instance.
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOExceptionDescription copied from interface:DumpableDump 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.
-
-