public class HttpHelper extends Object
| Constructor and Description |
|---|
HttpHelper() |
| Modifier and Type | Method and Description |
|---|---|
static HttpResponse |
get(String url,
org.apache.http.impl.client.HttpClientBuilder builder)
Convenience method of
get(String, HttpClientBuilder, HttpClientContext) with
a default client context. |
static HttpResponse |
get(String url,
org.apache.http.impl.client.HttpClientBuilder builder,
org.apache.http.client.protocol.HttpClientContext context)
A generic implementation to do GET requests will automatic resource clean up.
|
static org.apache.http.impl.client.HttpClientBuilder |
getBuilder(String repoCredId,
ArtifactRepoParamProxy proxy,
boolean ignoreSSL)
Returns an opinionated and preconfigured HttpClient builder object.
|
static Optional<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> |
getCredentials(String credId)
Get the Jenkins credentials object of type StandardUsernamePasswordCredentials identified by
the provided ID string.
|
static org.apache.http.HttpHost |
getHttpHostFromUrl(String urlString)
Takes a URL string and creates a
HttpHost object of it. |
public static HttpResponse get(@Nonnull String url, @Nonnull org.apache.http.impl.client.HttpClientBuilder builder, @Nonnull org.apache.http.client.protocol.HttpClientContext context)
url - The URL to callbuilder - The builder object used to create the HttpClient.context - A possible context object to add to the request. Can be used to perform
pre-emptive authentication (required by Nexus).HttpResponse with both return code and response payload.public static HttpResponse get(@Nonnull String url, @Nonnull org.apache.http.impl.client.HttpClientBuilder builder)
get(String, HttpClientBuilder, HttpClientContext) with
a default client context.public static org.apache.http.impl.client.HttpClientBuilder getBuilder(String repoCredId, ArtifactRepoParamProxy proxy, boolean ignoreSSL)
repoCredId - The ID of the credentials object that should get used to authenticate at the
target repository instance.proxy - A proxy object with all the proxy information in it.ignoreSSL - Whether or not to ignore invalid SSL certificates (e. g. self-signed).HttpClientBuilder object with some pre-defined configuraitons.public static Optional<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> getCredentials(String credId)
public static org.apache.http.HttpHost getHttpHostFromUrl(@Nonnull String urlString) throws MalformedURLException
HttpHost object of it.MalformedURLExceptionCopyright © 2016–2021. All rights reserved.