类 DefaultServletHttpRequestHandler
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,HttpRequestHandler,ServletContextAware
HttpRequestHandler for serving static files using the Servlet container's "default" Servlet.
This handler is intended to be used with a "/*" mapping when the
DispatcherServlet
is mapped to "/", thus overriding the Servlet container's default handling of static resources.
The mapping to this handler should generally be ordered as the last in the chain so that it will
only execute when no other more specific mappings (i.e., to controllers) can be matched.
Requests are handled by forwarding through the RequestDispatcher obtained via the
name specified through the "defaultServletName" property.
In most cases, the defaultServletName does not need to be set explicitly, as the
handler checks at initialization time for the presence of the default Servlet of well-known
containers such as Tomcat, Jetty, Resin, WebLogic and WebSphere. However, when running in a
container where the default Servlet's name is not known, or where it has been customized
via server configuration, the defaultServletName will need to be set explicitly.
- 从以下版本开始:
- 4.0
- 作者:
- Jeremy Grelle, Juergen Hoeller, Harry Yang
-
字段概要
字段修饰符和类型字段说明private static final StringDefault Servlet name used by Tomcat, Jetty, JBoss, and GlassFish.private Stringprivate static final StringDefault Servlet name used by Google App Engine.private static final StringDefault Servlet name used by Resin.private ServletContextprivate static final StringDefault Servlet name used by WebLogic.private static final StringDefault Servlet name used by WebSphere.从接口继承的字段 cn.taketoday.web.HttpRequestHandler
NONE_RETURN_VALUE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明handleRequest(RequestContext request) Process the request and return a result object which the DispatcherHandler will handle.voidsetDefaultServletName(String defaultServletName) Set the name of the default Servlet to be forwarded to for static resource requests.voidsetServletContext(ServletContext servletContext) If thedefaultServletNameproperty has not been explicitly set, attempts to locate the default Servlet using the known common container-specific names.
-
字段详细资料
-
COMMON_DEFAULT_SERVLET_NAME
Default Servlet name used by Tomcat, Jetty, JBoss, and GlassFish.- 另请参阅:
-
GAE_DEFAULT_SERVLET_NAME
Default Servlet name used by Google App Engine.- 另请参阅:
-
RESIN_DEFAULT_SERVLET_NAME
Default Servlet name used by Resin.- 另请参阅:
-
WEBLOGIC_DEFAULT_SERVLET_NAME
Default Servlet name used by WebLogic.- 另请参阅:
-
WEBSPHERE_DEFAULT_SERVLET_NAME
Default Servlet name used by WebSphere.- 另请参阅:
-
defaultServletName
-
servletContext
-
-
构造器详细资料
-
DefaultServletHttpRequestHandler
public DefaultServletHttpRequestHandler()
-
-
方法详细资料
-
setDefaultServletName
Set the name of the default Servlet to be forwarded to for static resource requests. -
setServletContext
If thedefaultServletNameproperty has not been explicitly set, attempts to locate the default Servlet using the known common container-specific names.- 指定者:
setServletContext在接口中ServletContextAware- 参数:
servletContext- the ServletContext object to be used by this object- 另请参阅:
-
InitializingBean.afterPropertiesSet()ApplicationContextAware.setApplicationContext(cn.taketoday.context.ApplicationContext)
-
handleRequest
从接口复制的说明:HttpRequestHandlerProcess the request and return a result object which the DispatcherHandler will handle. Anullreturn value is not an error: it indicates that this handler completed request processing itself and that there is therefore no explicit result to handle. aHttpRequestHandler.NONE_RETURN_VALUEindicates that no result to handle byReturnValueHandler- 指定者:
handleRequest在接口中HttpRequestHandler- 参数:
request- Current request context- 返回:
- Result to be handled by
ReturnValueHandler - 抛出:
Throwable- If any exception occurred- 另请参阅:
-