org.springframework.extensions.webscripts.connector
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. As such, their endpoints and user bindings cannot be swapped once they are created. Rather, you should create new connectors for new users and new endpoints. A connector is scoped to a given user and a given endpoint. 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 it is scoped to a null user. No credential information is passed through and the connections are anonymous.

Author:
muzquiano

Method Summary
 Response call(String uri)
          Invokes a URI on a remote service.
 Response call(String uri, ConnectorContext context)
          Invokes a URI on a remote service.
 Response call(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.
 Response call(String uri, ConnectorContext context, InputStream in)
          Invokes a URI on a remote service, passing the input as supplied via a POST/PUT.
 Response call(String uri, ConnectorContext context, InputStream in, OutputStream out)
          Invokes a URI on a remote service.
 ConnectorSession getConnectorSession()
          Returns the connector session
 Credentials getCredentials()
          Returns the credents for this connector.
 String getEndpoint()
          Returns the endpoint to which this connector connects.
 void setConnectorSession(ConnectorSession connectorSession)
          Sets the connector session
 void setCredentials(Credentials credentials)
          Binds Credentials to this connector.
 void setEndpoint(String endpoint)
          Sets the endpoint.
 

Method Detail

call

Response call(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(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(String uri,
              ConnectorContext context,
              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(String uri,
              ConnectorContext context,
              InputStream in,
              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(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(String endpoint)
Sets the endpoint.

Parameters:
endpoint - the new endpoint

getEndpoint

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 -

getConnectorSession

ConnectorSession getConnectorSession()
Returns the connector session

Returns:
the connector session


Copyright © 2009 SpringSource, Inc. All Rights Reserved.