org.springframework.extensions.webscripts.servlet.mvc
Class ResourceController
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.AbstractController
org.springframework.extensions.webscripts.servlet.mvc.ResourceController
- All Implemented Interfaces:
- org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller
- Direct Known Subclasses:
- VirtualizedResourceController
public class ResourceController
- extends org.springframework.web.servlet.mvc.AbstractController
Default Spring controller for retrieving and serving resources.
This controller retrieves content by interrogating resource providers
in the following order:
1) Web application path
2) Web application context resources (classpath)
3) Delegation to a default url handler
The following URL format is supported:
/resource/
- Author:
- muzquiano
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
METHOD_GET, METHOD_HEAD, METHOD_POST |
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController |
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession |
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceController
public ResourceController()
setDefaultUrl
public void setDefaultUrl(String defaultUrl)
- Sets the default url.
- Parameters:
defaultUrl
- the new default url
getDefaultUrl
public String getDefaultUrl()
- Gets the default url.
- Returns:
- the default url
getLogger
public org.apache.commons.logging.Log getLogger()
handleRequestInternal
public org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
- Specified by:
handleRequestInternal
in class org.springframework.web.servlet.mvc.AbstractController
- Throws:
Exception
dispatchResource
public boolean dispatchResource(String path,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
- Dispatches to the resource with the given path
- Parameters:
path
- the pathrequest
- the requestresponse
- the response
- Returns:
- true, if the dispatch succeeded
- Throws:
javax.servlet.ServletException
IOException
commitResponse
public void commitResponse(URL resourceUrl,
javax.servlet.http.HttpServletResponse response)
throws IOException
- Throws:
IOException
copyStream
public static int copyStream(InputStream in,
OutputStream out,
boolean closeStreams)
throws IOException
- Copy stream.
- Parameters:
in
- the inout
- the outcloseStreams
- the close streams
- Returns:
- the int
- Throws:
IOException
- Signals that an I/O exception has occurred.
Copyright © 2009 SpringSource, Inc. All Rights Reserved.