Class ContextHandler.CoreContextHandler
- All Implemented Interfaces:
AliasCheck,Deployable,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.ScopedContextNested classes/interfaces inherited from class org.eclipse.jetty.server.Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendableNested classes/interfaces inherited from interface org.eclipse.jetty.server.Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.ListenerNested 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_ATTRIBUTESFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.Attributes
NULLFields inherited from interface org.eclipse.jetty.server.Deployable
ATTRIBUTE_PREFIX, BASE_RESOURCE, CONFIGURATION_CLASSES, CONTAINER_SCAN_JARS, CONTEXT_HANDLER_CLASS, CONTEXT_PATH, DEFAULT_CONTEXT_PATH, DEFAULTS_DESCRIPTOR, DIR_ALLOWED, ENVIRONMENT, ENVIRONMENT_XML, EXTRACT_WARS, MAIN_PATH, OTHER_PATHS, PARENT_LOADER_PRIORITY, SCI_EXCLUSION_PATTERN, SCI_ORDER, TEMP_DIR, WAR, WEBINF_SCAN_JARSFields inherited from interface org.eclipse.jetty.util.thread.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.protected booleanhandleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) 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 org.eclipse.jetty.server.handler.ContextHandler
addAliasCheck, addEncodings, addEventListener, addMimeTypes, 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, handleMovedPermanently, handleUnavailable, initializeDefault, initializeDefaults, initializeDefaultsComplete, isAvailable, isContextPathDefault, isCrossContextDispatchSupported, isProtectedTarget, isTempDirectoryPersistent, removeAttribute, removeEventListener, removeVirtualHosts, setAliasChecks, setAllowNullPathInContext, setAttribute, setAvailable, setBaseResource, setBaseResourceAsPath, setBaseResourceAsString, setClassLoader, setCrossContextDispatchSupported, setDefaultContextPath, setDisplayName, setEncodings, setErrorHandler, setMimeTypes, setProtectedTargets, setTempDirectoryPersistent, setVirtualHosts, toString, wrapResponseMethods inherited from class org.eclipse.jetty.server.Handler.Wrapper
getHandler, getInvocationTypeMethods inherited from class org.eclipse.jetty.server.Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamicMethods inherited from class org.eclipse.jetty.server.Handler.Abstract
getServerMethods 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, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.server.Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface org.eclipse.jetty.server.Handler.Singleton
getHandlers, getTail, setHandlerMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stopMethods inherited from interface org.eclipse.jetty.server.Request.Handler
handle
-
Method Details
-
handleByContextHandler
protected boolean handleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) - Overrides:
handleByContextHandlerin classContextHandler
-
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:
AbstractLifeCycle.StopException- If thrown, the lifecycle will immediately be stopped.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
Description copied from interface:HandlerSet theServerto associate to thisHandler.- Specified by:
setServerin interfaceHandler- Overrides:
setServerin classContextHandler- Parameters:
server- theServerto associate to thisHandler
-
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.
-