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.AbstractController
EndPoint 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=descriptionThe proxy supports all valid HTTP methods supported by the RemoteClient.
- Author:
- Kevin Roast
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RemoteConfigElementprotected org.springframework.extensions.config.ConfigServiceprotected ConnectorServiceprotected ProxyControllerInterceptorFields inherited from class org.springframework.web.servlet.support.WebContentGenerator
HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the remote config.org.springframework.web.servlet.ModelAndViewhandleRequestInternal(jakarta.servlet.http.HttpServletRequest req, jakarta.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(List<String> uriBlacklist) voidsetUriWhitelist(List<String> uriWhitelist) Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSessionMethods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheControl, applyCacheSeconds, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeadersMethods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
-
Field Details
-
configService
protected org.springframework.extensions.config.ConfigService configService -
connectorService
-
proxyControllerInterceptor
-
config
-
-
Constructor Details
-
EndPointProxyController
public EndPointProxyController()
-
-
Method Details
-
setUriWhitelist
- Parameters:
uriWhitelist- the allowed URI patterns list
-
setUriBlacklist
- 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
Sets the connector service.- Parameters:
connectorService- the new connector service
-
setBasicHttpAuthChallenge
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
Set the ProxyControllerInterceptor reference- Parameters:
proxyControllerInterceptor- the ProxyControllerInterceptor
-
getRemoteConfig
Gets the remote config.- Returns:
- the remote config
-
handleRequestInternal
public org.springframework.web.servlet.ModelAndView handleRequestInternal(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws Exception - Specified by:
handleRequestInternalin classorg.springframework.web.servlet.mvc.AbstractController- Throws:
Exception
-