|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AggregateLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandlerContainer
org.eclipse.jetty.server.handler.HandlerWrapper
org.eclipse.jetty.server.handler.ScopedHandler
org.eclipse.jetty.server.handler.ContextHandler
public class ContextHandler
ContextHandler. This handler wraps a call to handle by setting the context and servlet path, plus setting the context classloader.
If the context init parameter "org.eclipse.jetty.server.context.ManagedAttributes" is set to a comma separated list of names, then they are treated as context attribute names, which if set as attributes are passed to the servers Container so that they may be managed with JMX.
The maximum size of a form that can be processed by this context is controlled by the system properties org.eclipse.jetty.server.Request.maxFormKeys
and org.eclipse.jetty.server.Request.maxFormContentSize. These can also be configured with setMaxFormContentSize(int) and setMaxFormKeys(int)
| 嵌套类摘要 | |
|---|---|
static interface |
ContextHandler.AliasCheck
Interface to check aliases |
static class |
ContextHandler.ApproveNonExistentDirectoryAliases
Approve Aliases of a non existent directory. |
static class |
ContextHandler.ApprovePathPrefixAliases
Approve Aliases with a path prefix. |
static class |
ContextHandler.ApproveSameSuffixAliases
Approve Aliases with same suffix. |
class |
ContextHandler.Context
Context. |
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口 |
|---|
AbstractLifeCycle.AbstractLifeCycleListener |
| 从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口 |
|---|
LifeCycle.Listener |
| 字段摘要 | |
|---|---|
protected ContextHandler.Context |
_scontext
|
static String |
MANAGED_ATTRIBUTES
If a context attribute with this name is set, it is interpreted as a comma separated list of attribute name. |
| 从类 org.eclipse.jetty.server.handler.ScopedHandler 继承的字段 |
|---|
_nextScope, _outerScope |
| 从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段 |
|---|
_handler |
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段 |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| 构造方法摘要 | |
|---|---|
|
ContextHandler()
|
protected |
ContextHandler(ContextHandler.Context context)
|
|
ContextHandler(HandlerContainer parent,
String contextPath)
|
|
ContextHandler(String contextPath)
|
| 方法摘要 | |
|---|---|
void |
addAliasCheck(ContextHandler.AliasCheck check)
Add an AliasCheck instance to possibly permit aliased resources |
void |
addEventListener(EventListener listener)
Add a context event listeners. |
void |
addLocaleEncoding(String locale,
String encoding)
|
void |
addVirtualHosts(String[] virtualHosts)
Either set virtual hosts or add to an existing set of virtual hosts. |
void |
callContextDestroyed(ServletContextListener l,
ServletContextEvent e)
|
void |
callContextInitialized(ServletContextListener l,
ServletContextEvent e)
|
boolean |
checkContext(String target,
Request baseRequest,
HttpServletResponse response)
|
void |
checkManagedAttribute(String name,
Object value)
|
void |
clearAttributes()
|
void |
doHandle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
|
void |
doScope(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
|
protected void |
doStart()
Start the managed lifecycle beans in the order they were added. |
protected void |
doStop()
Stop the joined lifecycle beans in the reverse order they were added. |
void |
dump(Appendable out,
String indent)
|
List<ContextHandler.AliasCheck> |
getAliasChecks()
|
boolean |
getAllowNullPathInfo()
|
Object |
getAttribute(String name)
|
Enumeration |
getAttributeNames()
|
Attributes |
getAttributes()
|
Resource |
getBaseResource()
|
ClassLoader |
getClassLoader()
|
String |
getClassPath()
Make best effort to extract a file classpath from the context classloader |
String[] |
getConnectorNames()
|
String |
getContextPath()
|
static ContextHandler.Context |
getCurrentContext()
Get the current ServletContext implementation. |
String |
getDisplayName()
|
ErrorHandler |
getErrorHandler()
|
EventListener[] |
getEventListeners()
|
String |
getInitParameter(String name)
|
Enumeration |
getInitParameterNames()
|
Map<String,String> |
getInitParams()
|
String |
getLocaleEncoding(Locale locale)
Get the character encoding for a locale. |
String |
getLocaleEncoding(String locale)
|
Logger |
getLogger()
|
int |
getMaxFormContentSize()
|
int |
getMaxFormKeys()
|
MimeTypes |
getMimeTypes()
|
String[] |
getProtectedTargets()
|
Resource |
getResource(String path)
|
String |
getResourceBase()
|
Set<String> |
getResourcePaths(String path)
|
ContextHandler.Context |
getServletContext()
|
String[] |
getVirtualHosts()
Get the virtual hosts for the context. |
String[] |
getWelcomeFiles()
|
void |
handle(Runnable runnable)
|
boolean |
isAliases()
|
boolean |
isAvailable()
|
boolean |
isCompactPath()
|
boolean |
isProtectedTarget(String target)
Check the target. |
boolean |
isShutdown()
|
Class<?> |
loadClass(String className)
|
Resource |
newResource(String urlOrPath)
Convert a URL or path to a Resource. |
Resource |
newResource(URL url)
Convert URL to Resource wrapper for Resource.newResource(URL) enables extensions to provide alternate resource implementations. |
void |
removeAttribute(String name)
|
void |
removeVirtualHosts(String[] virtualHosts)
Removes an array of virtual host entries, if this removes all entries the _vhosts will be set to null |
void |
restrictEventListener(EventListener listener)
Apply any necessary restrictions on a programmatically added listener. |
void |
setAliases(boolean aliases)
|
void |
setAllowNullPathInfo(boolean allowNullPathInfo)
|
void |
setAttribute(String name,
Object value)
|
void |
setAttributes(Attributes attributes)
|
void |
setAvailable(boolean available)
Set Available status. |
void |
setBaseResource(Resource base)
|
void |
setClassLoader(ClassLoader classLoader)
|
void |
setCompactPath(boolean compactPath)
|
void |
setConnectorNames(String[] connectors)
Set the names of accepted connectors. |
void |
setContextPath(String contextPath)
|
void |
setDisplayName(String servletContextName)
|
void |
setErrorHandler(ErrorHandler errorHandler)
|
void |
setEventListeners(EventListener[] eventListeners)
Set the context event listeners. |
String |
setInitParameter(String name,
String value)
|
void |
setLogger(Logger logger)
|
void |
setManagedAttribute(String name,
Object value)
|
void |
setMaxFormContentSize(int maxSize)
Set the maximum size of a form post, to protect against DOS attacks from large forms. |
void |
setMaxFormKeys(int max)
Set the maximum number of form Keys to protect against DOS attack from crafted hash keys. |
void |
setMimeTypes(MimeTypes mimeTypes)
|
void |
setProtectedTargets(String[] targets)
|
void |
setResourceBase(String resourceBase)
|
void |
setServer(Server server)
|
void |
setShutdown(boolean shutdown)
Set shutdown status. |
void |
setVirtualHosts(String[] vhosts)
Set the virtual hosts for the context. |
void |
setWelcomeFiles(String[] files)
|
protected void |
startContext()
Extensible startContext. this method is called from doStart() instead of a call to super.doStart(). |
String |
toString()
|
| 从类 org.eclipse.jetty.server.handler.ScopedHandler 继承的方法 |
|---|
handle, never, nextHandle, nextScope |
| 从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法 |
|---|
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler |
| 从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法 |
|---|
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
| 从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法 |
|---|
dumpThis, getServer |
| 从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法 |
|---|
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage |
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法 |
|---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 从接口 org.eclipse.jetty.server.Handler 继承的方法 |
|---|
destroy, getServer, handle |
| 从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法 |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| 字段详细信息 |
|---|
public static final String MANAGED_ATTRIBUTES
setManagedAttribute(String, Object), which typically initiates the creation of a JMX MBean
for the attribute value.
protected ContextHandler.Context _scontext
| 构造方法详细信息 |
|---|
public ContextHandler()
protected ContextHandler(ContextHandler.Context context)
public ContextHandler(String contextPath)
public ContextHandler(HandlerContainer parent,
String contextPath)
| 方法详细信息 |
|---|
public static ContextHandler.Context getCurrentContext()
public void dump(Appendable out,
String indent)
throws IOException
Dumpable 中的 dumpAbstractHandlerContainer 中的 dumpIOExceptionpublic ContextHandler.Context getServletContext()
public boolean getAllowNullPathInfo()
public void setAllowNullPathInfo(boolean allowNullPathInfo)
allowNullPathInfo - true if /context is not redirected to /context/public void setServer(Server server)
Handler 中的 setServerHandlerWrapper 中的 setServerpublic void setVirtualHosts(String[] vhosts)
vhosts - Array of virtual hosts that this context responds to. A null host name or null/empty array means any hostname is acceptable. Host names may be
String representation of IP addresses. Host names may start with '*.' to wildcard one level of names.public void addVirtualHosts(String[] virtualHosts)
virtualHosts - Array of virtual hosts that this context responds to. A null host name or null/empty array means any hostname is acceptable. Host names may be
String representation of IP addresses. Host names may start with '*.' to wildcard one level of names.public void removeVirtualHosts(String[] virtualHosts)
virtualHosts - Array of virtual hosts that this context responds to. A null host name or null/empty array means any hostname is acceptable. Host names may be
String representation of IP addresses. Host names may start with '*.' to wildcard one level of names.public String[] getVirtualHosts()
public String[] getConnectorNames()
public void setConnectorNames(String[] connectors)
connectors - If non null, an array of connector names that this context will accept a request from.public Object getAttribute(String name)
Attributes 中的 getAttributepublic Enumeration getAttributeNames()
Attributes 中的 getAttributeNamespublic Attributes getAttributes()
public ClassLoader getClassLoader()
public String getClassPath()
public String getContextPath()
public String getInitParameter(String name)
public String setInitParameter(String name,
String value)
public Enumeration getInitParameterNames()
public Map<String,String> getInitParams()
public String getDisplayName()
public EventListener[] getEventListeners()
public void setEventListeners(EventListener[] eventListeners)
eventListeners - the event listenersServletContextListener,
ServletContextAttributeListener,
ServletRequestListener,
ServletRequestAttributeListenerpublic void addEventListener(EventListener listener)
ServletContextListener,
ServletContextAttributeListener,
ServletRequestListener,
ServletRequestAttributeListenerpublic void restrictEventListener(EventListener listener)
listener - public boolean isShutdown()
public void setShutdown(boolean shutdown)
Server.Graceful 中的 setShutdownshutdown - true if this context is (not?) accepting new requestspublic boolean isAvailable()
public void setAvailable(boolean available)
public Logger getLogger()
public void setLogger(Logger logger)
protected void doStart()
throws Exception
AggregateLifeCycle 复制的描述
ScopedHandler 中的 doStartExceptionHandlerWrapper.doStart()
protected void startContext()
throws Exception
doStart() instead of a call to super.doStart(). This allows derived classes to
insert additional handling (Eg configuration) before the call to super.doStart by this method will start contained handlers.
ExceptionContextHandler.Context
public void callContextInitialized(ServletContextListener l,
ServletContextEvent e)
public void callContextDestroyed(ServletContextListener l,
ServletContextEvent e)
protected void doStop()
throws Exception
AggregateLifeCycle 复制的描述
HandlerWrapper 中的 doStopExceptionAbstractLifeCycle.doStart()
public boolean checkContext(String target,
Request baseRequest,
HttpServletResponse response)
throws IOException,
ServletException
IOException
ServletException
public void doScope(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,
ServletException
ScopedHandler 中的 doScopeIOException
ServletExceptionScopedHandler.doScope(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
public void doHandle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,
ServletException
ScopedHandler 中的 doHandleIOException
ServletExceptionScopedHandler.doHandle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)public void handle(Runnable runnable)
public boolean isProtectedTarget(String target)
ScopedHandler.handle(String, Request, HttpServletRequest, HttpServletResponse) when a target within a context is determined. If
the target is protected, 404 is returned.
public void setProtectedTargets(String[] targets)
public String[] getProtectedTargets()
public void removeAttribute(String name)
Attributes 中的 removeAttribute
public void setAttribute(String name,
Object value)
Attributes 中的 setAttributepublic void setAttributes(Attributes attributes)
attributes - The attributes to set.public void clearAttributes()
Attributes 中的 clearAttributes
public void checkManagedAttribute(String name,
Object value)
public void setManagedAttribute(String name,
Object value)
public void setClassLoader(ClassLoader classLoader)
classLoader - The classLoader to set.public void setContextPath(String contextPath)
contextPath - The _contextPath to set.public void setDisplayName(String servletContextName)
servletContextName - The servletContextName to set.public Resource getBaseResource()
public String getResourceBase()
public void setBaseResource(Resource base)
base - The resourceBase to set.public void setResourceBase(String resourceBase)
resourceBase - The base resource as a string.public boolean isAliases()
public void setAliases(boolean aliases)
aliases - aliases are allowedpublic MimeTypes getMimeTypes()
public void setMimeTypes(MimeTypes mimeTypes)
mimeTypes - The mimeTypes to set.public void setWelcomeFiles(String[] files)
public String[] getWelcomeFiles()
setWelcomeFiles(java.lang.String[])public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
errorHandler - The errorHandler to set.public int getMaxFormContentSize()
public void setMaxFormContentSize(int maxSize)
maxSize - public int getMaxFormKeys()
public void setMaxFormKeys(int max)
max - public boolean isCompactPath()
public void setCompactPath(boolean compactPath)
compactPath - True if URLs are compacted to replace multiple '/'s with a single '/'public String toString()
Object 中的 toString
public Class<?> loadClass(String className)
throws ClassNotFoundException
ClassNotFoundException
public void addLocaleEncoding(String locale,
String encoding)
public String getLocaleEncoding(String locale)
public String getLocaleEncoding(Locale locale)
locale - a Locale value
String representing the character encoding for the locale or null if none found.
public Resource getResource(String path)
throws MalformedURLException
MalformedURLException
public Resource newResource(URL url)
throws IOException
Resource.newResource(URL) enables extensions to provide alternate resource implementations.
IOException
public Resource newResource(String urlOrPath)
throws IOException
Resource.newResource(String).
urlOrPath - The URL or path to convert
IOException - The Resource could not be created.public Set<String> getResourcePaths(String path)
public void addAliasCheck(ContextHandler.AliasCheck check)
check - The alias checkerpublic List<ContextHandler.AliasCheck> getAliasChecks()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||