Class HttpUtil


  • @Component
    public class HttpUtil
    extends Object
    Author:
    Daniel Koch, Andre Henn, terrestris GmbH & Co. KG
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpUtil()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Response delete​(String url)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(String url, String username, String password)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(String url, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(String url, org.apache.http.auth.Credentials credentials)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(String url, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URL.
      static Response delete​(URI uri)
      Performs an HTTP DELETE on the given URI.
      static Response delete​(URI uri, String username, String password)
      Performs an HTTP DELETE on the given URI.
      static Response delete​(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URI.
      static Response delete​(URI uri, org.apache.http.auth.Credentials credentials)
      Performs an HTTP DELETE on the given URI.
      static Response delete​(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URI.
      static Response delete​(URI uri, org.apache.http.Header[] requestHeaders)
      Performs an HTTP DELETE on the given URI.
      static Response forwardFormMultipartPost​(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)
      Forward FormMultipartPost (HTTP POST) to uri based on given request
      static Response forwardGet​(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)
      Forward GET request to uri based on given request
      static Response forwardPost​(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)
      Forward POST to uri based on given request
      static Response get​(String url)
      Performs an HTTP GET on the given URL without authentication
      static Response get​(String url, String username, String password)
      Performs an HTTP GET on the given URL
      static Response get​(String url, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URL
      static Response get​(String url, org.apache.http.auth.Credentials credentials)
      Performs an HTTP GET on the given URL.
      static Response get​(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URL.
      static Response get​(String url, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URL without authentication and additional HTTP request headers.
      static Response get​(URI uri)
      Performs an HTTP GET on the given URI.
      static Response get​(URI uri, String username, String password)
      Performs an HTTP GET on the given URI.
      static Response get​(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URI.
      static Response get​(URI uri, org.apache.http.auth.Credentials credentials)
      Performs an HTTP GET on the given URI.
      static Response get​(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URI.
      static Response get​(URI uri, org.apache.http.Header[] requestHeaders)
      Performs an HTTP GET on the given URI.
      static org.apache.http.Header[] getHeadersFromRequest​(javax.servlet.http.HttpServletRequest request)
      Extract headers from HttpServletRequest
      static int getHttpTimeout()  
      static boolean isFormMultipartPost​(javax.servlet.http.HttpServletRequest request)
      Check if provided HttpServletRequest is a FormMultipartPost
      static boolean isHttpGetRequest​(javax.servlet.http.HttpServletRequest request)
      Check if provided HttpServletRequest is a HTTP GET request
      static boolean isHttpPostRequest​(javax.servlet.http.HttpServletRequest request)
      Check if provided HttpServletRequest is a HTTP POST request
      static boolean isSaneRequest​(javax.servlet.http.HttpServletRequest request)
      Checks if request and request method are not null
      static Response post​(String url)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file, String username, String password)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, File file, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String password, String username)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String password, String username, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType, String username, String password)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams, String username, String password)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, List<org.apache.http.NameValuePair> queryParams, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(String url, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, File file)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, File file, String username, String password)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, File file, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, File file, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, File file, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, File file, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String username, String password)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URL.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams, String username, String password)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, List<org.apache.http.NameValuePair> queryParams, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, org.apache.http.auth.Credentials credentials)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response post​(URI uri, org.apache.http.Header[] requestHeaders)
      Performs an HTTP POST on the given URI.
      static Response put​(String uriString)
      Perform HTTP PUT with empty body
      static Response put​(String uriString, File body, org.apache.http.entity.ContentType contentType, String username, String password)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String username, String password)
      Perform HTTP PUT with empty body
      static Response put​(String uriString, String username, String password, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType, String username, String password)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(String uriString, org.apache.http.auth.Credentials credentials)
      Perform HTTP PUT with empty body
      static Response put​(String uriString, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body
      static Response put​(String uriString, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body
      static Response put​(URI uri)
      Perform HTTP PUT with empty body
      static Response put​(URI uri, String username, String password)
      Perform HTTP PUT with empty body Basic auth will be used if both username and password are not null
      static Response put​(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body Basic auth will be used if both username and password are not null
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)
      Performs an HTTP PUT on the given URL.
      static Response put​(URI uri, org.apache.http.auth.Credentials credentials)
      Perform HTTP PUT with empty body
      static Response put​(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body
      static Response put​(URI uri, org.apache.http.Header[] requestHeaders)
      Perform HTTP PUT with empty body
      static void resetHttpTimeout()
      Resets the http timeout to the default one given by the app config.
      void setDefaultHttpTimeout​(int httpTimeout)
      Note: The value annotation is set to the setter of httpTimeout here as we can't autowire any value to its static field (but the field has to be static itself).
      static void setHttpTimeout​(int httpTimeout)  
    • Constructor Detail

      • HttpUtil

        public HttpUtil()
    • Method Detail

      • get

        public static Response get​(String url)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL without authentication
        Parameters:
        url - The URL to connect to.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(String url,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL without authentication and additional HTTP request headers.
        Parameters:
        url - The URL to connect to.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(String url,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL.
        Parameters:
        url - The URL to connect to.
        credentials - instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(String url,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL.
        Parameters:
        url - The URL to connect to.
        credentials - instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(String url,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL
        Parameters:
        url - The URL to connect to.
        username - Credentials - username
        password - Credentials - password
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • get

        public static Response get​(String url,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URL
        Parameters:
        url - The URL to connect to.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • get

        public static Response get​(URI uri)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. No credentials needed.
        Parameters:
        uri - The URI to connect to.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(URI uri,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. No credentials needed.
        Parameters:
        uri - The URI to connect to.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(URI uri,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. Basic auth is used if both username and password are not null.
        Parameters:
        uri - The URI to connect to.
        username - Credentials - username
        password - Credentials - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(URI uri,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. Basic auth is used if both username and password are not null.
        Parameters:
        uri - The URI to connect to.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(URI uri,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • get

        public static Response get​(URI uri,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP GET on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • forwardGet

        public static Response forwardGet​(URI uri,
                                          javax.servlet.http.HttpServletRequest request,
                                          boolean forwardHeaders)
                                   throws URISyntaxException,
                                          org.apache.http.HttpException
        Forward GET request to uri based on given request
        Parameters:
        uri - uri The URI to forward to.
        request - The original HttpServletRequest
        forwardHeaders - Should headers of request should be forwarded
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String password,
                                    String username,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both and password are not null.
        Parameters:
        url - The URI to connect to as String.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null
        Parameters:
        url - The URL to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null
        Parameters:
        url - The URL to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI. Basic auth is used if both and password are not null.
        Parameters:
        uri - The URI to connect to.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI. Basic auth is used if credentials object is not null
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI. Basic auth is used if credentials object is not null
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both and password are not null.
        Parameters:
        url - The URL to connect to.
        queryParams - The list of NameValuePairs.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        queryParams - The list of NameValuePairs.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        queryParams - The list of NameValuePairs.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI.
        Parameters:
        uri - The URI to connect to.
        queryParams - The list of NameValuePairs.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    String username,
                                    String password)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI. Basic auth is used if both and password are not null.
        Parameters:
        uri - The URI to connect to.
        queryParams - The list of NameValuePairs.
        username - Credentials - username
        password - Credentials - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI. Basic auth is used if both and password are not null.
        Parameters:
        uri - The URI to connect to.
        queryParams - The list of NameValuePairs.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI.
        Parameters:
        uri - The URI to connect to.
        queryParams - The list of NameValuePairs.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    List<org.apache.http.NameValuePair> queryParams,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    UnsupportedEncodingException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URI.
        Parameters:
        uri - The URI to connect to.
        queryParams - The list of NameValuePairs.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        UnsupportedEncodingException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    String username,
                                    String password)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used is both username and password are not null
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body
        username - Credentials - username
        password - Credentials - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used is both username and password are not null
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    String username,
                                    String password)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        username - Credentials - username
        password - Credentials - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        username - Credentials - username
        password - Credentials - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    String body,
                                    org.apache.http.entity.ContentType contentType,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        body - The POST body.
        contentType - The ContentType of the POST body.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file,
                                    String username,
                                    String password)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        username - username
        password - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null.
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(String url,
                                    File file,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null.
        Parameters:
        url - The URL to connect to.
        file - The file to send as MultiPartFile.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file,
                                    String username,
                                    String password)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        username - username
        password - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file,
                                    String username,
                                    String password,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if both username and password are not null.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file,
                                    org.apache.http.auth.Credentials credentials)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • post

        public static Response post​(URI uri,
                                    File file,
                                    org.apache.http.auth.Credentials credentials,
                                    org.apache.http.Header[] requestHeaders)
                             throws URISyntaxException,
                                    org.apache.http.HttpException
        Performs an HTTP POST on the given URL. Basic auth is used if credentials object is not null.
        Parameters:
        uri - The URI to connect to.
        file - The file to send as MultiPartFile.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • forwardFormMultipartPost

        public static Response forwardFormMultipartPost​(URI uri,
                                                        javax.servlet.http.HttpServletRequest request,
                                                        boolean forwardHeaders)
                                                 throws URISyntaxException,
                                                        org.apache.http.HttpException,
                                                        IllegalStateException,
                                                        IOException,
                                                        javax.servlet.ServletException
        Forward FormMultipartPost (HTTP POST) to uri based on given request
        Parameters:
        uri - uri The URI to forward to.
        request - The original HttpServletRequest
        forwardHeaders - Should headers of request should be forwarded
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
        IllegalStateException
        IOException
        javax.servlet.ServletException
      • forwardPost

        public static Response forwardPost​(URI uri,
                                           javax.servlet.http.HttpServletRequest request,
                                           boolean forwardHeaders)
                                    throws URISyntaxException,
                                           org.apache.http.HttpException
        Forward POST to uri based on given request
        Parameters:
        uri - uri The URI to forward to.
        request - The original HttpServletRequest
        forwardHeaders - Should headers of request should be forwarded
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uri -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(String uriString,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uriString -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(URI uri,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body Basic auth will be used if both username and password are not null
        Parameters:
        uri - URI to connect to
        username - username
        password - password
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body Basic auth will be used if both username and password are not null
        Parameters:
        uri - URI to connect to
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uri - URI to connect to
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uri - URI to connect to
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uriString - String representing the URI to connect to
        username - username
        password - password
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(String uriString,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uriString - String representing the URI to connect to
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(String uriString,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uriString - String representing the URI to connect to
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(String uriString,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Perform HTTP PUT with empty body
        Parameters:
        uriString - String representing the URI to connect to
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        org.apache.http.HttpException
        URISyntaxException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL. (without BasicAuth)
        Parameters:
        uriString - String representing the URI to connect to
        body -
        contentType -
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL. (without BasicAuth)
        Parameters:
        uriString - String representing the URI to connect to
        body -
        contentType -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uriString - String representing the URI to connect to
        body -
        contentType -
        username -
        password -
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uriString - String representing the URI to connect to
        body -
        contentType -
        username -
        password -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uriString -
        body -
        contentType -
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uriString -
        body -
        contentType -
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL. without BasicAuth
        Parameters:
        uri -
        body -
        contentType -
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL. without BasicAuth
        Parameters:
        uri -
        body -
        contentType -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uri -
        body -
        contentType -
        username -
        password -
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   String username,
                                   String password,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uri -
        body -
        contentType -
        username -
        password -
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(String uriString,
                                   File body,
                                   org.apache.http.entity.ContentType contentType,
                                   String username,
                                   String password)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uriString -
        body -
        username -
        password -
        Returns:
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.auth.Credentials credentials)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uri -
        body -
        contentType -
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • put

        public static Response put​(URI uri,
                                   String body,
                                   org.apache.http.entity.ContentType contentType,
                                   org.apache.http.auth.Credentials credentials,
                                   org.apache.http.Header[] requestHeaders)
                            throws URISyntaxException,
                                   org.apache.http.HttpException
        Performs an HTTP PUT on the given URL.
        Parameters:
        uri -
        body -
        contentType -
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url,
                                      String username,
                                      String password)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        username - username
        password - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url,
                                      String username,
                                      String password,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url,
                                      org.apache.http.auth.Credentials credentials)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(String url,
                                      org.apache.http.auth.Credentials credentials,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URL.
        Parameters:
        url - The URL to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI.
        Parameters:
        uri - The URI to connect to.
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI.
        Parameters:
        uri - The URI to connect to.
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri,
                                      String username,
                                      String password)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        username - username
        password - password
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri,
                                      String username,
                                      String password,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        username - username
        password - password
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri,
                                      org.apache.http.auth.Credentials credentials)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • delete

        public static Response delete​(URI uri,
                                      org.apache.http.auth.Credentials credentials,
                                      org.apache.http.Header[] requestHeaders)
                               throws URISyntaxException,
                                      org.apache.http.HttpException
        Performs an HTTP DELETE on the given URI. Basic auth is used if both username and pw are not null.
        Parameters:
        uri - The URI to connect to.
        credentials - Instance implementing Credentials interface holding a set of credentials
        requestHeaders - Additional HTTP headers added to the request
        Returns:
        The HTTP response as Response object.
        Throws:
        URISyntaxException
        org.apache.http.HttpException
      • isSaneRequest

        public static boolean isSaneRequest​(javax.servlet.http.HttpServletRequest request)
        Checks if request and request method are not null
        Parameters:
        request - HttpServletRequest to check
        Returns:
        true if sane, false otherwise
      • isHttpGetRequest

        public static boolean isHttpGetRequest​(javax.servlet.http.HttpServletRequest request)
        Check if provided HttpServletRequest is a HTTP GET request
        Parameters:
        request - HttpServletRequest to check
        Returns:
        true if HTTP v, false otherwise
      • isHttpPostRequest

        public static boolean isHttpPostRequest​(javax.servlet.http.HttpServletRequest request)
        Check if provided HttpServletRequest is a HTTP POST request
        Parameters:
        request - HttpServletRequest to check
        Returns:
        true if HTTP POST, false otherwise
      • isFormMultipartPost

        public static boolean isFormMultipartPost​(javax.servlet.http.HttpServletRequest request)
        Check if provided HttpServletRequest is a FormMultipartPost
        Parameters:
        request - HttpServletRequest to check
        Returns:
        true if FormMultipartPost, false otherwise
      • getHeadersFromRequest

        public static org.apache.http.Header[] getHeadersFromRequest​(javax.servlet.http.HttpServletRequest request)
        Extract headers from HttpServletRequest
        Parameters:
        request - HttpServletRequest to extract headers from
        Returns:
        Array with Headers
      • getHttpTimeout

        public static int getHttpTimeout()
        Returns:
        the httpTimeout
      • setHttpTimeout

        public static void setHttpTimeout​(int httpTimeout)
        Parameters:
        httpTimeout - the httpTimeout to set
      • resetHttpTimeout

        public static void resetHttpTimeout()
        Resets the http timeout to the default one given by the app config.
      • setDefaultHttpTimeout

        @Value("${http.timeout}")
        public void setDefaultHttpTimeout​(int httpTimeout)
        Note: The value annotation is set to the setter of httpTimeout here as we can't autowire any value to its static field (but the field has to be static itself).
        Parameters:
        httpTimeout - the httpTimeout to set