|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.planet_ink.coffee_mud.Common.DefaultHttpClient
public class DefaultHttpClient
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Common.interfaces.HttpClient |
|---|
HttpClient.Method |
| Field Summary | |
|---|---|
protected int |
connectTimeout
|
protected java.io.InputStream |
in
|
protected int |
maxReadBytes
|
protected HttpClient.Method |
meth
|
protected java.io.OutputStream |
out
|
protected byte[] |
outBody
|
protected int |
readTimeout
|
protected java.util.Map<java.lang.String,java.lang.String> |
reqHeaders
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
respHeaders
|
protected java.lang.Integer |
respStatus
|
protected java.net.Socket |
sock
|
| Constructor Summary | |
|---|---|
DefaultHttpClient()
|
|
| 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. |
int |
compareTo(CMObject o)
|
protected void |
conditionalHeader(java.lang.String key,
java.lang.String value,
java.util.List<java.lang.String> clearSet)
|
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. |
CMObject |
copyOf()
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed. |
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 |
int |
getTickStatus()
A coded status for this object during the period where its tick method is being called. |
HttpClient |
header(java.lang.String key,
java.lang.String value)
An http request builder method that adds a header. |
java.lang.String |
ID()
The CoffeeMud Java Class ID shared by all instances of this object. |
void |
initializeClass()
Called ONCE after all objects are loaded, but before the map is read in during initialization. |
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 |
java.lang.String |
name()
The nice displayable name of this instance of this object |
CMObject |
newInstance()
Returns a new instance of this class. |
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. |
boolean |
tick(Tickable ticking,
int tickID)
this is the method which is called periodically by the threading engine. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Map<java.lang.String,java.lang.String> reqHeaders
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> respHeaders
protected java.net.Socket sock
protected java.io.OutputStream out
protected java.io.InputStream in
protected HttpClient.Method meth
protected int connectTimeout
protected int readTimeout
protected int maxReadBytes
protected byte[] outBody
protected java.lang.Integer respStatus
| Constructor Detail |
|---|
public DefaultHttpClient()
| Method Detail |
|---|
public java.lang.String ID()
CMObject
ID in interface CMObjectpublic java.lang.String name()
Tickable
name in interface CMObjectname in interface TickableEnvironmental.Name()public CMObject newInstance()
CMObject
newInstance in interface CMObjectpublic void initializeClass()
CMObject
initializeClass in interface CMObject
public HttpClient header(java.lang.String key,
java.lang.String value)
HttpClient
header in interface HttpClientkey - the header namevalue - the header value
public HttpClient method(HttpClient.Method meth)
HttpClient
method in interface HttpClientmeth - the method
public HttpClient body(java.lang.String body)
HttpClient
body in interface HttpClientbody - the body to send
public HttpClient body(byte[] body)
HttpClient
body in interface HttpClientbody - the body to send
public HttpClient reset()
HttpClient
reset in interface HttpClientpublic HttpClient connectTimeout(int ms)
HttpClient
connectTimeout in interface HttpClientms - the maximum number of ms to wait, or 0 for unlimited
public HttpClient readTimeout(int ms)
HttpClient
readTimeout in interface HttpClientms - the maximum number of ms to wait, or 0 for unlimited
public HttpClient maxReadBytes(int bytes)
HttpClient
maxReadBytes in interface HttpClientbytes - max bytes to read, or 0 for no limit
protected void conditionalHeader(java.lang.String key,
java.lang.String value,
java.util.List<java.lang.String> clearSet)
public int getResponseCode()
HttpClient
getResponseCode in interface HttpClientpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
HttpClient
getResponseHeaders in interface HttpClient
public HttpClient doRequest(java.lang.String url)
throws java.io.IOException
HttpClient
doRequest in interface HttpClienturl - the url to use
java.io.IOException - a socket error
public byte[] getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr)
HttpClient
getRawUrl in interface HttpClienturlStr - the url to fetchcookieStr - cookies to send, or "", or null for none
public byte[] getRawUrl(java.lang.String urlStr)
HttpClient
getRawUrl in interface HttpClienturlStr - the url to fetch
public byte[] getRawUrl(java.lang.String urlStr,
int maxLength,
int readTimeout)
HttpClient
getRawUrl in interface HttpClienturlStr - 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
public int getResponseContentLength()
HttpClient
getResponseContentLength in interface HttpClientpublic java.io.InputStream getResponseBody()
HttpClient
getResponseBody in interface HttpClient
public HttpClient doGet(java.lang.String url)
throws java.io.IOException
HttpClient
doGet in interface HttpClienturl - the url to use
java.io.IOException - a socket error
public HttpClient doHead(java.lang.String url)
throws java.io.IOException
HttpClient
doHead in interface HttpClienturl - the url to use
java.io.IOException - a socket error
public byte[] getRawUrl(java.lang.String urlStr,
java.lang.String cookieStr,
int maxLength,
int readTimeout)
HttpClient
getRawUrl in interface HttpClienturlStr - 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
public void finished()
HttpClient
finished in interface HttpClientpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders(java.lang.String urlStr)
HttpClient
getHeaders in interface HttpClienturlStr - the url to GET
public int getTickStatus()
Tickable
getTickStatus in interface TickableTickable.tick(Tickable, int)
public boolean tick(Tickable ticking,
int tickID)
Tickable
tick in interface Tickableticking - a reference to this Tickable objecttickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Tickable,
ServiceEngine,
TickableGrouppublic CMObject copyOf()
CMObject
copyOf in interface CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||