|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rcarz.jiraclient.RestClient
public class RestClient
A simple REST client that speaks JSON.
Constructor Summary | |
---|---|
RestClient(org.apache.http.client.HttpClient httpclient,
URI uri)
Creates a REST client instance with a URI. |
Method Summary | |
---|---|
URI |
buildURI(String path)
Build a URI from a path. |
URI |
buildURI(String path,
Map<String,String> params)
Build a URI from a path and query parmeters. |
net.sf.json.JSON |
delete(String path)
Executes an HTTP DELETE with the given path. |
net.sf.json.JSON |
delete(URI uri)
Executes an HTTP DELETE with the given URI. |
net.sf.json.JSON |
get(String path)
Executes an HTTP GET with the given path. |
net.sf.json.JSON |
get(URI uri)
Executes an HTTP GET with the given URI. |
net.sf.json.JSON |
post(String path,
net.sf.json.JSON payload)
Executes an HTTP POST with the given path and payload. |
net.sf.json.JSON |
post(URI uri,
net.sf.json.JSON payload)
Executes an HTTP POST with the given URI and payload. |
net.sf.json.JSON |
post(URI uri,
String payload)
Executes an HTTP POST with the given URI and payload. |
net.sf.json.JSON |
put(String path,
net.sf.json.JSON payload)
Executes an HTTP PUT with the given path and payload. |
net.sf.json.JSON |
put(URI uri,
net.sf.json.JSON payload)
Executes an HTTP PUT with the given URI and payload. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RestClient(org.apache.http.client.HttpClient httpclient, URI uri)
httpclient
- Underlying HTTP client to useuri
- Base URI of the remote REST serviceMethod Detail |
---|
public URI buildURI(String path) throws URISyntaxException
path
- Path to append to the base URI
URISyntaxException
- when the path is invalidpublic URI buildURI(String path, Map<String,String> params) throws URISyntaxException
path
- Path to append to the base URIparams
- Map of key value pairs
URISyntaxException
- when the path is invalidpublic net.sf.json.JSON delete(URI uri) throws RestException, IOException
uri
- Full URI of the remote endpoint
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurspublic net.sf.json.JSON delete(String path) throws RestException, IOException, URISyntaxException
path
- Path to be appended to the URI supplied in the construtor
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurs
URISyntaxException
- when an error occurred appending the path to the URIpublic net.sf.json.JSON get(URI uri) throws RestException, IOException
uri
- Full URI of the remote endpoint
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurspublic net.sf.json.JSON get(String path) throws RestException, IOException, URISyntaxException
path
- Path to be appended to the URI supplied in the construtor
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurs
URISyntaxException
- when an error occurred appending the path to the URIpublic net.sf.json.JSON post(URI uri, net.sf.json.JSON payload) throws RestException, IOException
uri
- Full URI of the remote endpointpayload
- JSON-encoded data to send to the remote service
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurspublic net.sf.json.JSON post(URI uri, String payload) throws RestException, IOException
uri
- Full URI of the remote endpointpayload
- Raw string to send to the remote service
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurshttps://jira.atlassian.com/browse/JRA-29304
public net.sf.json.JSON post(String path, net.sf.json.JSON payload) throws RestException, IOException, URISyntaxException
path
- Path to be appended to the URI supplied in the construtorpayload
- JSON-encoded data to send to the remote service
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurs
URISyntaxException
- when an error occurred appending the path to the URIpublic net.sf.json.JSON put(URI uri, net.sf.json.JSON payload) throws RestException, IOException
uri
- Full URI of the remote endpointpayload
- JSON-encoded data to send to the remote service
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurspublic net.sf.json.JSON put(String path, net.sf.json.JSON payload) throws RestException, IOException, URISyntaxException
path
- Path to be appended to the URI supplied in the construtorpayload
- JSON-encoded data to send to the remote service
RestException
- when an HTTP-level error occurs
IOException
- when an error reading the response occurs
URISyntaxException
- when an error occurred appending the path to the URI
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |