Class HttpHelper
java.lang.Object
org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 encodingprotected 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)
-
Field Details
-
HTTP_GET
- See Also:
-
HTTP_POST
- See Also:
-
-
Constructor Details
-
HttpHelper
public HttpHelper()
-
-
Method Details
-
buildUrlQueryString
Return the Collection<String> in an encoded query-string.- Parameters:
parameters
- the parameters needed to trigger the remote job.- Returns:
- query-parameter-formated URL-encoded string.
-
generateJobUrl
protected static String generateJobUrl(RemoteJenkinsServer remoteServer, String jobNameOrUrl) throws AbortException - Throws:
AbortException
-
encodeValue
Helper function for character encoding- Parameters:
dirtyValue
- something that wasn't encoded in UTF-8- Returns:
- encoded value
-
buildTriggerUrl
public static String buildTriggerUrl(String jobNameOrUrl, String securityToken, boolean isRemoteJobParameterized, BuildContext context) throws IOException Build the proper URL to trigger the remote build All passed in string have already had their tokens replaced with real values. All 'params' also have the proper character encoding- Parameters:
jobNameOrUrl
- Name of the remote jobsecurityToken
- Security token used to trigger remote jobisRemoteJobParameterized
- Is the remote job parameterizedcontext
- The build context used in this plugin- Returns:
- fully formed, fully qualified remote trigger URL
- Throws:
IOException
- throw when it can't pass data checking
-
tryPost
public 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- Throws:
IOException
InterruptedException
-
tryGet
public static ConnectionResponse tryGet(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, Semaphore lock) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
tryGetRawResp
public static String tryGetRawResp(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth, Semaphore lock) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
post
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- Throws:
IOException
InterruptedException
-
get
public static ConnectionResponse get(String urlString, BuildContext context, int readTimeout, int pollInterval, int retryLimit, Auth2 overrideAuth) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
getRawResp
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 - Throws:
IOException
InterruptedException
-