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 org.eclipse.jetty.server.handler.ContextHandler
ContextHandler.Availability, ContextHandler.ContextScopeListener, ContextHandler.ScopedContext
Nested classes/interfaces inherited from class org.eclipse.jetty.server.Handler.Abstract
Handler.Abstract.NonBlocking
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.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Request.Handler
Request.Handler.AbortException
-
Field Summary
Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler
CROSS_CONTEXT_ATTRIBUTE, MANAGED_ATTRIBUTES
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPING
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULL
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Create the temporary directory.protected void
doStart()
Starts the managed lifecycle beans in the order they were added.protected void
doStop()
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.void
insertHandler
(Handler.Singleton handler) Inserts the givenHandler
(and possible chain ofHandler
s) between thisHandler
and its currentchild
.void
Generate a reasonable name for the temp directory because one has not been explicitly configured by the user withContextHandler.setTempDirectory(File)
.protected ContextHandler.ScopedContext
protected void
notifyEnterScope
(Request coreRequest) protected void
notifyExitScope
(Request coreRequest) void
setContextPath
(String contextPath) void
setHandler
(Handler handler) void
Set theServer
to associate to thisHandler
.void
setTempDirectory
(File dir) Set the temporary directory returned byContextHandler.ScopedContext.getTempDirectory()
.protected ContextRequest
wrapRequest
(Request request, Response response) Methods inherited from class org.eclipse.jetty.server.handler.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, wrapResponse
Methods inherited from class org.eclipse.jetty.server.Handler.Wrapper
getHandler, getInvocationType
Methods inherited from class org.eclipse.jetty.server.Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamic
Methods inherited from class org.eclipse.jetty.server.Handler.Abstract
getServer
Methods inherited from class org.eclipse.jetty.util.component.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, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, equals, hashCode
Methods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListeners
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
Methods inherited from interface org.eclipse.jetty.server.Handler.Container
getContainer, getDescendant, getDescendants, getDescendants
Methods inherited from interface org.eclipse.jetty.server.Handler.Singleton
getHandlers, getTail, setHandler
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop
Methods inherited from interface org.eclipse.jetty.server.Request.Handler
getInvocationType, handle
-
Method Details
-
makeTempDirectory
Description copied from class:ContextHandler
Generate 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:
makeTempDirectory
in 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:ContextHandler
Create 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:
getCanonicalNameForTmpDir
in classContextHandler
- Returns:
- the canonical name for the context temp directory
-
getResourceForTempDirName
- Overrides:
getResourceForTempDirName
in classContextHandler
- Returns:
- the baseResource for the context to use in the temp dir name
-
setTempDirectory
Description copied from class:ContextHandler
Set 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 anyFile
set here will be deleted and recreated as a directory duringAbstractLifeCycle.start()
and will be deleted duringAbstractLifeCycle.stop()
.- Overrides:
setTempDirectory
in classContextHandler
- Parameters:
dir
- A directory. If it does not exist, it must be able to be created during start.- See Also:
-
setContextPath
- Overrides:
setContextPath
in classContextHandler
- Parameters:
contextPath
- The _contextPath to set.
-
doStart
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContextHandler
- Throws:
Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
createTempDirectory
public void createTempDirectory()Description copied from class:ContextHandler
Create 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:
createTempDirectory
in classContextHandler
-
doStop
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContextHandler
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
insertHandler
Description copied from interface:Handler.Singleton
Inserts the given
Handler
(and possible chain ofHandler
s) between thisHandler
and its currentchild
.For example, if this
Handler
A
has a childB
, insertingHandler
X
built as a chainHandler
sX-Y-Z
results in the structureA-X-Y-Z-B
.- Specified by:
insertHandler
in interfaceHandler.Singleton
- Parameters:
handler
- theHandler
to insert
-
setHandler
- Specified by:
setHandler
in interfaceHandler.Singleton
- Overrides:
setHandler
in classHandler.Wrapper
- Parameters:
handler
- TheHandler
to set as a child
-
setServer
Description copied from interface:Handler
Set theServer
to associate to thisHandler
.- Specified by:
setServer
in interfaceHandler
- Overrides:
setServer
in classContextHandler
- Parameters:
server
- theServer
to associate to thisHandler
-
newContext
- Overrides:
newContext
in classContextHandler
-
wrapRequest
- Overrides:
wrapRequest
in classContextHandler
-
notifyEnterScope
- Overrides:
notifyEnterScope
in classContextHandler
- Parameters:
coreRequest
- A request that is applicable to the scope, or null
-
notifyExitScope
- Overrides:
notifyExitScope
in classContextHandler
- Parameters:
coreRequest
- A request that is applicable to the scope, or null
-
getContextHandler
-
getAttributeNameSet
Description copied from interface:Attributes
Get the immutable set of attribute names.- Specified by:
getAttributeNameSet
in interfaceAttributes
- Overrides:
getAttributeNameSet
in classContextHandler
- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-