Class ContextHandler.CoreContextHandler
- All Implemented Interfaces:
AliasCheck, Handler, Handler.Container, Handler.Singleton, Request.Handler, Attributes, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Invocable
- Enclosing class:
ContextHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class ContextHandler
ContextHandler.Availability, ContextHandler.ContextScopeListener, ContextHandler.ScopedContextNested classes/interfaces inherited from class Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.WrapperNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface Request.Handler
Request.Handler.AbortException -
Field Summary
Fields inherited from class ContextHandler
CROSS_CONTEXT_ATTRIBUTE, MANAGED_ATTRIBUTESFields inherited from interface Attributes
NULLFields inherited from interface Invocable
__nonBlocking, NOOP -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the temporary directory.protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.Get the immutable set of attribute names.Create a canonical name for a context temp directory.voidinsertHandler(Handler.Singleton handler) Inserts the givenHandler(and possible chain ofHandlers) between thisHandlerand its currentchild.voidGenerate a reasonable name for the temp directory because one has not been explicitly configured by the user withContextHandler.setTempDirectory(File).protected ContextHandler.ScopedContextprotected voidnotifyEnterScope(Request coreRequest) protected voidnotifyExitScope(Request coreRequest) voidsetContextPath(String contextPath) voidsetHandler(Handler handler) voidSet theServerto associate to thisHandler.voidsetTempDirectory(File dir) Set the temporary directory returned byContextHandler.ScopedContext.getTempDirectory().protected ContextRequestwrapRequest(Request request, Response response) Methods inherited from class ContextHandler
addAliasCheck, addEventListener, addVirtualHosts, checkAlias, checkVirtualHost, cleanupAfterStop, clearAliasChecks, clearAttributes, destroy, dump, enterScope, exitScope, getAliasChecks, getAllowNullPathInContext, getAttribute, getBaseName, getBaseResource, getClassLoader, getClassPath, getContext, getContextHandler, getContextPath, getCrossContextHandler, getCurrentContext, getCurrentContext, getCurrentContextHandler, getDisplayName, getErrorHandler, getMimeTypes, getProtectedTargets, getTempDirectory, getVirtualHosts, handle, handleByContextHandler, handleMovedPermanently, handleUnavailable, isAvailable, isCrossContextDispatchSupported, isProtectedTarget, isTempDirectoryPersistent, removeAttribute, removeEventListener, removeVirtualHosts, setAliasChecks, setAllowNullPathInContext, setAttribute, setAvailable, setBaseResource, setBaseResourceAsPath, setBaseResourceAsString, setClassLoader, setCrossContextDispatchSupported, setDisplayName, setErrorHandler, setProtectedTargets, setTempDirectoryPersistent, setVirtualHosts, toString, wrapResponseMethods inherited from class Handler.Wrapper
getHandler, getInvocationTypeMethods inherited from class Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamicMethods inherited from class Handler.Abstract
getServerMethods inherited from class ContainerLifeCycle
addBean, addBean, addManaged, contains, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface Handler.Singleton
getHandlers, getTail, setHandlerMethods inherited from interface LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stopMethods inherited from interface Request.Handler
getInvocationType, handle
-
Method Details
-
makeTempDirectory
Description copied from class:ContextHandlerGenerate a reasonable name for the temp directory because one has not been explicitly configured by the user withContextHandler.setTempDirectory(File). The directory may also be created, if it is not persistent. If it is persistent it will be created as necessary byContextHandler.createTempDirectory()later during the startup of the context.- Overrides:
makeTempDirectoryin classContextHandler- Throws:
Exception- IllegalStateException if the parent tmp directory does not exist, or IOException if the child tmp directory cannot be created.
-
getCanonicalNameForTmpDir
Description copied from class:ContextHandlerCreate a canonical name for a context temp directory.The form of the name is:
"jetty-"+host+"-"+port+"-"+resourceBase+"-_"+context+"-"+virtualhost+"-"+randomdigits+".dir"
host and port uniquely identify the server context and virtual host uniquely identify the context randomdigits ensure every tmp directory is unique- Overrides:
getCanonicalNameForTmpDirin classContextHandler- Returns:
- the canonical name for the context temp directory
-
getResourceForTempDirName
- Overrides:
getResourceForTempDirNamein classContextHandler- Returns:
- the baseResource for the context to use in the temp dir name
-
setTempDirectory
Description copied from class:ContextHandlerSet the temporary directory returned by
ContextHandler.ScopedContext.getTempDirectory(). If not set here, then theServer.getTempDirectory()is returned byContextHandler.ScopedContext.getTempDirectory().If
ContextHandler.isTempDirectoryPersistent()is true, the directory set here is used directly but may be created if it does not exist. IfContextHandler.isTempDirectoryPersistent()is false, then anyFileset here will be deleted and recreated as a directory duringAbstractLifeCycle.start()and will be deleted duringAbstractLifeCycle.stop().- Overrides:
setTempDirectoryin classContextHandler- Parameters:
dir- A directory. If it does not exist, it must be able to be created during start.- See Also:
-
setContextPath
- Overrides:
setContextPathin classContextHandler- Parameters:
contextPath- The _contextPath to set.
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContextHandler- Throws:
Exception- If there was a problem starting. Will cause a transition to FAILED state
-
createTempDirectory
public void createTempDirectory()Description copied from class:ContextHandlerCreate the temporary directory. If the directory exists, but is not persistent, then it is first deleted and then recreated. Once created, this method is a noop if called again before stopping the context.
- Overrides:
createTempDirectoryin classContextHandler
-
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classContextHandler- Throws:
Exception- If there was a problem stopping. Will cause a transition to FAILED state
-
insertHandler
Description copied from interface:Handler.SingletonInserts the given
Handler(and possible chain ofHandlers) between thisHandlerand its currentchild.For example, if this
HandlerAhas a childB, insertingHandlerXbuilt as a chainHandlersX-Y-Zresults in the structureA-X-Y-Z-B.- Specified by:
insertHandlerin interfaceHandler.Singleton- Parameters:
handler- theHandlerto insert
-
setHandler
- Specified by:
setHandlerin interfaceHandler.Singleton- Overrides:
setHandlerin classHandler.Wrapper- Parameters:
handler- TheHandlerto set as a child
-
setServer
-
newContext
- Overrides:
newContextin classContextHandler
-
wrapRequest
- Overrides:
wrapRequestin classContextHandler
-
notifyEnterScope
- Overrides:
notifyEnterScopein classContextHandler- Parameters:
coreRequest- A request that is applicable to the scope, or null
-
notifyExitScope
- Overrides:
notifyExitScopein classContextHandler- Parameters:
coreRequest- A request that is applicable to the scope, or null
-
getContextHandler
-
getAttributeNameSet
Description copied from interface:AttributesGet the immutable set of attribute names.- Specified by:
getAttributeNameSetin interfaceAttributes- Overrides:
getAttributeNameSetin classContextHandler- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-