Package jetbrains.buildServer.http
Class HttpUtil
- java.lang.Object
-
- jetbrains.buildServer.http.HttpUtil
-
public class HttpUtil extends Object
- Author:
- Pavel.Sher Date: 09.04.2009
-
-
Field Summary
Fields Modifier and Type Field Description static StringHTTP_CLIENT_OPTION_PREFIXstatic StringHTTP_CLIENT_OPTION_SOCKET_RECEIVE_BUFFERstatic StringHTTP_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 StringcomposeHttpErrorMessage(org.apache.commons.httpclient.StatusLine status, String errorMessagePrefix)static voidconfigureProxy(org.apache.commons.httpclient.HttpClient client, String proxyHost, int proxyPort, SimpleCredentials proxyCredentials)static org.apache.commons.httpclient.HttpClientcreateHttpClient(int connectionTimeoutSeconds)Creates new HTTP client with specified timeout and credentials set for basic authenticationstatic org.apache.commons.httpclient.HttpClientcreateHttpClient(int connectionTimeoutSeconds, 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.HttpClientcreateHttpClient(int connectionTimeoutSeconds, URL url, org.apache.commons.httpclient.Credentials credentials, boolean isBasicAuth)Creates new HTTP client with specified timeout and credentialsstatic org.apache.commons.httpclient.HttpConnectionManagercreateMultiThreadedHttpConnectionManager(int connectionTimeoutSeconds)Creates newMultiThreadedHttpConnectionManagerwith specified timeoutsstatic org.apache.commons.httpclient.HttpConnectionManagercreateMultiThreadedHttpConnectionManager(int responseTimeoutSeconds, int connectionTimeoutSeconds)static org.apache.commons.httpclient.methods.GetMethodgetMethod(org.apache.commons.httpclient.HttpClient client, String url, KeyStore trustStore)static StringgetRedirectUrl(org.apache.commons.httpclient.HttpMethodBase method)Checks if method response is a redirect and return redirect url if it isstatic voidpatchHttpConnectionParameters(org.apache.commons.httpclient.params.HttpConnectionManagerParams parametersToPatch)Patch http connection manager parameters with tc-specific valuesstatic org.apache.commons.httpclient.methods.PostMethodpostMethod(org.apache.commons.httpclient.HttpClient client, String url, KeyStore trustStore)static org.apache.commons.httpclient.methods.PostMethodpostMethod(org.apache.commons.httpclient.HttpClient client, String url, KeyStore trustStore, boolean followRedirects)
-
-
-
Field Detail
-
HTTP_CLIENT_OPTION_PREFIX
public static final String HTTP_CLIENT_OPTION_PREFIX
- See Also:
- Constant Field Values
-
HTTP_CLIENT_OPTION_SOCKET_SEND_BUFFER
public static final String HTTP_CLIENT_OPTION_SOCKET_SEND_BUFFER
- See Also:
- Constant Field Values
-
HTTP_CLIENT_OPTION_SOCKET_RECEIVE_BUFFER
public static final 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 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 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 newMultiThreadedHttpConnectionManagerwith specified timeouts- Since:
- 2019.2.1
-
createMultiThreadedHttpConnectionManager
public static org.apache.commons.httpclient.HttpConnectionManager createMultiThreadedHttpConnectionManager(int responseTimeoutSeconds, int connectionTimeoutSeconds)
-
postMethod
public static org.apache.commons.httpclient.methods.PostMethod postMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull String url, @Nullable KeyStore trustStore) throws MalformedURLException- Throws:
MalformedURLException
-
postMethod
public static org.apache.commons.httpclient.methods.PostMethod postMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull String url, @Nullable KeyStore trustStore, boolean followRedirects) throws MalformedURLException- Throws:
MalformedURLException
-
getMethod
public static org.apache.commons.httpclient.methods.GetMethod getMethod(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull String url, @Nullable KeyStore trustStore) throws MalformedURLException- Throws:
MalformedURLException
-
configureProxy
public static void configureProxy(@NotNull org.apache.commons.httpclient.HttpClient client, @NotNull String proxyHost, int proxyPort, @Nullable SimpleCredentials proxyCredentials)
-
composeHttpErrorMessage
public static String composeHttpErrorMessage(org.apache.commons.httpclient.StatusLine status, 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 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
-
-