public class SimpleRESTClient
extends java.lang.Object
Constructor and Description |
---|
SimpleRESTClient(java.lang.String URL) |
SimpleRESTClient(java.lang.String URL,
java.lang.String userAgent) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
delete()
Sends a DELETE request to the base URL
|
java.lang.String |
delete(java.lang.String URI)
Sends a DELETE to the given URI from the base URL
|
static java.lang.String |
deleteAt(java.lang.String URL)
Sends a DELETE to the given URL
|
java.lang.String |
get()
Sends a GET request with no parameters to the base URL
|
java.lang.String |
get(java.util.Map<java.lang.String,java.lang.String> parameters)
Sends a GET request with the given parameters to the base URL
|
java.lang.String |
get(java.lang.String URI)
Sends a GET request with no parameters to the given URI from the base URL
|
java.lang.String |
get(java.lang.String URI,
java.util.Map<java.lang.String,java.lang.String> parameters)
Sends a GET request with the given parameters to the given URI from the
base URL
|
static java.lang.String |
getFrom(java.lang.String URL)
Sends a GET request with no parameters to the given URL
|
static java.lang.String |
getFrom(java.lang.String URL,
java.util.Map<java.lang.String,java.lang.String> parameters)
Sends a GET request with the given parameters to the given URL
|
java.lang.String |
post(java.lang.String postContent)
Sends a POST request with the given content to the base URL using the
"test/plain" MIME type
|
java.lang.String |
post(java.lang.String contentType,
java.lang.String postContent)
Sends a POST request with the given content to the base URL using the
given MIME type
|
java.lang.String |
post(java.lang.String URI,
java.lang.String contentType,
java.lang.String postContent)
Sends a POST request with the given content to the given URI from the
base URL using the given MIME type
|
static java.lang.String |
postTo(java.lang.String URL,
java.lang.String postContent)
Sends a POST request with the given content to the given URL using the
"text/plain" MIME type
|
static java.lang.String |
postTo(java.lang.String URL,
java.lang.String contentType,
java.lang.String postContent)
Sends a POST request with the given content to the given URL using the
given MIME type
|
java.lang.String |
put(java.lang.String putContent)
Sends a PUT request with the given content to the base URL using the
"test/plain" MIME type
|
java.lang.String |
put(java.lang.String contentType,
java.lang.String putContent)
Sends a PUT request with the given content to the base URL using the
given MIME type
|
java.lang.String |
put(java.lang.String URI,
java.lang.String contentType,
java.lang.String putContent)
Sends a PUT request with the given content to the given URI from the base
URL using the given MIME type
|
static java.lang.String |
putTo(java.lang.String URL,
java.lang.String putContent)
Sends a PUT request with the given content to the given URL using the
"text/plain" MIME type
|
static java.lang.String |
putTo(java.lang.String URL,
java.lang.String contentType,
java.lang.String putContent)
Sends a PUT request with the given content to the given URL using the
given MIME type
|
java.lang.String |
toString() |
public SimpleRESTClient(java.lang.String URL)
URL
- the base URL that the REST requests are being made topublic SimpleRESTClient(java.lang.String URL, java.lang.String userAgent)
URL
- the base URL that the REST requests are being made touserAgent
- the user agent to send with requestspublic static java.lang.String deleteAt(java.lang.String URL) throws java.io.IOException
URL
- the URL to send a delete request tojava.io.IOException
- if the request failedpublic static java.lang.String getFrom(java.lang.String URL) throws java.io.IOException
URL
- the URL to send a get request tojava.io.IOException
- if the request failedpublic static java.lang.String getFrom(java.lang.String URL, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
URL
- the URL to send a get request toparameters
- the parameters to send with the requestjava.io.IOException
- if the request failedpublic static java.lang.String postTo(java.lang.String URL, java.lang.String postContent) throws java.io.IOException
URL
- the URL to send a post request topostContent
- the plain text content to sendjava.io.IOException
- if the request failedpublic static java.lang.String postTo(java.lang.String URL, java.lang.String contentType, java.lang.String postContent) throws java.io.IOException
URL
- the URL to send a post request tocontentType
- the MIME type of the contentpostContent
- the content to sendjava.io.IOException
- if the request failedpublic static java.lang.String putTo(java.lang.String URL, java.lang.String putContent) throws java.io.IOException
URL
- the URL to send a put request toputContent
- the plain text content to sendjava.io.IOException
- if the request failedpublic static java.lang.String putTo(java.lang.String URL, java.lang.String contentType, java.lang.String putContent) throws java.io.IOException
URL
- the URL to send a put request tocontentType
- the MIME type of the contentputContent
- the content to sendjava.io.IOException
- if the request failedpublic java.lang.String delete() throws java.io.IOException
java.io.IOException
- if the request failedpublic java.lang.String delete(java.lang.String URI) throws java.io.IOException
URI
- the resource to accessjava.io.IOException
- if the request failedpublic java.lang.String get() throws java.io.IOException
java.io.IOException
- if the request failedpublic java.lang.String get(java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
parameters
- the parameters to send with the requestjava.io.IOException
- if the request failedpublic java.lang.String get(java.lang.String URI) throws java.io.IOException
URI
- the resource to accessjava.io.IOException
- if the request failedpublic java.lang.String get(java.lang.String URI, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
URI
- the resource to accessparameters
- the parameters to send with the requestjava.io.IOException
- if the request failedpublic java.lang.String post(java.lang.String postContent) throws java.io.IOException
postContent
- the plain text content to sendjava.io.IOException
- if the request failedpublic java.lang.String post(java.lang.String contentType, java.lang.String postContent) throws java.io.IOException
contentType
- the MIME type of the contentpostContent
- the content to sendjava.io.IOException
- if the request failedpublic java.lang.String post(java.lang.String URI, java.lang.String contentType, java.lang.String postContent) throws java.io.IOException
URI
- the resource to accesscontentType
- the MIME type of the contentpostContent
- the content to sendjava.io.IOException
- if the request failedpublic java.lang.String put(java.lang.String putContent) throws java.io.IOException
putContent
- the plain text content to sendjava.io.IOException
- if the request failedpublic java.lang.String put(java.lang.String contentType, java.lang.String putContent) throws java.io.IOException
contentType
- the MIME type of the contentputContent
- the content to sendjava.io.IOException
- if the request failedpublic java.lang.String put(java.lang.String URI, java.lang.String contentType, java.lang.String putContent) throws java.io.IOException
URI
- the resource to accesscontentType
- the MIME type of the contentputContent
- the content to sendjava.io.IOException
- if the request failedpublic java.lang.String toString()
toString
in class java.lang.Object