Interface Connector
- All Known Implementing Classes:
AbstractConnector,AlfrescoConnector,AuthenticatingConnector,HttpConnector
public interface Connector
Describes a connector to a remote endpoint for a given user.
All connectors are scoped to a particular user and a particular endpoint. Create new connectors for new users and new endpoints.
All calls using a connector will be stamped with a user's connector credentials. These connector credentials usually consist of things like cookies, tokens, additional request parameters and other HTTP request state.
The caller does not have to pass this data manually. It is managed for the developer by the underlying ConnectorService during the factory construction of Connector objects.
If a connector is constructed without user information then no credential information is passed through - the connections are anonymous.
- Author:
- muzquiano, kevinr
-
Method Summary
Modifier and TypeMethodDescriptionInvokes a URI on a remote service.call(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.Returns the connector sessionReturns the credents for this connector.Returns the endpoint to which this connector connects.voidsetConnectorSession(ConnectorSession connectorSession) Sets the connector sessionvoidsetCredentials(Credentials credentials) Binds Credentials to this connector.voidsetEndpoint(String endpoint) Sets the endpoint.
-
Method Details
-
call
Invokes a URI on a remote service. The response data is buffered into a data element on the returned object of type Response.- Parameters:
uri- the uri- Returns:
- the response
-
call
Invokes 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
Invokes 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
Invokes 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
Response 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. 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
-
setCredentials
Binds Credentials to this connector.- Parameters:
credentials- the new credentials
-
getCredentials
Credentials getCredentials()Returns the credents for this connector.- Returns:
- the credentials
-
setEndpoint
Sets the endpoint.- Parameters:
endpoint- the new endpoint
-
getEndpoint
String getEndpoint()Returns the endpoint to which this connector connects.- Returns:
- endpoint the endpoint
-
setConnectorSession
Sets the connector session- Parameters:
connectorSession- ConnectorSession
-
getConnectorSession
ConnectorSession getConnectorSession()Returns the connector session- Returns:
- the connector session
-