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
,ServletContainerInitializerHolder
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.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected T
void
doStart()
Method to override to start the lifecyclevoid
doStop()
Method to override to stop the lifecycledump()
void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected T
javax.servlet.ServletContext
protected void
void
Do any setup necessary after startingboolean
void
setClassName
(String className) void
setHeldClass
(Class<? extends T> held) protected void
setInstance
(T instance) void
setServletHandler
(ServletHandler servletHandler) protected T
protected <W> T
Wrap component using component specific Wrapper Function beans.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 Details
-
BaseHolder
-
-
Method Details
-
getSource
-
initialize
Do any setup necessary after starting- Throws:
Exception
- if unable to initialize
-
doStart
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
getClassName
-
getHeldClass
-
getServletHandler
- Returns:
- Returns the servletHandler.
-
setServletHandler
- Parameters:
servletHandler
- TheServletHandler
that will handle requests dispatched to this servlet.
-
setClassName
- Parameters:
className
- The className to set.
-
setHeldClass
- Parameters:
held
- The class to hold
-
illegalStateIfContextStarted
protected void illegalStateIfContextStarted() -
setInstance
-
getInstance
-
createInstance
- Throws:
Exception
-
getServletContext
public javax.servlet.ServletContext getServletContext() -
isInstance
public boolean isInstance()- Returns:
- True if this holder was created for a specific instance.
-
wrap
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.
-
unwrap
-
dump
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.- Specified by:
dump
in interfaceDumpable
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
dump
-