|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface HttpClient
A simple utility for making HTTP requests, which is implemented as a builder-type object.
| Nested Class Summary | |
|---|---|
static class |
HttpClient.Method
HTTP Methods that are acceptable |
| Field Summary |
|---|
| Method Summary | |
|---|---|
HttpClient |
body(byte[] body)
An http request builder method that sets the body to send. |
HttpClient |
body(java.lang.String body)
An http request builder method that sets the body to send. |
HttpClient |
connectTimeout(int ms)
An http request builder method that sets the maximum number of milliseconds that the reader will remain idle waiting for a connection to occur. |
HttpClient |
doGet(java.lang.String url)
An http request builder method that causes this request to occur as a GET |
HttpClient |
doHead(java.lang.String url)
An http request builder method that causes this request to occur as a HEAD |
HttpClient |
doRequest(java.lang.String url)
An http request builder method that causes this request to occur. |
void |
finished()
Closes this connection, entirely. |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders(java.lang.String urlStr)
Calls GET on the given url, waiting no more than a few seconds for connection, and returns the headers from the response. |
byte[] |
getRawUrl(java.lang.String urlStr)
Reads the simple raw return content from a given url and returns it as a byte array. |
byte[] |
getRawUrl(java.lang.String urlStr,
int maxLength,
int readTimeout)
Reads the simple raw return content from a given url and returns it as a byte array. |
byte[] |
getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr)
Reads the simple raw return content from a given url and returns it as a byte array. |
byte[] |
getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr,
int maxLength,
int readTimeout)
Reads the simple raw return content from a given url and returns it as a byte array. |
java.io.InputStream |
getResponseBody()
Returns an input stream to the body of the response to this request. |
int |
getResponseCode()
Returns the http status code from the response |
int |
getResponseContentLength()
Gets the length of the body of the response to this request. |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getResponseHeaders()
Returns the headers in the response to this request |
HttpClient |
header(java.lang.String key,
java.lang.String value)
An http request builder method that adds a header. |
HttpClient |
maxReadBytes(int bytes)
An http request builder method that sets the maximum number of bytes that can be read by the request processor. |
HttpClient |
method(HttpClient.Method meth)
An http request builder method that sets the http method |
HttpClient |
readTimeout(int ms)
An http request builder method that sets the maximum number of milliseconds that the reader will remain idle waiting for a byte of data. |
HttpClient |
reset()
An http request builder method that resets the client obj so that the connection can be used for another request. |
| Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable |
|---|
getTickStatus, name, tick |
| Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject |
|---|
copyOf, ID, initializeClass, newInstance |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Method Detail |
|---|
byte[] getRawUrl(java.lang.String urlStr,
int maxLength,
int readTimeout)
urlStr - the url to fetchmaxLength - the maximum size of the content, or 0 for any sizereadTimeout - the maximum time, in ms, to wait for connects, and reads
byte[] getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr)
urlStr - the url to fetchcookieStr - cookies to send, or "", or null for none
byte[] getRawUrl(java.lang.String urlStr)
urlStr - the url to fetch
byte[] getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr,
int maxLength,
int readTimeout)
urlStr - the url to fetchcookieStr - cookies to send, or "", or null for nonemaxLength - the maximum size of the content, or 0 for any sizereadTimeout - the maximum time, in ms, to wait for connects, and reads
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders(java.lang.String urlStr)
urlStr - the url to GET
HttpClient maxReadBytes(int bytes)
bytes - max bytes to read, or 0 for no limit
HttpClient readTimeout(int ms)
ms - the maximum number of ms to wait, or 0 for unlimited
HttpClient connectTimeout(int ms)
ms - the maximum number of ms to wait, or 0 for unlimited
HttpClient reset()
HttpClient body(java.lang.String body)
body - the body to send
HttpClient body(byte[] body)
body - the body to send
HttpClient header(java.lang.String key,
java.lang.String value)
key - the header namevalue - the header value
HttpClient method(HttpClient.Method meth)
meth - the method
HttpClient doGet(java.lang.String url)
throws java.io.IOException
url - the url to use
java.io.IOException - a socket error
HttpClient doHead(java.lang.String url)
throws java.io.IOException
url - the url to use
java.io.IOException - a socket error
HttpClient doRequest(java.lang.String url)
throws java.io.IOException
url - the url to use
java.io.IOException - a socket errorjava.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
int getResponseCode()
java.io.InputStream getResponseBody()
int getResponseContentLength()
void finished()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||