
public class JsXMLHttpRequest extends JsElementalMixinBase implements XMLHttpRequest
DONE, HEADERS_RECEIVED, LOADING, OPENED, UNSENTSVG_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, setZoomAndPanat, at, intAt, intAt, length, numberAt, numberAt, setAt, setAt, setAt, setAt, setAt, setAtcast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toStringaddEventListener, addEventListener, dispatchEvent, removeEventListener, removeEventListenerintAt, lengthnumberAtpublic final boolean isAsBlob()
isAsBlob in interface XMLHttpRequestpublic final void setAsBlob(boolean param_asBlob)
setAsBlob in interface XMLHttpRequestpublic final EventListener getOnabort()
getOnabort in interface XMLHttpRequestpublic final void setOnabort(EventListener listener)
setOnabort in interface XMLHttpRequestpublic final EventListener getOnerror()
getOnerror in interface XMLHttpRequestpublic final void setOnerror(EventListener listener)
setOnerror in interface XMLHttpRequestpublic final EventListener getOnload()
getOnload in interface XMLHttpRequestpublic final void setOnload(EventListener listener)
setOnload in interface XMLHttpRequestpublic final EventListener getOnloadend()
getOnloadend in interface XMLHttpRequestpublic final void setOnloadend(EventListener listener)
setOnloadend in interface XMLHttpRequestpublic final EventListener getOnloadstart()
getOnloadstart in interface XMLHttpRequestpublic final void setOnloadstart(EventListener listener)
setOnloadstart in interface XMLHttpRequestpublic final EventListener getOnprogress()
getOnprogress in interface XMLHttpRequestpublic final void setOnprogress(EventListener listener)
setOnprogress in interface XMLHttpRequestpublic final EventListener getOnreadystatechange()
getOnreadystatechange in interface XMLHttpRequestpublic final void setOnreadystatechange(EventListener listener)
setOnreadystatechange in interface XMLHttpRequestpublic final int getReadyState()
XMLHttpRequestThe 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 XMLHttpRequestpublic final Object getResponse()
XMLHttpRequestresponseType, 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 XMLHttpRequestpublic final JsBlob getResponseBlob()
getResponseBlob in interface XMLHttpRequestpublic final String getResponseText()
XMLHttpRequestnull if the request was unsuccessful or has not yet been sent. Read-only.getResponseText in interface XMLHttpRequestpublic final String getResponseType()
XMLHttpRequestCan 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 XMLHttpRequestpublic final void setResponseType(String param_responseType)
setResponseType in interface XMLHttpRequestpublic final JsDocument getResponseXML()
XMLHttpRequestThe 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 XMLHttpRequestpublic final int getStatus()
XMLHttpRequeststatus is 200 for a successful request). Read-only.getStatus in interface XMLHttpRequestpublic final String getStatusText()
XMLHttpRequeststatus, this includes the entire text of the response message ("200 OK", for example). Read-only.getStatusText in interface XMLHttpRequestpublic final JsXMLHttpRequestUpload getUpload()
XMLHttpRequestupload.
New in Firefox 3.5getUpload in interface XMLHttpRequestpublic final boolean isWithCredentials()
XMLHttpRequestIndicates 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 XMLHttpRequestpublic final void setWithCredentials(boolean param_withCredentials)
setWithCredentials in interface XMLHttpRequestpublic final void abort()
XMLHttpRequestabort in interface XMLHttpRequestpublic final String getAllResponseHeaders()
XMLHttpRequeststring 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 XMLHttpRequestpublic final String getResponseHeader(String header)
XMLHttpRequestnull if either the response has not yet been received or the header doesn't exist in the response.getResponseHeader in interface XMLHttpRequestpublic final void open(String method, String url)
XMLHttpRequestInitializes 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().methodurlasynctrue, 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.userpasswordopen in interface XMLHttpRequestpublic final void open(String method, String url, boolean async)
XMLHttpRequestInitializes 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().methodurlasynctrue, 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.userpasswordopen in interface XMLHttpRequestpublic final void open(String method, String url, boolean async, String user)
XMLHttpRequestInitializes 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().methodurlasynctrue, 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.userpasswordopen in interface XMLHttpRequestpublic final void open(String method, String url, boolean async, String user, String password)
XMLHttpRequestInitializes 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().methodurlasynctrue, 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.userpasswordopen in interface XMLHttpRequestpublic final void overrideMimeType(String override)
XMLHttpRequestsend().overrideMimeType in interface XMLHttpRequestpublic final void send()
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void send(ArrayBuffer data)
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void send(Blob data)
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void send(Document data)
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void send(String data)
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void send(FormData data)
XMLHttpRequestSends 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().bodynsIDocument, 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 XMLHttpRequestpublic final void setRequestHeader(String header, String value)
XMLHttpRequestSets the value of an HTTP request header.You must call open()before using this method.
headervaluesetRequestHeader in interface XMLHttpRequestCopyright © 2016. All rights reserved.