Class HttpConnector
java.lang.Object
org.springframework.extensions.webscripts.connector.AbstractConnector
org.springframework.extensions.webscripts.connector.HttpConnector
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,Connector
- Direct Known Subclasses:
AlfrescoConnector
Basic Connector implementation that can be used to perform simple HTTP and
HTTP communication with a remote endpoint. This connector supports basic HTTP
authentication via the RemoteClient.
- Author:
- muzquiano, kevinr
-
Field Summary
Fields inherited from class org.springframework.extensions.webscripts.connector.AbstractConnector
connectorSession, descriptor, endpoint -
Constructor Summary
ConstructorsConstructorDescriptionHttpConnector(RemoteConfigElement.ConnectorDescriptor descriptor, String endpoint) Instantiates a new http connector. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyRequestAuthentication(RemoteClient remoteClient, ConnectorContext context) Stamps Credentials values onto the remote clientprotected voidapplyRequestHeaders(RemoteClient remoteClient, ConnectorContext context) Stamps headers onto the remote clientcall(String uri, ConnectorContext context) Invokes a URI on a remote service.call(String uri, ConnectorContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Invokes a URI on a remote service and streams back results to the provided response object.call(String uri, ConnectorContext context, InputStream in) Invokes a URI on a remote service, passing the input as supplied via a POST/PUT.call(String uri, ConnectorContext context, InputStream in, OutputStream out) Invokes a URI on a remote service.protected RemoteClientinitRemoteClient(ConnectorContext context) Init the RemoteClient object based on the Connector Context.protected voidprocessResponse(RemoteClient remoteClient, Response response) Retrieves cookie headers from response and stores back onto the Connector SessionMethods inherited from class org.springframework.extensions.webscripts.connector.AbstractConnector
buildRemoteClient, call, getConnectorSession, getCredentials, getEndpoint, setApplicationContext, setConnectorSession, setCredentials, setEndpoint, toString
-
Constructor Details
-
HttpConnector
Instantiates a new http connector.- Parameters:
descriptor- the descriptorendpoint- the endpoint
-
-
Method Details
-
call
Description copied from interface:ConnectorInvokes a URI on a remote service. If the context is null, then it will not be utilized. The response data is buffered into a data element on the returned object of type Response.- Parameters:
uri- the uricontext- the context of the invoke- Returns:
- the response
-
call
Description copied from interface:ConnectorInvokes a URI on a remote service, passing the input as supplied via a POST/PUT. If the context is null, then it will not be utilized and POST will be assumed. The response data is buffered into a data element on the returned object of type Response.- Parameters:
uri- the uricontext- the context of the invokein- the input stream- Returns:
- the response
-
call
Description copied from interface:ConnectorInvokes a URI on a remote service. Data is streamed back from the response into the provided output stream. Headers and response state is maintained on the Response object. If the context is null, then it will not be utilized. The response data is not buffered- Parameters:
uri- the uricontext- the context of the invokein- the input streamout- the output stream- Returns:
- the response
-
call
public Response call(String uri, ConnectorContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Description copied from interface:ConnectorInvokes a URI on a remote service and streams back results to the provided response object. This method makes sure that the full response is propagated into the servlet response, including headers, exception states and more. If the context is null, then it will not be utilized. The response data is not buffered.- Parameters:
uri- the uricontext- the context of the invokereq- Request to proxy fromres- Response to proxy onto- Returns:
- the response
-
applyRequestHeaders
Stamps headers onto the remote client- Parameters:
remoteClient- RemoteClientcontext- ConnectorContext
-
applyRequestAuthentication
Stamps Credentials values onto the remote client- Parameters:
remoteClient- RemoteClientcontext- ConnectorContext
-
processResponse
Retrieves cookie headers from response and stores back onto the Connector Session- Parameters:
remoteClient- RemoteClientresponse- Response
-
initRemoteClient
Init the RemoteClient object based on the Connector Context. Applies Request headers and authentication as required.- Returns:
- RemoteClient
-