Class HttpConnection

    • Constructor Detail

      • HttpConnection

        public HttpConnection​(URL url)
        Constructor.
        Parameters:
        url - URL to be called.
      • HttpConnection

        public HttpConnection​(URL url,
                              long timeout)
        Constructor.
        Parameters:
        url - URL to be called.
        timeout - Request timeout.
    • Method Detail

      • addRequestProperty

        public void addRequestProperty​(String propertyName,
                                       String propertyValue)
        Parameters:
        propertyName - Name of request header property.
        propertyValue - Value of request header property.
      • setRequestBody

        public void setRequestBody​(HttpRequestBodyWriter requestBody)
        Parameters:
        requestBody - Set custom request body writer.
      • setRequestBody

        public void setRequestBody​(String requestBody)
        Parameters:
        requestBody - Set simple String request body.
      • setAuthentication

        public void setAuthentication​(String username,
                                      String password)
        Set HTTP authentication.
        Parameters:
        username - User name.
        password - Password.
      • get

        public HttpResult get()
        Returns:
        Result of HTTP GET call of this connection.
      • post

        public HttpResult post()
        Returns:
        Result of HTTP POST call of this connection.
      • put

        public HttpResult put()
        Returns:
        Result of HTTP PUT call of this connection.
      • delete

        public HttpResult delete()
        Returns:
        Result of HTTP DELETE call of this connection.