org.springframework.extensions.surf.mvc
Class VirtualizedResourceController
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
org.springframework.extensions.surf.mvc.VirtualizedResourceController
- All Implemented Interfaces:
- org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller
public class VirtualizedResourceController
- extends ResourceController
Virtualized Spring controller for retrieving and serving
resources.
This builds on the default resource controller provided by the
Web Script Framework. It empowers the controller to retrieve
resources from remote CMIS stores ahead of the web application.
This empowers the web application with preview capabilities.
This controller retrieves content by interrogating resource providers
in the following order:
1) CMIS Resource Store (i.e. Alfresco Store)
2) Web application path
3) Delegation to default url handler (typically the Spring JS resource servlet)
The first provider is only consulted if the Web Framework
is running in preview mode. If the Web Framework is configured
to run in production mode, virtualized resource stores are
never considered.
The following URL formats are supported:
/resource/?e=&s=&
/resource/?e=&s=
/resource/?e=
/resource/?s=
/resource/
In the latter cases, the web framework's selected store and webapp
are determined from session and reused. This enables the case for
resources to be loaded as though they were local to disk (and located
in the /resource context).
- Author:
- muzquiano
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
METHOD_GET, METHOD_HEAD, METHOD_POST |
Method Summary |
boolean |
checkRemoteResourceExists(RequestContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path,
String endpointId,
String storeId,
String webappId)
Checks for the existence of a resource on a remote store |
boolean |
dispatchResource(String path,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Dispatches to the resource with the given path |
org.apache.commons.logging.Log |
getLogger()
|
WebFrameworkServiceRegistry |
getServiceRegistry()
Gets the service registry. |
boolean |
retrieveRemoteResource(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path,
String endpointId,
String storeId,
String webappId)
Retrieves content from the given remote store and streams back to the response |
void |
setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
Sets the service registry. |
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 |
VirtualizedResourceController
public VirtualizedResourceController()
setServiceRegistry
public void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
- Sets the service registry.
- Parameters:
webFrameworkServiceRegistry
- the new service registry
getServiceRegistry
public WebFrameworkServiceRegistry getServiceRegistry()
- Gets the service registry.
- Returns:
- the service registry
getLogger
public org.apache.commons.logging.Log getLogger()
- Overrides:
getLogger
in class ResourceController
dispatchResource
public boolean dispatchResource(String path,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
- Description copied from class:
ResourceController
- Dispatches to the resource with the given path
- Overrides:
dispatchResource
in class ResourceController
- Parameters:
path
- the pathrequest
- the requestresponse
- the response
- Returns:
- true, if the dispatch succeeded
- Throws:
javax.servlet.ServletException
IOException
retrieveRemoteResource
public boolean retrieveRemoteResource(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path,
String endpointId,
String storeId,
String webappId)
throws javax.servlet.ServletException,
IOException
- Retrieves content from the given remote store and streams back to the response
- Parameters:
request
- http servlet requestresponse
- http servlet responsepath
- the path to be includedendpointId
- the endpoint to utilize (optional)storeId
- the store to utilize (optional)webappId
- the webapp to utilize (optional)
- Returns:
- whether the resource was served back successfully
- Throws:
javax.servlet.ServletException
IOException
checkRemoteResourceExists
public boolean checkRemoteResourceExists(RequestContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String path,
String endpointId,
String storeId,
String webappId)
throws javax.servlet.ServletException,
IOException
- Checks for the existence of a resource on a remote store
- Parameters:
context
- the request contextrequest
- http servlet requestresponse
- http servlet responsepath
- the path to the assetendpointId
- the endpoint where the resource livesstoreId
- the store within which the resource liveswebappId
- the web application that the resource lives in
- Returns:
-
- Throws:
javax.servlet.ServletException
IOException
Copyright © 2009 SpringSource, Inc. All Rights Reserved.