public class XMLHttpRequest extends XMLHttpRequestEventTarget
XMLHttpRequest
.org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
Modifier and Type | Field and Description |
---|---|
static int |
DONE
All the data has been received; the complete data is available in responseBody and responseText.
|
static int |
HEADERS_RECEIVED
The send() method has been called, but the status and headers are not yet available.
|
static int |
LOADING
Some data has been received.
|
static int |
OPENED
The object has been created, but the send() method has not been called.
|
static int |
UNSENT
The object has been created, but not initialized (the open() method has not been called).
|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
XMLHttpRequest()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Cancels the current HTTP request.
|
String |
getAllResponseHeaders()
Returns the labels and values of all the HTTP headers.
|
org.htmlunit.corejs.javascript.Function |
getOnreadystatechange()
Returns the event handler that fires on ready state change.
|
int |
getReadyState()
Returns the current state of the HTTP request.
|
Object |
getResponse() |
String |
getResponseHeader(String headerName)
Retrieves the value of an HTTP header from the response body.
|
String |
getResponseText()
Returns a string version of the data retrieved from the server.
|
String |
getResponseType() |
Object |
getResponseXML()
Returns a DOM-compatible document object version of the data retrieved from the server.
|
int |
getStatus()
Returns the numeric status returned by the server, such as 404 for "Not Found"
or 200 for "OK".
|
String |
getStatusText()
Returns the string message accompanying the status code, such as "Not Found" or "OK".
|
int |
getTimeout() |
XMLHttpRequestUpload |
getUpload()
Returns the
upload property. |
boolean |
isWithCredentials()
Returns the
withCredentials property. |
void |
jsConstructor()
JavaScript constructor.
|
void |
open(String method,
Object urlParam,
Object asyncParam,
Object user,
Object password)
Assigns the destination URL, method and other optional attributes of a pending request.
|
void |
overrideMimeType(String mimeType)
Override the mime type returned by the server (if any).
|
void |
send(Object content)
Sends the specified content to the server in an HTTP request and receives the response.
|
void |
setOnreadystatechange(org.htmlunit.corejs.javascript.Function readyStateChangeHandler)
Sets the event handler that fires on ready state change.
|
void |
setRequestHeader(String name,
String value)
Sets the specified header to the specified value.
|
void |
setResponseType(String responseType)
Sets the
responseType property. |
void |
setTimeout(int timeout) |
void |
setWithCredentials(boolean withCredentials)
Sets the
withCredentials property. |
getOnabort, getOnerror, getOnload, getOnloadend, getOnloadstart, getOnprogress, getOntimeout, setOnabort, setOnerror, setOnload, setOnloadend, setOnloadstart, setOnprogress, setOntimeout
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final int UNSENT
public static final int OPENED
public static final int HEADERS_RECEIVED
public static final int LOADING
public static final int DONE
public void jsConstructor()
jsConstructor
in class XMLHttpRequestEventTarget
public int getReadyState()
public String getResponseType()
responseType
propertypublic void setResponseType(String responseType)
responseType
property.responseType
- the responseType
property.public Object getResponse()
public String getResponseText()
public Object getResponseXML()
public int getStatus()
public String getStatusText()
public void abort()
public String getAllResponseHeaders()
public String getResponseHeader(String headerName)
headerName
- the (case-insensitive) name of the header to retrievepublic void open(String method, Object urlParam, Object asyncParam, Object user, Object password)
method
- the method to use to send the request to the server (GET, POST, etc)urlParam
- the URL to send the request toasyncParam
- Whether or not to send the request to the server asynchronously, defaults to true
user
- If authentication is needed for the specified URL, the username to use to authenticatepassword
- If authentication is needed for the specified URL, the password to use to authenticatepublic void send(Object content)
content
- the body of the message being sent with the requestpublic void setRequestHeader(String name, String value)
open
method must be
called before this method, or an error will occur.name
- the name of the header being setvalue
- the value of the header being setpublic void overrideMimeType(String mimeType)
mimeType
- the type used to override that returned by the server (if any)public boolean isWithCredentials()
withCredentials
property.withCredentials
propertypublic void setWithCredentials(boolean withCredentials)
withCredentials
property.withCredentials
- the withCredentials
property.public XMLHttpRequestUpload getUpload()
upload
property.upload
propertypublic org.htmlunit.corejs.javascript.Function getOnreadystatechange()
getOnreadystatechange
in class XMLHttpRequestEventTarget
public void setOnreadystatechange(org.htmlunit.corejs.javascript.Function readyStateChangeHandler)
setOnreadystatechange
in class XMLHttpRequestEventTarget
readyStateChangeHandler
- the event handler that fires on ready state changepublic int getTimeout()
public void setTimeout(int timeout)
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.