|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler
public class DefaultServletHttpRequestHandler
An 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.
Constructor Summary | |
---|---|
DefaultServletHttpRequestHandler()
|
Method Summary | |
---|---|
void |
handleRequest(HttpServletRequest request,
HttpServletResponse response)
Process the given request, generating a response. |
void |
setDefaultServletName(String defaultServletName)
Set the name of the default Servlet to be forwarded to for static resource requests. |
void |
setServletContext(ServletContext servletContext)
If the defaultServletName property has not been explicitly set,
attempts to locate the default Servlet using the known common
container-specific names. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultServletHttpRequestHandler()
Method Detail |
---|
public void setDefaultServletName(String defaultServletName)
public void setServletContext(ServletContext servletContext)
defaultServletName
property has not been explicitly set,
attempts to locate the default Servlet using the known common
container-specific names.
setServletContext
in interface ServletContextAware
servletContext
- ServletContext object to be used by this objectInitializingBean.afterPropertiesSet()
,
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
HttpRequestHandler
handleRequest
in interface HttpRequestHandler
request
- current HTTP requestresponse
- current HTTP response
ServletException
- in case of general errors
IOException
- in case of I/O errors
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |