public class HttpHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HTTP_GET |
static String |
HTTP_POST |
Constructor and Description |
---|
HttpHelper() |
Modifier and Type | Method and Description |
---|---|
static String |
buildTriggerUrl(String jobNameOrUrl,
String securityToken,
boolean isRemoteJobParameterized,
BuildContext context)
Build the proper URL to trigger the remote build
All passed in string have already had their tokens replaced with real values.
|
static String |
buildUrlQueryString(Map<String,String> parameters)
Return the Collection<String> in an encoded query-string.
|
static String |
encodeValue(String dirtyValue)
Helper function for character encoding
|
protected static String |
generateJobUrl(RemoteJenkinsServer remoteServer,
String jobNameOrUrl) |
static ConnectionResponse |
get(String urlString,
BuildContext context,
int readTimeout,
int pollInterval,
int retryLimit,
Auth2 overrideAuth) |
static String |
getRawResp(String urlString,
String requestType,
BuildContext context,
Collection<String> postParams,
int readTimeout,
int numberOfAttempts,
int pollInterval,
int retryLimit,
Auth2 overrideAuth) |
static ConnectionResponse |
post(String urlString,
BuildContext context,
Map<String,String> params,
int readTimeout,
int pollInterval,
int retryLimit,
Auth2 overrideAuth,
boolean isCrubmCacheEnabled) |
static ConnectionResponse |
tryGet(String urlString,
BuildContext context,
int readTimeout,
int pollInterval,
int retryLimit,
Auth2 overrideAuth,
Semaphore lock) |
static String |
tryGetRawResp(String urlString,
BuildContext context,
int readTimeout,
int pollInterval,
int retryLimit,
Auth2 overrideAuth,
Semaphore lock) |
static ConnectionResponse |
tryPost(String urlString,
BuildContext context,
Map<String,String> params,
int readTimeout,
int pollInterval,
int retryLimit,
Auth2 overrideAuth,
Semaphore lock,
boolean isCrubmCacheEnabled) |
public static final String HTTP_GET
public static final String HTTP_POST
public static String buildUrlQueryString(@NonNull Map<String,String> parameters)
parameters
- the parameters needed to trigger the remote job.protected static String generateJobUrl(RemoteJenkinsServer remoteServer, String jobNameOrUrl) throws AbortException
AbortException
public static String encodeValue(String dirtyValue)
dirtyValue
- something that wasn't encoded in UTF-8public static String buildTriggerUrl(String jobNameOrUrl, String securityToken, boolean isRemoteJobParameterized, BuildContext context) throws IOException
jobNameOrUrl
- Name of the remote jobsecurityToken
- Security token used to trigger remote jobisRemoteJobParameterized
- Is the remote job parameterizedcontext
- The build context used in this pluginIOException
- throw when it can't pass data checkingpublic static ConnectionResponse tryPost(String urlString, BuildContext context, Map<String,String> params, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, Semaphore lock, boolean isCrubmCacheEnabled) throws IOException, InterruptedException
IOException
InterruptedException
public static ConnectionResponse tryGet(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, Semaphore lock) throws IOException, InterruptedException
IOException
InterruptedException
public static String tryGetRawResp(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, Semaphore lock) throws IOException, InterruptedException
IOException
InterruptedException
public static ConnectionResponse post(String urlString, BuildContext context, Map<String,String> params, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, boolean isCrubmCacheEnabled) throws IOException, InterruptedException
IOException
InterruptedException
public static ConnectionResponse get(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth) throws IOException, InterruptedException
IOException
InterruptedException
public static String getRawResp(String urlString, String requestType, BuildContext context, Collection<String> postParams, int readTimeout, int numberOfAttempts, int pollInterval, int retryLimit, Auth2 overrideAuth) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2016–2023. All rights reserved.