Class EndPointProxyController
- 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.EndPointProxyController
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.web.context.ServletContextAware,org.springframework.web.servlet.mvc.Controller
public class EndPointProxyController extends org.springframework.web.servlet.mvc.AbstractControllerEndPoint HTTP Proxy Controller for Spring MVC.Provides the ability to submit a URL request via a configured end-point such as a remote Alfresco Server or any remote machine that supports an HTTP REST interface. Makes use of the Connector framework so that appropriate authentication is automatically applied to the proxied request as applicable.
This servlet accepts URIs of the following format:
/proxy/<endpointid>[/<uri>]*[?[<argName>=<argValue>]*]
Where:- endpointid is the ID of a configured EndPoint model object to make a request against
- url is the uri to call on the EndPoint URL e.g. /api/sites
- argName is the name of a URL argument to append to the request
- argValue is the value of URL argument
E.g.
/proxy/alfresco/api/sites?name=mysite&desc=description
The proxy supports all valid HTTP methods supported by the RemoteClient.- Author:
- Kevin Roast
- See Also:
RemoteClient
-
-
Field Summary
Fields Modifier and Type Field Description protected RemoteConfigElementconfigprotected org.springframework.extensions.config.ConfigServiceconfigServiceprotected ConnectorServiceconnectorServiceprotected ProxyControllerInterceptorproxyControllerInterceptor
-
Constructor Summary
Constructors Constructor Description EndPointProxyController()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RemoteConfigElementgetRemoteConfig()Gets the remote config.org.springframework.web.servlet.ModelAndViewhandleRequestInternal(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)voidsetBasicHttpAuthChallenge(boolean basicHttpAuthChallenge)Deprecated.voidsetConfigService(org.springframework.extensions.config.ConfigService configService)Sets the config service.voidsetConnectorService(ConnectorService connectorService)Sets the connector service.voidsetProxyControllerInterceptor(ProxyControllerInterceptor proxyControllerInterceptor)Set the ProxyControllerInterceptor referencevoidsetUriBlacklist(java.util.List<java.lang.String> uriBlacklist)voidsetUriWhitelist(java.util.List<java.lang.String> uriWhitelist)-
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, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
-
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
-
-
-
-
Field Detail
-
configService
protected org.springframework.extensions.config.ConfigService configService
-
connectorService
protected ConnectorService connectorService
-
proxyControllerInterceptor
protected ProxyControllerInterceptor proxyControllerInterceptor
-
config
protected RemoteConfigElement config
-
-
Method Detail
-
setUriWhitelist
public void setUriWhitelist(java.util.List<java.lang.String> uriWhitelist)
- Parameters:
uriWhitelist- the allowed URI patterns list
-
setUriBlacklist
public void setUriBlacklist(java.util.List<java.lang.String> uriBlacklist)
- Parameters:
uriBlacklist- the forbidden URI patterns list
-
setConfigService
public void setConfigService(org.springframework.extensions.config.ConfigService configService)
Sets the config service.- Parameters:
configService- the new config service
-
setConnectorService
public void setConnectorService(ConnectorService connectorService)
Sets the connector service.- Parameters:
connectorService- the new connector service
-
setBasicHttpAuthChallenge
@Deprecated public void setBasicHttpAuthChallenge(boolean basicHttpAuthChallenge)
Deprecated.Set if to present a Basic HTTP Auth challenge with a 401 error, otherwise a plain 401 response will be sent when no authorised user is available in the session and no other auth is available. Note: deprecated. @see ProxyControllerInterceptor- Parameters:
basicHttpAuthChallenge- true to present a Basic HTTP Auth challenge with a 401 error, false otherwise
-
setProxyControllerInterceptor
public void setProxyControllerInterceptor(ProxyControllerInterceptor proxyControllerInterceptor)
Set the ProxyControllerInterceptor reference- Parameters:
proxyControllerInterceptor- the ProxyControllerInterceptor
-
getRemoteConfig
public RemoteConfigElement getRemoteConfig()
Gets the remote config.- Returns:
- the remote config
-
handleRequestInternal
public org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.lang.Exception- Specified by:
handleRequestInternalin classorg.springframework.web.servlet.mvc.AbstractController- Throws:
java.lang.Exception
-
-