public class Http
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Http.AuthRequiredException
Exception signifying that an http request failed with a WWW-Authenticate response
|
static interface |
Http.BodyHandler<T>
Interface for an entity that performs type-specific processing on an http response body
|
static class |
Http.ByteArrayRequestBody
A RequestBody wrapping a byte array
|
static class |
Http.JSONRequestBody
A RequestBody wrapping a JSON-serialisable object
|
static interface |
Http.RequestBody
Interface for an entity that supplies an http request body
|
static interface |
Http.ResponseHandler<T>
Interface for an entity that performs type-specific processing on an http response
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DELETE |
static java.lang.String |
GET |
static java.lang.String |
POST |
| Constructor and Description |
|---|
Http(ClientOptions options,
Auth auth)
Public API
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
del(java.lang.String path,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
HTTP DEL for Ably host, with fallbacks
|
void |
finalize() |
<T> T |
get(java.lang.String path,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
HTTP GET for Ably host, with fallbacks
|
java.lang.String |
getHost()
Gets host for this HTTP client
|
<T> T |
getUri(java.lang.String uri,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
HTTP GET for non-Ably host
|
byte[] |
getUrl(java.lang.String url)
Simple HTTP GET; no auth, headers, returning response body as byte[]
|
java.lang.String |
getUrlString(java.lang.String url)
Simple HTTP GET; no auth, headers, returning response body as string
|
<T> T |
post(java.lang.String path,
Param[] headers,
Param[] params,
Http.RequestBody requestBody,
Http.ResponseHandler<T> responseHandler)
HTTP POST for Ably host, with fallbacks
|
void |
setHost(java.lang.String host)
Sets host for this HTTP client
|
public static final java.lang.String GET
public static final java.lang.String POST
public static final java.lang.String DELETE
public Http(ClientOptions options, Auth auth) throws AblyException
AblyExceptionpublic void setHost(java.lang.String host)
host - URL stringpublic java.lang.String getHost()
public java.lang.String getUrlString(java.lang.String url)
throws AblyException
url - AblyExceptionpublic byte[] getUrl(java.lang.String url)
throws AblyException
url - AblyExceptionpublic <T> T getUri(java.lang.String uri,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
throws AblyException
uri - headers - params - responseHandler - AblyExceptionpublic <T> T get(java.lang.String path,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
throws AblyException
path - headers - params - responseHandler - AblyExceptionpublic <T> T post(java.lang.String path,
Param[] headers,
Param[] params,
Http.RequestBody requestBody,
Http.ResponseHandler<T> responseHandler)
throws AblyException
path - headers - params - requestBody - responseHandler - AblyExceptionpublic <T> T del(java.lang.String path,
Param[] headers,
Param[] params,
Http.ResponseHandler<T> responseHandler)
throws AblyException
path - headers - params - responseHandler - AblyExceptionpublic void finalize()
finalize in class java.lang.Object