STATE_COMPLETE
public static final int STATE_COMPLETE
The complete request state.
STATE_INTERACTIVE
public static final int STATE_INTERACTIVE
The interactive request state.
STATE_LOADED
public static final int STATE_LOADED
The loaded request state.
STATE_LOADING
public static final int STATE_LOADING
The loading request state.
STATE_UNINITIALIZED
public static final int STATE_UNINITIALIZED
The uninitialized request state.
abort
public void abort()
Aborts an ongoing request.
addReadyStateChangeListener
public void addReadyStateChangeListener(ReadyStateChangeListener listener)
Adds a listener of ReadyState changes. The listener should be invoked
even in the case of errors.
getAllResponseHeaders
public String getAllResponseHeaders()
Gets a string with all the response headers.
getReadyState
public int getReadyState()
Gets the state of the request, a value
between 0 and 4.
- A value corresponding to one of the STATE* constants in this class.
getResponseBytes
public byte[] getResponseBytes()
Gets the request response bytes.
getResponseHeader
public String getResponseHeader(String headerName)
Gets a response header value.
headerName
- The name of the header.
getResponseImage
public Image getResponseImage()
Gets the request response as an AWT image.
getResponseText
public String getResponseText()
Gets the request response as text.
getResponseXML
public Document getResponseXML()
Gets the request response as an XML DOM.
getStatus
public int getStatus()
Gets the status of the response. Note that this
can be 0 for file requests in addition to 200
for successful HTTP requests.
getStatusText
public String getStatusText()
Gets the status text of the request, e.g. "OK" for 200.
open
public void open(String method,
String url)
Starts an asynchronous request.
method
- The request method.url
- The destination URL.
open
public void open(String method,
String url,
boolean asyncFlag)
Opens a request.
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.
open
public void open(String method,
String url,
boolean asyncFlag,
String userName)
Opens a request.
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.userName
- The HTTP authentication user name.
open
public void open(String method,
String url,
boolean asyncFlag,
String userName,
String password)
Opens a request.
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.
open
public void open(String method,
URL url)
Opens an asynchronous request.
method
- The request method.url
- The destination URL.
open
public void open(String method,
URL url,
boolean asyncFlag)
Opens an request.
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request is asynchronous.