Package org.eclipse.jetty.server.handler
Class MovedContextHandler
- All Implemented Interfaces:
AliasCheck
,Handler
,Handler.Container
,Handler.Singleton
,Request.Handler
,Attributes
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,Invocable
A ContextHandler
with a child Handler
that redirects to a configurable URI.
-
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet theCache-Control
header value ornull
.Get the URI to redirect to.int
Get the redirect status code, by default 303.boolean
boolean
void
setCacheControl
(String cacheControl) Set theCache-Control
header value ornull
.void
setDiscardPathInContext
(boolean discardPathInContext) Whether to discard the original requestpathInContext
when building the redirect URI.void
setDiscardQuery
(boolean discardQuery) Whether to discard the original request query when building the redirect URI.void
setRedirectURI
(String redirectURI) Sets the URI to redirect to.void
setStatusCode
(int statusCode) Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler
addAliasCheck, addEventListener, 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, isAvailable, isCrossContextDispatchSupported, isProtectedTarget, isTempDirectoryPersistent, makeTempDirectory, newContext, notifyEnterScope, notifyExitScope, removeAttribute, removeEventListener, removeVirtualHosts, setAliasChecks, setAllowNullPathInContext, setAttribute, setAvailable, setBaseResource, setBaseResourceAsPath, setBaseResourceAsString, setClassLoader, setContextPath, setCrossContextDispatchSupported, setDisplayName, setErrorHandler, 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
-
MovedContextHandler
public MovedContextHandler()
-
-
Method Details
-
getStatusCode
public int getStatusCode()Get the redirect status code, by default 303.- Returns:
- the redirect status code, by default 303
-
setStatusCode
public void setStatusCode(int statusCode) - Parameters:
statusCode
- the redirect status code- Throws:
IllegalArgumentException
- if the status code is not of type redirect (3xx)
-
getRedirectURI
Get the URI to redirect to.- Returns:
- the URI to redirect to
-
setRedirectURI
Sets the URI to redirect to.
If the redirect URI is not absolute, the original request scheme and authority will be used to build the redirect URI.
The original request
pathInContext
will be appended to the redirect URI path, unlessisDiscardPathInContext()
.The original request query will be preserved in the redirect URI, unless
isDiscardQuery()
.- Parameters:
redirectURI
- the URI to redirect to
-
isDiscardPathInContext
public boolean isDiscardPathInContext()- Returns:
- whether the original request
pathInContext
is discarded
-
setDiscardPathInContext
public void setDiscardPathInContext(boolean discardPathInContext) Whether to discard the original request
pathInContext
when building the redirect URI.- Parameters:
discardPathInContext
- whether the original requestpathInContext
is discarded- See Also:
-
isDiscardQuery
public boolean isDiscardQuery()- Returns:
- whether the original request query is discarded
-
setDiscardQuery
public void setDiscardQuery(boolean discardQuery) Whether to discard the original request query when building the redirect URI.
- Parameters:
discardQuery
- whether the original request query is discarded
-
getCacheControl
Get theCache-Control
header value ornull
.- Returns:
- the
Cache-Control
header value ornull
-
setCacheControl
Set theCache-Control
header value ornull
.- Parameters:
cacheControl
- theCache-Control
header value ornull
-