Skip to content

Commit

Permalink
Use form post for posting history event instead of GET
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Apr 10, 2012
1 parent 054d4b2 commit e544ee3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
Expand Up @@ -176,7 +176,7 @@ public void reportExecutionStatus(final String project, final String title, fina

final WebserviceResponse response;
try {
response = serverService.makeRundeckRequest(RUNDECK_API_EXECUTION_REPORT, params, null, null);
response = serverService.makeRundeckRequest(RUNDECK_API_EXECUTION_REPORT, null, params);
} catch (MalformedURLException e) {
throw new CentralDispatcherServerRequestException("Failed to make request", e);
}
Expand Down
Expand Up @@ -96,6 +96,24 @@ public WebserviceResponse makeRundeckRequest(final String urlPath, final Map que
throws CoreException, MalformedURLException {
return makeRundeckRequest(urlPath, queryParams, uploadFile, method, null);
}
/**
* Make the request to the ItNav workbench.
*
* @param urlPath the path for the request
* @param queryParams any query parameters
* @param uploadFile a file to upload with the request.
* @param method HTTP connection method, e.g. "get","post","put","delete".
*
* @return parsed XML document, or null
*
* @throws com.dtolabs.rundeck.core.CoreException
* if an error occurs
* @throws java.net.MalformedURLException if connection URL or urlPath params are malformed.
*/
public WebserviceResponse makeRundeckRequest(final String urlPath, final Map queryParams, final Map<String,String> formData)
throws CoreException, MalformedURLException {
return makeRundeckRequest(urlPath, queryParams, null, null, null, formData);
}
/**
* Make the request to the ItNav workbench.
*
Expand All @@ -113,20 +131,50 @@ public WebserviceResponse makeRundeckRequest(final String urlPath, final Map que
public WebserviceResponse makeRundeckRequest(final String urlPath, final Map queryParams, final File uploadFile,
final String method, final String expectedContentType)
throws CoreException, MalformedURLException {
return makeRundeckRequest(urlPath, queryParams, uploadFile, method, expectedContentType, null);
}
/**
* Make the request to the ItNav workbench.
*
* @param urlPath the path for the request
* @param queryParams any query parameters
* @param uploadFile a file to upload with the request.
* @param method HTTP connection method, e.g. "get","post","put","delete".
*
* @return parsed XML document, or null
*
* @throws com.dtolabs.rundeck.core.CoreException
* if an error occurs
* @throws java.net.MalformedURLException if connection URL or urlPath params are malformed.
*/
public WebserviceResponse makeRundeckRequest(final String urlPath, final Map queryParams, final File uploadFile,
final String method, final String expectedContentType, final Map<String,String> formData)
throws CoreException, MalformedURLException {
if (null == connParams) {
throw new IllegalArgumentException("WebConnectionParameters must be specified");
}

final URL jcUrl = new URL(connParams.getServerUrl());
final String jcBasePath = jcUrl.getPath();
final WebserviceHttpClient hc = WebserviceHttpClientFactory.getInstance().getWebserviceHttpClient(jcUrl
final WebserviceHttpClient hc ;
if(null==formData){
hc= WebserviceHttpClientFactory.getInstance().getWebserviceHttpClient(jcUrl
+ urlPath,
jcBasePath,
connParams.getUsername(),
connParams.getPassword(),
queryParams,
uploadFile,
"xmlBatch",null,expectedContentType);
}else{
hc = WebserviceHttpClientFactory.getInstance().getWebserviceHttpClient(jcUrl
+ urlPath,
jcBasePath,
connParams.getUsername(),
connParams.getPassword(),
queryParams,
formData);
}
if (null != method) {
hc.setMethodType(method);
}
Expand Down

0 comments on commit e544ee3

Please sign in to comment.