HttpAgent

public interface HttpAgent

An OSGI Service for sending http requests.

Methods

execute

void execute(String url, Object data, Method method)

Executes the http request asynchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method

execute

void execute(String url, Object data, Method method, Map<String, String> headers)

Executes the http request asynchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • headers – the request headers

execute

void execute(String url, Object data, Method method, Credentials credentials)

Executes the http request asynchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • credentials – the user credentials

See also: org.motechproject.http.agent.domain.Credentials

execute

void execute(String url, Object data, Method method, Map<String, String> headers, Credentials credentials)

Executes the http request asynchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • headers – the request headers
  • credentials – the user credentials

See also: org.motechproject.http.agent.domain.Credentials

executeSync

void executeSync(String url, Object data, Method method)

Executes the http request synchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method

executeSync

void executeSync(String url, Object data, Method method, Map<String, String> headers)

Executes the http request synchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • headers – the request headers

executeSync

void executeSync(String url, Object data, Method method, Credentials credentials)

Executes the http request synchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • credentials – the user credentials

See also: org.motechproject.http.agent.domain.Credentials

executeSync

void executeSync(String url, Object data, Method method, Map<String, String> headers, Credentials credentials)

Executes the http request synchronously.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • headers – the request headers
  • credentials – the user credentials

See also: org.motechproject.http.agent.domain.Credentials

executeWithReturnTypeSync

ResponseEntity<?> executeWithReturnTypeSync(String url, Object data, Method method)

Executes the http request synchronously and returns the response.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
Returns:

response from posted request

executeWithReturnTypeSync

ResponseEntity<?> executeWithReturnTypeSync(String url, Object data, Method method, Integer retryCount)

Executes the http request synchronously and returns the response, takes additional parameter for number of retries.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • retryCount – the number of retries
Returns:

response from posted request

executeWithReturnTypeSync

ResponseEntity<?> executeWithReturnTypeSync(String url, Object data, Method method, Integer retryCount, Long retryInterval)

Executes the http request synchronously and returns the response, takes additional parameters for number of retries and interval between two retries.

Parameters:
  • url – the url for request
  • data – the request data
  • method – the http method
  • retryCount – the number of retries
  • retryInterval – the interval between two retries in milliseconds
Returns:

response from posted request