public class JenkinsHttpClient extends Object
| Constructor and Description |
|---|
JenkinsHttpClient(URI uri)
Create an unauthenticated Jenkins HTTP client
|
JenkinsHttpClient(URI uri,
String username,
String password)
Create an authenticated Jenkins HTTP client
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(String path)
Perform a GET request and parse the response and return a simple string of the content
|
<T extends BaseModel> |
get(String path,
Class<T> cls)
Perform a GET request and parse the response to the given class
|
String |
post_xml(String path,
String xml_data)
Perform a POST request of XML (instead of using json mapper) and return a string rendering of the response entity.
|
void |
post(String path)
Perform POST request that takes no parameters and returns no response
|
<R extends BaseModel,D> |
post(String path,
D data,
Class<R> cls)
Perform a POST request and parse the response to the given class
|
public JenkinsHttpClient(URI uri)
uri - Location of the jenkins server (ex. http://localhost:8080)public JenkinsHttpClient(URI uri, String username, String password)
uri - Location of the jenkins server (ex. http://localhost:8080)username - Username to use when connectingpassword - Password or auth token to use when connectingpublic <T extends BaseModel> T get(String path, Class<T> cls) throws IOException, org.apache.http.client.HttpResponseException
T - type of the responsepath - path to request, can be relative or absolutecls - class of the responseIOException, - HttpResponseExceptionIOExceptionorg.apache.http.client.HttpResponseExceptionpublic String get(String path) throws IOException, org.apache.http.client.HttpResponseException
path - path to request, can be relative or absoluteIOException, - HttpResponseExceptionIOExceptionorg.apache.http.client.HttpResponseExceptionpublic <R extends BaseModel,D> R post(String path, D data, Class<R> cls) throws IOException, org.apache.http.client.HttpResponseException
R - type of the responseD - type of the datapath - path to request, can be relative or absolutedata - data to postcls - class of the responseIOException, - HttpResponseExceptionIOExceptionorg.apache.http.client.HttpResponseExceptionpublic String post_xml(String path, String xml_data) throws IOException, org.apache.http.client.HttpResponseException
path - path to request, can be relative or absoluteXML - data data to postIOException, - HttpResponseExceptionIOExceptionorg.apache.http.client.HttpResponseExceptionpublic void post(String path) throws IOException, org.apache.http.client.HttpResponseException
path - path to requestIOException, - HttpResponseExceptionIOExceptionorg.apache.http.client.HttpResponseExceptionCopyright © 2013. All Rights Reserved.