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

public class HttpConnector extends AbstractConnector
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
  • Constructor Details

  • Method Details

    • call

      public Response call(String uri, ConnectorContext context)
      Description copied from interface: Connector
      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

      public Response call(String uri, ConnectorContext context, InputStream in)
      Description copied from interface: Connector
      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

      public Response call(String uri, ConnectorContext context, InputStream in, OutputStream out)
      Description copied from interface: Connector
      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

      public Response call(String uri, ConnectorContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)
      Description copied from interface: Connector
      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
    • applyRequestHeaders

      protected void applyRequestHeaders(RemoteClient remoteClient, ConnectorContext context)
      Stamps headers onto the remote client
      Parameters:
      remoteClient - RemoteClient
      context - ConnectorContext
    • applyRequestAuthentication

      protected void applyRequestAuthentication(RemoteClient remoteClient, ConnectorContext context)
      Stamps Credentials values onto the remote client
      Parameters:
      remoteClient - RemoteClient
      context - ConnectorContext
    • processResponse

      protected void processResponse(RemoteClient remoteClient, Response response)
      Retrieves cookie headers from response and stores back onto the Connector Session
      Parameters:
      remoteClient - RemoteClient
      response - Response
    • initRemoteClient

      protected RemoteClient initRemoteClient(ConnectorContext context)
      Init the RemoteClient object based on the Connector Context. Applies Request headers and authentication as required.
      Returns:
      RemoteClient