Class HttpUtil
- java.lang.Object
-
- de.terrestris.shoguncore.util.http.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 Responsedelete(String url)Performs an HTTP DELETE on the given URL.static Responsedelete(String url, String username, String password)Performs an HTTP DELETE on the given URL.static Responsedelete(String url, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URL.static Responsedelete(String url, org.apache.http.auth.Credentials credentials)Performs an HTTP DELETE on the given URL.static Responsedelete(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URL.static Responsedelete(String url, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URL.static Responsedelete(URI uri)Performs an HTTP DELETE on the given URI.static Responsedelete(URI uri, String username, String password)Performs an HTTP DELETE on the given URI.static Responsedelete(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URI.static Responsedelete(URI uri, org.apache.http.auth.Credentials credentials)Performs an HTTP DELETE on the given URI.static Responsedelete(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URI.static Responsedelete(URI uri, org.apache.http.Header[] requestHeaders)Performs an HTTP DELETE on the given URI.static ResponseforwardFormMultipartPost(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)Forward FormMultipartPost (HTTP POST) to uri based on given requeststatic ResponseforwardGet(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)Forward GET request to uri based on given requeststatic ResponseforwardPost(URI uri, javax.servlet.http.HttpServletRequest request, boolean forwardHeaders)Forward POST to uri based on given requeststatic Responseget(String url)Performs an HTTP GET on the given URL without authenticationstatic Responseget(String url, String username, String password)Performs an HTTP GET on the given URLstatic Responseget(String url, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP GET on the given URLstatic Responseget(String url, org.apache.http.auth.Credentials credentials)Performs an HTTP GET on the given URL.static Responseget(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP GET on the given URL.static Responseget(String url, org.apache.http.Header[] requestHeaders)Performs an HTTP GET on the given URL without authentication and additional HTTP request headers.static Responseget(URI uri)Performs an HTTP GET on the given URI.static Responseget(URI uri, String username, String password)Performs an HTTP GET on the given URI.static Responseget(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP GET on the given URI.static Responseget(URI uri, org.apache.http.auth.Credentials credentials)Performs an HTTP GET on the given URI.static Responseget(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP GET on the given URI.static Responseget(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 fromHttpServletRequeststatic intgetHttpTimeout()static booleanisFormMultipartPost(javax.servlet.http.HttpServletRequest request)Check if providedHttpServletRequestis a FormMultipartPoststatic booleanisHttpGetRequest(javax.servlet.http.HttpServletRequest request)Check if providedHttpServletRequestis a HTTP GET requeststatic booleanisHttpPostRequest(javax.servlet.http.HttpServletRequest request)Check if providedHttpServletRequestis a HTTP POST requeststatic booleanisSaneRequest(javax.servlet.http.HttpServletRequest request)Checks if request and request method are not nullstatic Responsepost(String url)Performs an HTTP POST on the given URL.static Responsepost(String url, File file)Performs an HTTP POST on the given URL.static Responsepost(String url, File file, String username, String password)Performs an HTTP POST on the given URL.static Responsepost(String url, File file, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, File file, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URL.static Responsepost(String url, File file, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, File file, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, String password, String username)Performs an HTTP POST on the given URL.static Responsepost(String url, String password, String username, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, String body, org.apache.http.entity.ContentType contentType)Performs an HTTP POST on the given URL.static Responsepost(String url, String body, org.apache.http.entity.ContentType contentType, String username, String password)Performs an HTTP POST on the given URL.static Responsepost(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 Responsepost(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 Responsepost(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 Responsepost(String url, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, List<org.apache.http.NameValuePair> queryParams)Performs an HTTP POST on the given URL.static Responsepost(String url, List<org.apache.http.NameValuePair> queryParams, String username, String password)Performs an HTTP POST on the given URL.static Responsepost(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 Responsepost(String url, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URL.static Responsepost(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 Responsepost(String url, List<org.apache.http.NameValuePair> queryParams, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URL.static Responsepost(String url, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(String url, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(URI uri)Performs an HTTP POST on the given URI.static Responsepost(URI uri, File file)Performs an HTTP POST on the given URL.static Responsepost(URI uri, File file, String username, String password)Performs an HTTP POST on the given URL.static Responsepost(URI uri, File file, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(URI uri, File file, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URL.static Responsepost(URI uri, File file, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(URI uri, File file, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(URI uri, String username, String password)Performs an HTTP POST on the given URI.static Responsepost(URI uri, String username, String password, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URI.static Responsepost(URI uri, String body, org.apache.http.entity.ContentType contentType)Performs an HTTP POST on the given URL.static Responsepost(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password)Performs an HTTP POST on the given URL.static Responsepost(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 Responsepost(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 Responsepost(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 Responsepost(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URL.static Responsepost(URI uri, List<org.apache.http.NameValuePair> queryParams)Performs an HTTP POST on the given URI.static Responsepost(URI uri, List<org.apache.http.NameValuePair> queryParams, String username, String password)Performs an HTTP POST on the given URI.static Responsepost(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 Responsepost(URI uri, List<org.apache.http.NameValuePair> queryParams, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URI.static Responsepost(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 Responsepost(URI uri, List<org.apache.http.NameValuePair> queryParams, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URI.static Responsepost(URI uri, org.apache.http.auth.Credentials credentials)Performs an HTTP POST on the given URI.static Responsepost(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URI.static Responsepost(URI uri, org.apache.http.Header[] requestHeaders)Performs an HTTP POST on the given URI.static Responseput(String uriString)Perform HTTP PUT with empty bodystatic Responseput(String uriString, File body, org.apache.http.entity.ContentType contentType, String username, String password)Performs an HTTP PUT on the given URL.static Responseput(String uriString, String username, String password)Perform HTTP PUT with empty bodystatic Responseput(String uriString, String username, String password, org.apache.http.Header[] requestHeaders)Perform HTTP PUT with empty bodystatic Responseput(String uriString, String body, org.apache.http.entity.ContentType contentType)Performs an HTTP PUT on the given URL.static Responseput(String uriString, String body, org.apache.http.entity.ContentType contentType, String username, String password)Performs an HTTP PUT on the given URL.static Responseput(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 Responseput(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 Responseput(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 Responseput(String uriString, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)Performs an HTTP PUT on the given URL.static Responseput(String uriString, org.apache.http.auth.Credentials credentials)Perform HTTP PUT with empty bodystatic Responseput(String uriString, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Perform HTTP PUT with empty bodystatic Responseput(String uriString, org.apache.http.Header[] requestHeaders)Perform HTTP PUT with empty bodystatic Responseput(URI uri)Perform HTTP PUT with empty bodystatic Responseput(URI uri, String username, String password)Perform HTTP PUT with empty body Basic auth will be used if both username and password are not nullstatic Responseput(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 nullstatic Responseput(URI uri, String body, org.apache.http.entity.ContentType contentType)Performs an HTTP PUT on the given URL.static Responseput(URI uri, String body, org.apache.http.entity.ContentType contentType, String username, String password)Performs an HTTP PUT on the given URL.static Responseput(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 Responseput(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 Responseput(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 Responseput(URI uri, String body, org.apache.http.entity.ContentType contentType, org.apache.http.Header[] requestHeaders)Performs an HTTP PUT on the given URL.static Responseput(URI uri, org.apache.http.auth.Credentials credentials)Perform HTTP PUT with empty bodystatic Responseput(URI uri, org.apache.http.auth.Credentials credentials, org.apache.http.Header[] requestHeaders)Perform HTTP PUT with empty bodystatic Responseput(URI uri, org.apache.http.Header[] requestHeaders)Perform HTTP PUT with empty bodystatic voidresetHttpTimeout()Resets the http timeout to the default one given by the app config.voidsetDefaultHttpTimeout(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 voidsetHttpTimeout(int httpTimeout)
-
-
-
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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 - usernamepassword- Credentials - password- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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 - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 originalHttpServletRequestforwardHeaders- Should headers of request should be forwarded- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.apache.http.HttpException
-
post
public static Response post(String url) throws URISyntaxException, UnsupportedEncodingException, org.apache.http.HttpException
Performs an HTTP POST on the given URL.- Parameters:
url- The URL to connect to.- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(String url, 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.requestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(String url, String password, String username) 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 - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(URI uri) throws URISyntaxException, UnsupportedEncodingException, org.apache.http.HttpException
Performs an HTTP POST on the given URI.- Parameters:
uri- The URI to connect to.- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(URI uri, 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.requestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(URI uri, 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.username- Credentials - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(String url, List<org.apache.http.NameValuePair> queryParams) 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.- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(String url, 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 URL.- Parameters:
url- The URL to connect to.queryParams- The list of NameValuePairs.requestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(String url, List<org.apache.http.NameValuePair> queryParams, String username, String password) 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 - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.apache.http.HttpException
-
post
public static Response post(URI uri, List<org.apache.http.NameValuePair> queryParams) 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.- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionUnsupportedEncodingExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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 bodyusername- Credentials - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 bodyusername- Credentials - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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 - usernamepassword- Credentials - password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 - usernamepassword- Credentials - passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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- usernamepassword- password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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- usernamepassword- password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 originalHttpServletRequestforwardHeaders- Should headers of request should be forwarded- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.apache.http.HttpExceptionIllegalStateExceptionIOExceptionjavax.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 originalHttpServletRequestforwardHeaders- Should headers of request should be forwarded- Returns:
- Throws:
URISyntaxExceptionorg.apache.http.HttpException
-
put
public static Response put(URI uri) throws URISyntaxException, org.apache.http.HttpException
Perform HTTP PUT with empty body- Parameters:
uri-- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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.HttpExceptionURISyntaxException
-
put
public static Response put(String uriString) throws URISyntaxException, org.apache.http.HttpException
Perform HTTP PUT with empty body- Parameters:
uriString-- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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.HttpExceptionURISyntaxException
-
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 tousername- usernamepassword- password- Returns:
- Throws:
URISyntaxExceptionorg.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 tousername- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
URISyntaxExceptionorg.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 tocredentials- Instance implementingCredentialsinterface holding a set of credentials- Returns:
- Throws:
URISyntaxExceptionorg.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 tocredentials- Instance implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
URISyntaxExceptionorg.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 tousername- usernamepassword- password- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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 tousername- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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 tocredentials- Instance implementingCredentialsinterface holding a set of credentials- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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 tocredentials- Instance implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
org.apache.http.HttpExceptionURISyntaxException
-
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 tobody-contentType-- Returns:
- Throws:
URISyntaxExceptionorg.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 tobody-contentType-requestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
URISyntaxExceptionorg.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 tobody-contentType-username-password-- Returns:
- Throws:
URISyntaxExceptionorg.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 tobody-contentType-username-password-requestHeaders- Additional HTTP headers added to the request- Returns:
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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- usernamepassword- password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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:
URISyntaxExceptionorg.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- usernamepassword- password- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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- usernamepassword- passwordrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentials- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.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 implementingCredentialsinterface holding a set of credentialsrequestHeaders- Additional HTTP headers added to the request- Returns:
- The HTTP response as Response object.
- Throws:
URISyntaxExceptionorg.apache.http.HttpException
-
isSaneRequest
public static boolean isSaneRequest(javax.servlet.http.HttpServletRequest request)
Checks if request and request method are not null- Parameters:
request-HttpServletRequestto check- Returns:
- true if sane, false otherwise
-
isHttpGetRequest
public static boolean isHttpGetRequest(javax.servlet.http.HttpServletRequest request)
Check if providedHttpServletRequestis a HTTP GET request- Parameters:
request-HttpServletRequestto check- Returns:
- true if HTTP v, false otherwise
-
isHttpPostRequest
public static boolean isHttpPostRequest(javax.servlet.http.HttpServletRequest request)
Check if providedHttpServletRequestis a HTTP POST request- Parameters:
request-HttpServletRequestto check- Returns:
- true if HTTP POST, false otherwise
-
isFormMultipartPost
public static boolean isFormMultipartPost(javax.servlet.http.HttpServletRequest request)
Check if providedHttpServletRequestis a FormMultipartPost- Parameters:
request-HttpServletRequestto check- Returns:
- true if FormMultipartPost, false otherwise
-
getHeadersFromRequest
public static org.apache.http.Header[] getHeadersFromRequest(javax.servlet.http.HttpServletRequest request)
Extract headers fromHttpServletRequest- Parameters:
request-HttpServletRequestto 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
-
-