public final class RestServerDriver extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_CONNECTION_TIMEOUT |
static long |
DEFAULT_SOCKET_TIMEOUT |
| Modifier and Type | Method and Description |
|---|---|
static ByteArrayRequestBody |
body(byte[] content,
String contentType)
Make a RequestBody from a byte array.
|
static ByteArrayRequestBody |
body(InputStream content,
String contentType)
Make a RequestBody from an
InputStream. |
static ByteArrayRequestBody |
body(Reader content,
String contentType)
Make a RequestBody from a
Reader. |
static RequestBody |
body(String content,
String contentType)
Make a RequestBody for PUT or POST.
|
static Response |
delete(Object url,
AnyRequestModifier... modifiers)
Send an HTTP delete.
|
static Response |
deleteOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
delete(Object, AnyRequestModifier...). |
static Response |
deleting(Object url,
AnyRequestModifier... modifiers)
Synonym for
delete(Object, AnyRequestModifier...). |
static Response |
doDeleteOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
delete(Object, AnyRequestModifier...). |
static Response |
doGetOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
get(Object, AnyRequestModifier...). |
static Response |
doHeadOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
head(Object, AnyRequestModifier...). |
static Response |
doPostOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
post(Object, AnyRequestModifier...). |
static Response |
doPutOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
put(Object, AnyRequestModifier...). |
static Response |
get(Object url,
AnyRequestModifier... modifiers)
Perform an HTTP GET on a resource.
|
static Response |
getOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
get(Object, AnyRequestModifier...). |
static Response |
getting(Object url,
AnyRequestModifier... modifiers)
Synonym for
get(Object, AnyRequestModifier...). |
static Response |
head(Object url,
AnyRequestModifier... modifiers)
Perform an HTTP HEAD on a resource.
|
static Header |
header(String nameAndValue)
Make a Header.
|
static Header |
header(String name,
String value)
Make a Header.
|
static Response |
headOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
head(Object, AnyRequestModifier...). |
static NoOpRequestProxy |
notUsingProxy()
Do not use a proxy.
|
static Response |
options(Object url)
Perform an HTTP OPTIONS on a resource.
|
static Response |
optionsOf(Object url)
Synonym for
options(Object). |
static Response |
post(Object url,
AnyRequestModifier... modifiers)
Perform an HTTP POST to the given URL.
|
static Response |
posting(Object url,
AnyRequestModifier... modifiers)
Synonym for
post(Object, AnyRequestModifier...). |
static Response |
postOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
post(Object, AnyRequestModifier...). |
static Response |
put(Object url,
AnyRequestModifier... modifiers)
Perform an HTTP PUT to the given URL.
|
static Response |
putOf(Object url,
AnyRequestModifier... modifiers)
Synonym for
put(Object, AnyRequestModifier...). |
static Response |
putting(Object url,
AnyRequestModifier... modifiers)
Synonym for
put(Object, AnyRequestModifier...). |
static Url |
url(String base)
Creates a new
Url object. |
static RequestProxy |
usingProxy(String proxyHost,
int proxyPort)
Use a user-specified proxy.
|
static AnyRequestModifier |
usingSystemProxy()
Use the system proxy.
|
static BasicAuth |
withBasicAuth(String username,
String password)
Use HTTP basic authentication.
|
static AnyRequestModifier |
withConnectionTimeout(int timeout,
TimeUnit timeUnit)
Specify a connection timeout.
|
static AnyRequestModifier |
withSocketTimeout(int timeout,
TimeUnit timeUnit)
Specify a socket timeout.
|
static AnyRequestModifier |
withTimeout(int timeout,
TimeUnit timeUnit)
Use a single timeout value for both connection and socket timeouts.
|
public static final long DEFAULT_CONNECTION_TIMEOUT
public static final long DEFAULT_SOCKET_TIMEOUT
public static Header header(String name, String value)
name - The name for the headervalue - The value for the headerpublic static Header header(String nameAndValue)
nameAndValue - The name and value of the header in the form "name: value"public static RequestBody body(String content, String contentType)
content - Request body content as String.contentType - content-type eg text/plain.public static ByteArrayRequestBody body(byte[] content, String contentType)
content - Request body content as a byte array.contentType - Content-Type eg application/pdf.public static ByteArrayRequestBody body(InputStream content, String contentType)
InputStream.content - Request body content as an InputStream.contentType - Content-Type eg application/pdf.public static ByteArrayRequestBody body(Reader content, String contentType)
Reader.content - Request body content as a Reader.contentType - Content-Type eg application/pdf.public static BasicAuth withBasicAuth(String username, String password)
username - The username.password - The password.public static RequestProxy usingProxy(String proxyHost, int proxyPort)
proxyHost - The host.proxyPort - The port.public static NoOpRequestProxy notUsingProxy()
public static AnyRequestModifier usingSystemProxy()
public static AnyRequestModifier withTimeout(int timeout, TimeUnit timeUnit)
timeout - The timeout duration to use.timeUnit - The unit of the timeout.public static AnyRequestModifier withConnectionTimeout(int timeout, TimeUnit timeUnit)
timeout - The timeout duration to use.timeUnit - The unit of the timeout.public static AnyRequestModifier withSocketTimeout(int timeout, TimeUnit timeUnit)
timeout - The timeout duration to use.timeUnit - The unit of the timeout.public static Url url(String base)
Url object.base - The base, like "http://localhost"public static Response options(Object url)
url - The URL of a resource. Accepts any Object and calls .toString() on it.public static Response optionsOf(Object url)
options(Object).url - The URL of a resource. Accepts any Object and calls .toString() on it.public static Response get(Object url, AnyRequestModifier... modifiers)
url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response getOf(Object url, AnyRequestModifier... modifiers)
get(Object, AnyRequestModifier...).url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response doGetOf(Object url, AnyRequestModifier... modifiers)
get(Object, AnyRequestModifier...).url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response getting(Object url, AnyRequestModifier... modifiers)
get(Object, AnyRequestModifier...).url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response post(Object url, AnyRequestModifier... modifiers)
url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response postOf(Object url, AnyRequestModifier... modifiers)
post(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response doPostOf(Object url, AnyRequestModifier... modifiers)
post(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response posting(Object url, AnyRequestModifier... modifiers)
post(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response put(Object url, AnyRequestModifier... modifiers)
url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response putOf(Object url, AnyRequestModifier... modifiers)
put(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response doPutOf(Object url, AnyRequestModifier... modifiers)
put(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response putting(Object url, AnyRequestModifier... modifiers)
put(Object, AnyRequestModifier...).url - The URL. Any object may be passed, we will call .toString() on it.modifiers - The modifiers to be applied to the request.public static Response delete(Object url, AnyRequestModifier... modifiers)
url - The resource to deletemodifiers - Any http headerspublic static Response deleteOf(Object url, AnyRequestModifier... modifiers)
delete(Object, AnyRequestModifier...).url - The resource to deletemodifiers - Any http headerspublic static Response doDeleteOf(Object url, AnyRequestModifier... modifiers)
delete(Object, AnyRequestModifier...).url - The resource to deletemodifiers - Any http headerspublic static Response deleting(Object url, AnyRequestModifier... modifiers)
delete(Object, AnyRequestModifier...).url - The resource to deletemodifiers - Any http headerspublic static Response head(Object url, AnyRequestModifier... modifiers)
url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response headOf(Object url, AnyRequestModifier... modifiers)
head(Object, AnyRequestModifier...).url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.public static Response doHeadOf(Object url, AnyRequestModifier... modifiers)
head(Object, AnyRequestModifier...).url - The URL of a resource. Accepts any Object and calls .toString() on it.modifiers - Optional HTTP headers to put on the request.Copyright © 2012. All Rights Reserved.