Interface HttpClient

  • All Known Implementing Classes:
    UnirestClient

    public interface HttpClient
    • Method Detail

      • executeAsStringAsync

        void executeAsStringAsync​(HttpRequest request,
                                  APICallBack<HttpResponse> callBack)
        Execute a given HttpRequest to get string response back
        Parameters:
        request - The given HttpRequest to execute
        callBack - Callback after execution
      • executeAsBinaryAsync

        void executeAsBinaryAsync​(HttpRequest request,
                                  APICallBack<HttpResponse> callBack)
        Execute a given HttpRequest to get binary response back
        Parameters:
        request - The given HttpRequest to execute
        callBack - Callback after execution
      • executeAsBinary

        HttpResponse executeAsBinary​(HttpRequest request)
                              throws APIException
        Execute a given HttpRequest to get binary response back
        Parameters:
        request - The given HttpRequest to execute
        Returns:
        the HTTP response
        Throws:
        APIException - on error executing request
      • executeAsString

        HttpResponse executeAsString​(HttpRequest request)
                              throws APIException
        Execute a given HttpRequest to get string response back
        Parameters:
        request - The given HttpRequest to execute
        Returns:
        the HTTP response
        Throws:
        APIException - on error executing request
      • get

        HttpRequest get​(String _queryUrl,
                        Map<String,​String> _headers,
                        Map<String,​Object> _parameters,
                        String _username,
                        String _password)
        Create a simple HTTP GET request with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the query params
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • get

        HttpRequest get​(String _queryUrl,
                        Map<String,​String> _headers,
                        Map<String,​Object> _parameters)
        Create a simple HTTP GET request
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the query params
        Returns:
        the request object
      • post

        HttpRequest post​(String _queryUrl,
                         Map<String,​String> _headers,
                         Map<String,​Object> _parameters)
        Create an HTTP POST request with parameters
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the query params
        Returns:
        the request object
      • post

        HttpRequest post​(String _queryUrl,
                         Map<String,​String> _headers,
                         Map<String,​Object> _parameters,
                         String _username,
                         String _password)
        Create an HTTP POST request with parameters and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the query params
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • postBody

        HttpBodyRequest postBody​(String _queryUrl,
                                 Map<String,​String> _headers,
                                 String _body)
        Create an HTTP POST request with body
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        Returns:
        the request object
      • postBody

        HttpBodyRequest postBody​(String _queryUrl,
                                 Map<String,​String> _headers,
                                 String _body,
                                 String _username,
                                 String _password)
        Create an HTTP POST request with body and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • put

        HttpRequest put​(String _queryUrl,
                        Map<String,​String> _headers,
                        Map<String,​Object> _parameters)
        Create an HTTP PUT request with parameters
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        Returns:
        the request object
      • put

        HttpRequest put​(String _queryUrl,
                        Map<String,​String> _headers,
                        Map<String,​Object> _parameters,
                        String _username,
                        String _password)
        Create an HTTP PUT request with parameters and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • putBody

        HttpBodyRequest putBody​(String _queryUrl,
                                Map<String,​String> _headers,
                                String _body)
        Create an HTTP PUT request with body
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        Returns:
        the request object
      • putBody

        HttpBodyRequest putBody​(String _queryUrl,
                                Map<String,​String> _headers,
                                String _body,
                                String _username,
                                String _password)
        Create an HTTP PUT request with body and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • patch

        HttpRequest patch​(String _queryUrl,
                          Map<String,​String> _headers,
                          Map<String,​Object> _parameters)
        Create an HTTP PATCH request with parameters
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        Returns:
        the request object
      • patch

        HttpRequest patch​(String _queryUrl,
                          Map<String,​String> _headers,
                          Map<String,​Object> _parameters,
                          String _username,
                          String _password)
        Create an HTTP PATCH request with parameters and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • patchBody

        HttpBodyRequest patchBody​(String _queryUrl,
                                  Map<String,​String> _headers,
                                  String _body)
        Create an HTTP PATCH request with body
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        Returns:
        the request object
      • patchBody

        HttpBodyRequest patchBody​(String _queryUrl,
                                  Map<String,​String> _headers,
                                  String _body,
                                  String _username,
                                  String _password)
        Create an HTTP PATCH request with body and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • delete

        HttpRequest delete​(String _queryUrl,
                           Map<String,​String> _headers,
                           Map<String,​Object> _parameters)
        Create an HTTP DELETE request with parameters
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        Returns:
        the request object
      • delete

        HttpRequest delete​(String _queryUrl,
                           Map<String,​String> _headers,
                           Map<String,​Object> _parameters,
                           String _username,
                           String _password)
        Create an HTTP DELETE request with parameters and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _parameters - the request parameters
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object
      • deleteBody

        HttpBodyRequest deleteBody​(String _queryUrl,
                                   Map<String,​String> _headers,
                                   String _body)
        Create an HTTP DELETE request with body
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        Returns:
        the request object
      • deleteBody

        HttpBodyRequest deleteBody​(String _queryUrl,
                                   Map<String,​String> _headers,
                                   String _body,
                                   String _username,
                                   String _password)
        Create an HTTP DELETE request with body and with basic authentication
        Parameters:
        _queryUrl - the URL of the HTTP request
        _headers - the HTTP request headers as map
        _body - the request body
        _username - for basic auth header
        _password - for basic auth header
        Returns:
        the request object