Interface Context
- All Superinterfaces:
- Attributes, Decorator, Executor
- All Known Implementing Classes:
- ContextHandler.ScopedContext, ServletContextHandler.ServletScopedContext
A context for handling an Request.
Every request has a non-null context, which may initially
be the server context, or
a context provided by a ContextHandler.
A Context:
- has an optional context paththat is a prefix to all URIs handled by theContext
- has an optional list of virtual hoststhat theContextis applicable to.
- has an optional ClassLoaderthat that is set as theThread context ClassLoaderforThreads handling the request.
- is an Executorthat can execute jobs in with theThread context ClassLoader
- is a Decoratorusing theDecoratedObjectFactorythat can create objects specific to the context.
- has the same temporary directorspecific to the context.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface AttributesAttributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper
- 
Field SummaryFields inherited from interface AttributesNULL
- 
Method SummaryModifier and TypeMethodDescriptionvoidExecutes the given task in a thread scoped to this Context.default StringgetCrossContextDispatchType(Request request) Get any cross context dispatch typedefault StringgetPathInContext(String canonicallyEncodedPath) Returns the URI path scoped to this Context.static StringgetPathInContext(String encodedContextPath, String encodedPath) Returns the URI path scoped to the passed context path.default booleanisCrossContextDispatch(Request request) Check cross context dispatch statusvoidRuns the given task in the current thread scoped to this Context.voidRuns the given task in the current thread scoped to this Context and the given Request.Methods inherited from interface AttributesasAttributeMap, clearAttributes, equals, getAttribute, getAttributeNameSet, hashCode, removeAttribute, setAttribute
- 
Method Details- 
getContextPathString getContextPath()- Returns:
- the encoded context path of this Contextornull
 
- 
getClassLoaderClassLoader getClassLoader()- Returns:
- the ClassLoaderassociated with this Context
 
- 
getBaseResourceResource getBaseResource()- Returns:
- the base resource used to lookup other resources specified by the request URI path
 
- 
getErrorHandlerRequest.Handler getErrorHandler()- Returns:
- the error Request.Handlerassociated with this Context
 
- 
getVirtualHosts
- 
getMimeTypesMimeTypes getMimeTypes()- Returns:
- the mime types associated with this Context
 
- 
execute
- 
runRuns the given task in the current thread scoped to this Context. - Parameters:
- task- the task to run
- See Also:
 
- 
run
- 
getPathInContextReturns the URI path scoped to this Context. - Parameters:
- canonicallyEncodedPath- a full URI path that should be canonically encoded as per- URIUtil.canonicalPath(String)
- Returns:
- the URI path scoped to this Context, or nullif the full path does not match this Context. The empty string is returned if the full path is exactly the context path.
- See Also:
 
- 
getTempDirectoryFile getTempDirectory()- Returns:
- a non-nulltemporary directory, configured either for the context, the server or the JVM
 
- 
isCrossContextDispatchCheck cross context dispatch status- Parameters:
- request- The request to check
- Returns:
- TrueIFF this context- supports cross contextand the passed request is a cross context request.
 
- 
getCrossContextDispatchTypeGet any cross context dispatch type- Parameters:
- request- The request to get the type for
- Returns:
- A String representation of a dispatcher type iff this context
supports cross contextand the passed request is a cross context request, otherwise null.
 
- 
getPathInContextReturns the URI path scoped to the passed context path. For example, if the context path passed is /ctxthen a path of/ctx/foo/barwill return/foo/bar.- Parameters:
- encodedContextPath- The context path that should be canonically encoded as per- URIUtil.canonicalPath(String).
- encodedPath- a full URI path that should be canonically encoded as per- URIUtil.canonicalPath(String).
- Returns:
- the URI encodedPathscoped to theencodedContextPath, ornullif theencodedPathdoes not match the context. The empty string is returned if theencodedPathis exactly theencodedContextPath.
 
 
-