@Environment(value=CLIENT) public abstract class Request<T extends Request<T>> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Request.Delete |
static class |
Request.Get |
static class |
Request.Post |
static class |
Request.Put |
Modifier and Type | Field and Description |
---|---|
private boolean |
connected |
protected HttpURLConnection |
connection |
protected String |
url |
Constructor and Description |
---|
Request(String url,
int connectTimeout,
int readTimeout) |
Modifier and Type | Method and Description |
---|---|
protected T |
connect() |
static void |
cookie(HttpURLConnection connection,
String key,
String value) |
void |
cookie(String key,
String value) |
static Request<?> |
delete(String url) |
private void |
dispose() |
protected abstract T |
doConnect() |
static Request<?> |
get(String url) |
static Request<?> |
get(String url,
int connectTimeoutMillis,
int readTimeoutMillis) |
static String |
getHeader(HttpURLConnection connection,
String header) |
String |
getHeader(String header) |
int |
getRetryAfterHeader() |
static int |
getRetryAfterHeader(HttpURLConnection connection) |
static Request<?> |
post(String uri,
String content) |
static Request<?> |
post(String uri,
String content,
int connectTimeoutMillis,
int readTimeoutMillis) |
static Request<?> |
put(String url,
String content) |
static Request<?> |
put(String url,
String content,
int connectTimeoutMillis,
int readTimeoutMillis) |
private String |
read(InputStream in) |
int |
responseCode() |
String |
text() |
protected HttpURLConnection connection
private boolean connected
protected String url
public Request(String url, int connectTimeout, int readTimeout)
public static void cookie(HttpURLConnection connection, String key, String value)
public int getRetryAfterHeader()
public static int getRetryAfterHeader(HttpURLConnection connection)
public int responseCode()
public String text()
private String read(InputStream in) throws IOException
IOException
private void dispose()
protected T connect()
protected abstract T doConnect()
public static Request<?> post(String uri, String content, int connectTimeoutMillis, int readTimeoutMillis)
public static Request<?> put(String url, String content, int connectTimeoutMillis, int readTimeoutMillis)
public static String getHeader(HttpURLConnection connection, String header)