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.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | COMMON_DEFAULT_SERVLET_NAME
Default Servlet name used by Tomcat, Jetty, JBoss, and GlassFish. |
| private String | |
| private static final String | GAE_DEFAULT_SERVLET_NAME
Default Servlet name used by Google App Engine. |
| private static final String | RESIN_DEFAULT_SERVLET_NAME
Default Servlet name used by Resin. |
| private ServletContext | |
| private static final String | WEBLOGIC_DEFAULT_SERVLET_NAME
Default Servlet name used by WebLogic. |
| private static final String | WEBSPHERE_DEFAULT_SERVLET_NAME
Default Servlet name used by WebSphere. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | handleRequest(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response)Implements org. Process the given request, generating a response. |
| public void | setDefaultServletName(String defaultServletName)
Set the name of the default Servlet to be forwarded to for static resource requests. |
| public void | setServletContext(ServletContext
the ServletContext object to be used by this object servletContext)Implements org. If the |
| COMMON_DEFAULT_SERVLET_NAME | back to summary |
|---|---|
| private static final String COMMON_DEFAULT_SERVLET_NAME Default Servlet name used by Tomcat, Jetty, JBoss, and GlassFish. | |
| defaultServletName | back to summary |
|---|---|
| private String defaultServletName
| |
| GAE_DEFAULT_SERVLET_NAME | back to summary |
|---|---|
| private static final String GAE_DEFAULT_SERVLET_NAME Default Servlet name used by Google App Engine. | |
| RESIN_DEFAULT_SERVLET_NAME | back to summary |
|---|---|
| private static final String RESIN_DEFAULT_SERVLET_NAME Default Servlet name used by Resin. | |
| servletContext | back to summary |
|---|---|
| private ServletContext servletContext
| |
| WEBLOGIC_DEFAULT_SERVLET_NAME | back to summary |
|---|---|
| private static final String WEBLOGIC_DEFAULT_SERVLET_NAME Default Servlet name used by WebLogic. | |
| WEBSPHERE_DEFAULT_SERVLET_NAME | back to summary |
|---|---|
| private static final String WEBSPHERE_DEFAULT_SERVLET_NAME Default Servlet name used by WebSphere. | |
| DefaultServletHttpRequestHandler | back to summary |
|---|---|
| public DefaultServletHttpRequestHandler() | |
| handleRequest | back to summary |
|---|---|
| public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException Implements org. Doc from org. Process the given request, generating a response.
| |
| setDefaultServletName | back to summary |
|---|---|
| public void setDefaultServletName(String defaultServletName) Set the name of the default Servlet to be forwarded to for static resource requests. | |
| setServletContext | back to summary |
|---|---|
| public void setServletContext(ServletContext servletContext) Implements org. If the
| |