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 Detail

      • call

        Response call​(java.lang.String uri)
        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

        Response call​(java.lang.String uri,
                      ConnectorContext context)
        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 uri
        context - the context of the invoke
        Returns:
        the response
      • call

        Response call​(java.lang.String uri,
                      ConnectorContext context,
                      java.io.InputStream in)
        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 uri
        context - the context of the invoke
        in - the input stream
        Returns:
        the response
      • call

        Response call​(java.lang.String uri,
                      ConnectorContext context,
                      java.io.InputStream in,
                      java.io.OutputStream out)
        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 uri
        context - the context of the invoke
        in - the input stream
        out - the output stream
        Returns:
        the response
      • call

        Response call​(java.lang.String uri,
                      ConnectorContext context,
                      javax.servlet.http.HttpServletRequest req,
                      javax.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 uri
        context - the context of the invoke
        req - Request to proxy from
        res - Response to proxy onto
        Returns:
        the response
      • setCredentials

        void setCredentials​(Credentials credentials)
        Binds Credentials to this connector.
        Parameters:
        credentials - the new credentials
      • getCredentials

        Credentials getCredentials()
        Returns the credents for this connector.
        Returns:
        the credentials
      • setEndpoint

        void setEndpoint​(java.lang.String endpoint)
        Sets the endpoint.
        Parameters:
        endpoint - the new endpoint
      • getEndpoint

        java.lang.String getEndpoint()
        Returns the endpoint to which this connector connects.
        Returns:
        endpoint the endpoint
      • setConnectorSession

        void setConnectorSession​(ConnectorSession connectorSession)
        Sets the connector session
        Parameters:
        connectorSession - ConnectorSession
      • getConnectorSession

        ConnectorSession getConnectorSession()
        Returns the connector session
        Returns:
        the connector session