|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HttpRequest
The HttpRequest
interface should
be implemented to provide web request capabilities. It is
used a similar manner to XMLHttpRequest
in
Javascript (AJAX). Normally, a listener will be added
by calling addReadyStateChangeListener(ReadyStateChangeListener)
,
the method open
will be called, and finally, send(String)
will be called to
complete the request.
UserAgentContext.createHttpRequest()
Field Summary | |
---|---|
static int |
STATE_COMPLETE
The complete request state. |
static int |
STATE_INTERACTIVE
The interactive request state. |
static int |
STATE_LOADED
The loaded request state. |
static int |
STATE_LOADING
The loading request state. |
static int |
STATE_UNINITIALIZED
The uninitialized request state. |
Method Summary | |
---|---|
void |
abort()
Aborts an ongoing request. |
void |
addReadyStateChangeListener(ReadyStateChangeListener listener)
Adds a listener of ReadyState changes. |
java.lang.String |
getAllResponseHeaders()
Gets a string with all the response headers. |
int |
getReadyState()
Gets the state of the request, a value between 0 and 4. |
byte[] |
getResponseBytes()
Gets the request response bytes. |
java.lang.String |
getResponseHeader(java.lang.String headerName)
Gets a response header value. |
java.awt.Image |
getResponseImage()
Gets the request response as an AWT image. |
java.lang.String |
getResponseText()
Gets the request response as text. |
org.w3c.dom.Document |
getResponseXML()
Gets the request response as an XML DOM. |
int |
getStatus()
Gets the status of the response. |
java.lang.String |
getStatusText()
Gets the status text of the request, e.g. |
void |
open(java.lang.String method,
java.lang.String url)
Starts an asynchronous request. |
void |
open(java.lang.String method,
java.lang.String url,
boolean asyncFlag)
Opens a request. |
void |
open(java.lang.String method,
java.net.URL url)
Opens an asynchronous request. |
void |
open(java.lang.String method,
java.net.URL url,
boolean asyncFlag)
Opens an request. |
void |
open(java.lang.String method,
java.net.URL url,
boolean asyncFlag,
java.lang.String userName)
Opens a request. |
void |
open(java.lang.String method,
java.net.URL url,
boolean asyncFlag,
java.lang.String userName,
java.lang.String password)
Opens a request. |
void |
send(java.lang.String content)
Sends POST content if any. |
Field Detail |
---|
static final int STATE_UNINITIALIZED
static final int STATE_LOADING
open
method
has been called, but a response has not been received yet.
static final int STATE_LOADED
static final int STATE_INTERACTIVE
static final int STATE_COMPLETE
Method Detail |
---|
int getReadyState()
java.lang.String getResponseText()
org.w3c.dom.Document getResponseXML()
java.awt.Image getResponseImage()
byte[] getResponseBytes()
int getStatus()
java.lang.String getStatusText()
void abort()
java.lang.String getAllResponseHeaders()
java.lang.String getResponseHeader(java.lang.String headerName)
headerName
- The name of the header.void open(java.lang.String method, java.lang.String url) throws java.io.IOException
method
- The request method.url
- The destination URL.
java.io.IOException
void open(java.lang.String method, java.net.URL url) throws java.io.IOException
method
- The request method.url
- The destination URL.
java.io.IOException
void open(java.lang.String method, java.net.URL url, boolean asyncFlag) throws java.io.IOException
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request is asynchronous.
java.io.IOException
void open(java.lang.String method, java.lang.String url, boolean asyncFlag) throws java.io.IOException
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.
java.io.IOException
void open(java.lang.String method, java.net.URL url, boolean asyncFlag, java.lang.String userName) throws java.io.IOException
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.userName
- The HTTP authentication user name.
java.io.IOException
void open(java.lang.String method, java.net.URL url, boolean asyncFlag, java.lang.String userName, java.lang.String password) throws java.io.IOException
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.userName
- The HTTP authentication user name.password
- The HTTP authentication password.
java.io.IOException
void send(java.lang.String content) throws java.io.IOException
content
- POST content or null
for GET requests.
java.io.IOException
void addReadyStateChangeListener(ReadyStateChangeListener listener)
listener
- An instanceof of ReadyStateChangeListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |