Class StaticAppContext
- All Implemented Interfaces:
AliasCheck
,Deployable
,Handler
,Handler.Container
,Handler.Singleton
,Request.Handler
,Attributes
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,Invocable
A
ContextHandler
that only serves static content from any source supported by ResourceHandler
.
To set the directory to serve content from, set the base resource via the following methods.
setBaseResource(Resource)
ContextHandler.setBaseResourceAsPath(Path)
ContextHandler.setBaseResourceAsString(String)
This is basically just a ResourceHandler
with a context-path.
-
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, Dumpable.DumpAppendable
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.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_JARS
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a StaticAppContext.StaticAppContext
(String contextPath) Create a StaticAppContext on a specific contextPath.StaticAppContext
(String contextPath, ResourceHandler resourceHandler) Create a StaticAppContext on a specific contextPath using a configured ResourceHandler. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
initializeDefault
(String keyName, Object value) Called for each attribute key encountered during theDeployable.initializeDefaults(Attributes)
processing.protected ResourceHandler
Override to customize a dynamically created ResourceHandler (such as from deploy).void
setBaseResource
(Resource baseResource) Set the base resource to serve content from for this context, which must exist and be readable when the context is started.Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler
addAliasCheck, addEncodings, addEventListener, addMimeTypes, addVirtualHosts, checkAlias, checkVirtualHost, cleanupAfterStop, clearAliasChecks, clearAttributes, createTempDirectory, destroy, doStart, doStop, dump, enterScope, exitScope, getAliasChecks, getAllowNullPathInContext, getAttribute, getAttributeNameSet, getBaseName, getBaseResource, getCanonicalNameForTmpDir, getClassLoader, getClassPath, getContext, getContextHandler, getContextPath, getCrossContextHandler, getCurrentContext, getCurrentContext, getCurrentContextHandler, getDisplayName, getErrorHandler, getMimeTypes, getProtectedTargets, getResourceForTempDirName, getTempDirectory, getVirtualHosts, handle, handleByContextHandler, handleMovedPermanently, handleUnavailable, initializeDefaults, initializeDefaultsComplete, isAvailable, isContextPathDefault, isCrossContextDispatchSupported, isProtectedTarget, isTempDirectoryPersistent, makeTempDirectory, newContext, notifyEnterScope, notifyExitScope, removeAttribute, removeEventListener, removeVirtualHosts, setAliasChecks, setAllowNullPathInContext, setAttribute, setAvailable, setBaseResourceAsPath, setBaseResourceAsString, setClassLoader, setContextPath, setCrossContextDispatchSupported, setDefaultContextPath, setDisplayName, setEncodings, setErrorHandler, setMimeTypes, setProtectedTargets, setServer, setTempDirectory, setTempDirectoryPersistent, setVirtualHosts, toString, wrapRequest, wrapResponse
Methods inherited from class org.eclipse.jetty.server.Handler.Wrapper
getHandler, getInvocationType, setHandler
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, insertHandler, setHandler
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop
-
Constructor Details
-
StaticAppContext
public StaticAppContext()Create a StaticAppContext. -
StaticAppContext
Create a StaticAppContext on a specific contextPath.- Parameters:
contextPath
- the context path to serve static content from
-
StaticAppContext
Create a StaticAppContext on a specific contextPath using a configured ResourceHandler.- Parameters:
contextPath
- the context pathresourceHandler
- the resource handler
-
-
Method Details
-
newResourceHandler
Override to customize a dynamically created ResourceHandler (such as from deploy).- Returns:
- the customized ResourceHandler.
-
getResourceHandler
-
initializeDefault
Description copied from class:ContextHandler
Called for each attribute key encountered during theDeployable.initializeDefaults(Attributes)
processing.- Overrides:
initializeDefault
in classContextHandler
- Parameters:
keyName
- the key namevalue
- the value
-
setBaseResource
Description copied from class:ContextHandler
Set the base resource to serve content from for this context, which must exist and be readable when the context is started.
- Overrides:
setBaseResource
in classContextHandler
- Parameters:
baseResource
- The base resource for the context.
-