connection
protected java.net.URLConnection connection
The URLConnection
is assigned to
this field while it is ongoing.
requestMethod
protected String requestMethod
requestPassword
protected String requestPassword
requestUserName
protected String requestUserName
responseHeaders
protected String responseHeaders
Response headers are set in this string after
a response is received.
responseHeadersMap
protected Map responseHeadersMap
Response headers are set in this map after
a response is received.
abort
public void abort()
Aborts an ongoing request.
- abort in interface HttpRequest
getPostCharset
protected String getPostCharset()
This is the charset used to post data provided
to
send(String)
. It returns "UTF-8" unless overridden.
getReadyState
public int getReadyState()
Gets the state of the request, a value
between 0 and 4.
- getReadyState in interface HttpRequest
- A value corresponding to one of the STATE* constants in this class.
getResponseHeader
public String getResponseHeader(String headerName)
Gets a response header value.
- getResponseHeader in interface HttpRequest
headerName
- The name of the header.
getResponseXML
public Document getResponseXML()
Gets the request response as an XML DOM.
- getResponseXML in interface HttpRequest
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.
- getStatus in interface HttpRequest
getStatusText
public String getStatusText()
Gets the status text of the request, e.g. "OK" for 200.
- getStatusText in interface HttpRequest
open
public void open(String method,
String url)
throws IOException
Starts an asynchronous request.
- open in interface HttpRequest
method
- The request method.url
- The destination URL.
open
public void open(String method,
String url,
boolean asyncFlag)
throws IOException
Opens a request.
- open in interface HttpRequest
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request should be asynchronous.
open
public void open(String method,
URL url)
throws IOException
Opens an asynchronous request.
- open in interface HttpRequest
method
- The request method.url
- The destination URL.
open
public void open(String method,
URL url,
boolean asyncFlag)
throws IOException
Opens an request.
- open in interface HttpRequest
method
- The request method.url
- The destination URL.asyncFlag
- Whether the request is asynchronous.
open
public void open(String method,
java.net.URL url,
boolean asyncFlag,
String userName)
throws IOException
open
public void open(String method,
java.net.URL url,
boolean asyncFlag,
String userName,
String password)
throws java.io.IOException
method
- The request method.url
- The request URL.asyncFlag
- Whether the request should be asynchronous.userName
- The user name of the request (not supported.)password
- The password of the request (not supported.)
send
public void send(String content)
throws java.io.IOException
Sends POST content, if any, and causes the request
to proceed.
In the case of asynchronous requests, a new thread
is created.
- send in interface HttpRequest
content
- POST content or null
if there's no such content.
sendSync
protected void sendSync(String content)
throws IOException
This is a synchronous implementation of
send(String)
method
functionality.
It may be overridden to change the behavior of the class.
content
- POST content if any. It may be null
.