Package jetbrains.buildServer.http
Class HttpUtil
- java.lang.Object
-
- jetbrains.buildServer.http.HttpUtil
-
public class HttpUtil extends java.lang.Object
- Author:
- Pavel.Sher Date: 09.04.2009
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HTTP_CLIENT_OPTION_PREFIX
static java.lang.String
HTTP_CLIENT_OPTION_SOCKET_RECEIVE_BUFFER
static java.lang.String
HTTP_CLIENT_OPTION_SOCKET_SEND_BUFFER
-
Constructor Summary
Constructors Constructor Description HttpUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
composeHttpErrorMessage(org.apache.commons.httpclient.StatusLine status, java.lang.String errorMessagePrefix)
static void
configureProxy(org.apache.commons.httpclient.HttpClient client, java.lang.String proxyHost, int proxyPort, SimpleCredentials proxyCredentials)
static org.apache.commons.httpclient.HttpClient
createHttpClient(int connectionTimeoutSeconds)
Creates new HTTP client with specified timeout and credentials set for basic authenticationstatic org.apache.commons.httpclient.HttpClient
createHttpClient(int connectionTimeoutSeconds, java.net.URL url, org.apache.commons.httpclient.Credentials credentials)
Creates new HTTP client with specified timeout and credentials set for basic authenticationstatic org.apache.commons.httpclient.HttpClient
createHttpClient(int connectionTimeoutSeconds, java.net.URL url, org.apache.commons.httpclient.Credentials credentials, boolean isBasicAuth)
Creates new HTTP client with specified timeout and credentialsstatic org.apache.commons.httpclient.HttpConnectionManager
createMultiThreadedHttpConnectionManager(int connectionTimeoutSeconds)
Creates newMultiThreadedHttpConnectionManager
with specified timeoutsstatic org.apache.commons.httpclient.methods.GetMethod
getMethod(org.apache.commons.httpclient.HttpClient client, java.lang.String url, java.security.KeyStore trustStore)
static java.lang.String
getRedirectUrl(org.apache.commons.httpclient.HttpMethodBase method)
Checks if method response is a redirect and return redirect url if it isstatic void
patchHttpConnectionParameters(org.apache.commons.httpclient.params.HttpConnectionManagerParams parametersToPatch)
Patch http connection manager parameters with tc-specific valuesstatic org.apache.commons.httpclient.methods.PostMethod
postMethod(org.apache.commons.httpclient.HttpClient client, java.lang.String url, java.security.KeyStore trustStore)
static org.apache.commons.httpclient.methods.PostMethod
postMethod(org.apache.commons.httpclient.HttpClient client, java.lang.String url, java.security.KeyStore trustStore, boolean followRedirects)
-
-
-
Field Detail
-
HTTP_CLIENT_OPTION_PREFIX
public static final java.lang.String HTTP_CLIENT_OPTION_PREFIX
- See Also:
- Constant Field Values
-
HTTP_CLIENT_OPTION_SOCKET_SEND_BUFFER
public static final java.lang.String HTTP_CLIENT_OPTION_SOCKET_SEND_BUFFER
- See Also:
- Constant Field Values
-
HTTP_CLIENT_OPTION_SOCKET_RECEIVE_BUFFER
public static final java.lang.String HTTP_CLIENT_OPTION_SOCKET_RECEIVE_BUFFER
- See Also:
- Constant Field Values
-
-
Method Detail
-
createHttpClient
@NotNull public static org.apache.commons.httpclient.HttpClient createHttpClient(int connectionTimeoutSeconds, @Nullable java.net.URL url, @Nullable org.apache.commons.httpclient.Credentials credentials)
Creates new HTTP client with specified timeout and credentials set for basic authentication- Parameters:
connectionTimeoutSeconds
- socket read & connection timeout (seconds)url
- url to set auth scopecredentials
- credentials to set AuthScope- Returns:
- new HTTP client instance
-
createHttpClient
@NotNull public static org.apache.commons.httpclient.HttpClient createHttpClient(int connectionTimeoutSeconds, @Nullable java.net.URL url, @Nullable org.apache.commons.httpclient.Credentials credentials, boolean isBasicAuth)
Creates new HTTP client with specified timeout and credentials- Parameters:
connectionTimeoutSeconds
- socket read & connection timeout (seconds)url
- url to set auth scopecredentials
- credentials to set AuthScopeisBasicAuth
- true if basic authentication is used, false otherwise- Returns:
- new HTTP client instance
-
createHttpClient
@NotNull public static org.apache.commons.httpclient.HttpClient createHttpClient(int connectionTimeoutSeconds)
Creates new HTTP client with specified timeout and credentials set for basic authentication- Parameters:
connectionTimeoutSeconds
- socket read & connection timeout (seconds)- Returns:
- new HTTP client instance
-
createMultiThreadedHttpConnectionManager
@NotNull public static org.apache.commons.httpclient.HttpConnectionManager createMultiThreadedHttpConnectionManager(int connectionTimeoutSeconds)
Creates newMultiThreadedHttpConnectionManager
with specified timeouts- Since:
- 2019.2.1
-
postMethod
public static org.apache.commons.httpclient.methods.PostMethod postMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull java.lang.String url, @Nullable java.security.KeyStore trustStore) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
postMethod
public static org.apache.commons.httpclient.methods.PostMethod postMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull java.lang.String url, @Nullable java.security.KeyStore trustStore, boolean followRedirects) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
getMethod
public static org.apache.commons.httpclient.methods.GetMethod getMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull java.lang.String url, @Nullable java.security.KeyStore trustStore) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
configureProxy
public static void configureProxy(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull java.lang.String proxyHost, int proxyPort, @Nullable SimpleCredentials proxyCredentials)
-
composeHttpErrorMessage
public static java.lang.String composeHttpErrorMessage(org.apache.commons.httpclient.StatusLine status, java.lang.String errorMessagePrefix)
-
patchHttpConnectionParameters
public static void patchHttpConnectionParameters(@NotNull org.apache.commons.httpclient.params.HttpConnectionManagerParams parametersToPatch)
Patch http connection manager parameters with tc-specific values- Parameters:
parametersToPatch
-HttpConnectionManagerParams
- Since:
- 2019.2
-
getRedirectUrl
@Nullable public static java.lang.String getRedirectUrl(org.apache.commons.httpclient.HttpMethodBase method)
Checks if method response is a redirect and return redirect url if it is- Since:
- 2019.1.2
-
-