public class JsXMLHttpRequest extends JsElementalMixinBase implements XMLHttpRequest
DONE, HEADERS_RECEIVED, LOADING, OPENED, UNSENT
SVG_ZOOMANDPAN_DISABLE, SVG_ZOOMANDPAN_MAGNIFY, SVG_ZOOMANDPAN_UNKNOWN
Modifier | Constructor and Description |
---|---|
protected |
JsXMLHttpRequest() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts the request if it has already been sent.
|
String |
getAllResponseHeaders()
string getAllResponseHeaders();
|
EventListener |
getOnabort() |
EventListener |
getOnerror() |
EventListener |
getOnload() |
EventListener |
getOnloadend() |
EventListener |
getOnloadstart() |
EventListener |
getOnprogress() |
EventListener |
getOnreadystatechange() |
int |
getReadyState()
The state of the request:
|
Object |
getResponse()
The response entity body according to
responseType , as an ArrayBuffer , Blob , Document
, JavaScript object (for "moz-json"), or string. |
JsBlob |
getResponseBlob() |
String |
getResponseHeader(String header)
Returns the string containing the text of the specified header, or
null if either the response has not yet been received or the header doesn't exist in the response. |
String |
getResponseText()
The response to the request as text, or
null if the request was unsuccessful or has not yet been sent. |
String |
getResponseType()
Can be set to change the response type.
|
JsDocument |
getResponseXML()
The response to the request as a DOM
Document object, or null if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML. |
int |
getStatus()
The status of the response to the request.
|
String |
getStatusText()
The response string returned by the HTTP server.
|
JsXMLHttpRequestUpload |
getUpload()
The upload process can be tracked by adding an event listener to
upload . |
boolean |
isAsBlob() |
boolean |
isWithCredentials()
Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers.
|
void |
open(String method,
String url)
Initializes a request.
|
void |
open(String method,
String url,
boolean async)
Initializes a request.
|
void |
open(String method,
String url,
boolean async,
String user)
Initializes a request.
|
void |
open(String method,
String url,
boolean async,
String user,
String password)
Initializes a request.
|
void |
overrideMimeType(String override)
Overrides the MIME type returned by the server.
|
void |
send()
Sends the request.
|
void |
send(ArrayBuffer data)
Sends the request.
|
void |
send(Blob data)
Sends the request.
|
void |
send(Document data)
Sends the request.
|
void |
send(FormData data)
Sends the request.
|
void |
send(String data)
Sends the request.
|
void |
setAsBlob(boolean param_asBlob) |
void |
setOnabort(EventListener listener) |
void |
setOnerror(EventListener listener) |
void |
setOnload(EventListener listener) |
void |
setOnloadend(EventListener listener) |
void |
setOnloadstart(EventListener listener) |
void |
setOnprogress(EventListener listener) |
void |
setOnreadystatechange(EventListener listener) |
void |
setRequestHeader(String header,
String value)
Sets the value of an HTTP request header.You must call
open() before using this method. |
void |
setResponseType(String param_responseType) |
void |
setWithCredentials(boolean param_withCredentials) |
addEventListener, addEventListener, beginElement, beginElementAt, dispatchEvent, endElement, endElementAt, getAnimatedClassName, getAnimatedHeight, getAnimatedHref, getAnimatedResult, getAnimatedTransform, getAnimatedWidth, getAnimatedX, getAnimatedY, getBBox, getChildElementCount, getCTM, getExternalResourcesRequired, getFarthestViewportElement, getFirstElementChild, getLastElementChild, getNearestViewportElement, getNextElementSibling, getPresentationAttribute, getPreserveAspectRatio, getPreviousElementSibling, getRequiredExtensions, getRequiredFeatures, getScreenCTM, getSvgStyle, getSystemLanguage, getTransformToElement, getViewBox, getXmllang, getXmlspace, getZoomAndPan, hasExtension, querySelector, querySelectorAll, removeEventListener, removeEventListener, setXmllang, setXmlspace, setZoomAndPan
at, at, intAt, intAt, length, numberAt, numberAt, setAt, setAt, setAt, setAt, setAt, setAt
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addEventListener, addEventListener, dispatchEvent, removeEventListener, removeEventListener
intAt, length
numberAt
public final boolean isAsBlob()
isAsBlob
in interface XMLHttpRequest
public final void setAsBlob(boolean param_asBlob)
setAsBlob
in interface XMLHttpRequest
public final EventListener getOnabort()
getOnabort
in interface XMLHttpRequest
public final void setOnabort(EventListener listener)
setOnabort
in interface XMLHttpRequest
public final EventListener getOnerror()
getOnerror
in interface XMLHttpRequest
public final void setOnerror(EventListener listener)
setOnerror
in interface XMLHttpRequest
public final EventListener getOnload()
getOnload
in interface XMLHttpRequest
public final void setOnload(EventListener listener)
setOnload
in interface XMLHttpRequest
public final EventListener getOnloadend()
getOnloadend
in interface XMLHttpRequest
public final void setOnloadend(EventListener listener)
setOnloadend
in interface XMLHttpRequest
public final EventListener getOnloadstart()
getOnloadstart
in interface XMLHttpRequest
public final void setOnloadstart(EventListener listener)
setOnloadstart
in interface XMLHttpRequest
public final EventListener getOnprogress()
getOnprogress
in interface XMLHttpRequest
public final void setOnprogress(EventListener listener)
setOnprogress
in interface XMLHttpRequest
public final EventListener getOnreadystatechange()
getOnreadystatechange
in interface XMLHttpRequest
public final void setOnreadystatechange(EventListener listener)
setOnreadystatechange
in interface XMLHttpRequest
public final int getReadyState()
XMLHttpRequest
The state of the request:
Value | State | Description |
0 | UNSENT | open() has not been called yet. |
1 | OPENED | send() has not been called yet. |
2 | HEADERS_RECEIVED | send() has been called, and headers and status are available. |
3 | LOADING | Downloading; responseText holds partial data. |
4 | DONE | The operation is complete. |
getReadyState
in interface XMLHttpRequest
public final Object getResponse()
XMLHttpRequest
responseType
, as an ArrayBuffer
, Blob
, Document
, JavaScript object (for "moz-json"), or string. This is NULL
if the request is not complete or was not successful.getResponse
in interface XMLHttpRequest
public final JsBlob getResponseBlob()
getResponseBlob
in interface XMLHttpRequest
public final String getResponseText()
XMLHttpRequest
null
if the request was unsuccessful or has not yet been sent. Read-only.getResponseText
in interface XMLHttpRequest
public final String getResponseType()
XMLHttpRequest
Can be set to change the response type. This tells the server what format you want the response to be in.
Value | Data type of response property |
empty string | String (this is the default) |
"arraybuffer" | ArrayBuffer |
"blob" | Blob
|
"document" | Document
|
"text" | String |
"moz-json" | JavaScript object, parsed from a JSON string returned by the server Requires Gecko 9.0 |
getResponseType
in interface XMLHttpRequest
public final void setResponseType(String param_responseType)
setResponseType
in interface XMLHttpRequest
public final JsDocument getResponseXML()
XMLHttpRequest
The response to the request as a DOM Document
object, or null
if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML. The response is parsed as if it were a text/xml
stream. Read-only.
text/xml
Content-Type header, you can use overrideMimeType()
to force XMLHttpRequest
to parse it as XML anyway.getResponseXML
in interface XMLHttpRequest
public final int getStatus()
XMLHttpRequest
status
is 200 for a successful request). Read-only.getStatus
in interface XMLHttpRequest
public final String getStatusText()
XMLHttpRequest
status
, this includes the entire text of the response message ("200 OK
", for example). Read-only.getStatusText
in interface XMLHttpRequest
public final JsXMLHttpRequestUpload getUpload()
XMLHttpRequest
upload
.
New in Firefox 3.5getUpload
in interface XMLHttpRequest
public final boolean isWithCredentials()
XMLHttpRequest
Indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers. New in Firefox 3.5
The default is false
.
isWithCredentials
in interface XMLHttpRequest
public final void setWithCredentials(boolean param_withCredentials)
setWithCredentials
in interface XMLHttpRequest
public final void abort()
XMLHttpRequest
abort
in interface XMLHttpRequest
public final String getAllResponseHeaders()
XMLHttpRequest
string getAllResponseHeaders();
Returns all the response headers as a string, or null
if no response has been received. Note: For multipart requests, this returns the headers from the current part of the request, not from the original channel.
getAllResponseHeaders
in interface XMLHttpRequest
public final String getResponseHeader(String header)
XMLHttpRequest
null
if either the response has not yet been received or the header doesn't exist in the response.getResponseHeader
in interface XMLHttpRequest
public final void open(String method, String url)
XMLHttpRequest
Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest()
instead.
open()
or openRequest()
has already been called) is the equivalent of calling abort()
.method
url
async
true
, indicating whether or not to perform the operation asynchronously. If this value is false
, the send()
method does not return until the response is received. If true
, notification of a completed transaction is provided using event listeners. This must be true if the multipart
attribute is true
, or an exception will be thrown.user
password
open
in interface XMLHttpRequest
public final void open(String method, String url, boolean async)
XMLHttpRequest
Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest()
instead.
open()
or openRequest()
has already been called) is the equivalent of calling abort()
.method
url
async
true
, indicating whether or not to perform the operation asynchronously. If this value is false
, the send()
method does not return until the response is received. If true
, notification of a completed transaction is provided using event listeners. This must be true if the multipart
attribute is true
, or an exception will be thrown.user
password
open
in interface XMLHttpRequest
public final void open(String method, String url, boolean async, String user)
XMLHttpRequest
Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest()
instead.
open()
or openRequest()
has already been called) is the equivalent of calling abort()
.method
url
async
true
, indicating whether or not to perform the operation asynchronously. If this value is false
, the send()
method does not return until the response is received. If true
, notification of a completed transaction is provided using event listeners. This must be true if the multipart
attribute is true
, or an exception will be thrown.user
password
open
in interface XMLHttpRequest
public final void open(String method, String url, boolean async, String user, String password)
XMLHttpRequest
Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest()
instead.
open()
or openRequest()
has already been called) is the equivalent of calling abort()
.method
url
async
true
, indicating whether or not to perform the operation asynchronously. If this value is false
, the send()
method does not return until the response is received. If true
, notification of a completed transaction is provided using event listeners. This must be true if the multipart
attribute is true
, or an exception will be thrown.user
password
open
in interface XMLHttpRequest
public final void overrideMimeType(String override)
XMLHttpRequest
send()
.overrideMimeType
in interface XMLHttpRequest
public final void send()
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void send(ArrayBuffer data)
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void send(Blob data)
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void send(Document data)
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void send(String data)
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void send(FormData data)
XMLHttpRequest
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent. If the request is synchronous, this method doesn't return until the response has arrived.
send()
.body
nsIDocument
, nsIInputStream
, or a string (an nsISupportsString
if called from native code) that is used to populate the body of a POST request. Starting with Gecko 1.9.2, you may also specify an DOMFile
, and starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
you may also specify a FormData
object.send
in interface XMLHttpRequest
public final void setRequestHeader(String header, String value)
XMLHttpRequest
Sets the value of an HTTP request header.You must call open()
before using this method.
header
value
setRequestHeader
in interface XMLHttpRequest
Copyright © 2016. All rights reserved.