public class XMLHttpRequest extends XMLHttpRequestEventTarget
XMLHttpRequest.org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction| 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_CONSTNOT_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)
Sets the number of milliseconds a request can take before automatically being terminated.
|
void |
setWithCredentials(boolean withCredentials)
Sets the
withCredentials property. |
getOnabort, getOnerror, getOnload, getOnloadend, getOnloadstart, getOnprogress, getOntimeout, setOnabort, setOnerror, setOnload, setOnloadend, setOnloadstart, setOnprogress, setOntimeoutaddEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandlerclone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromiseapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, 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, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, sizecreateSlotMappublic 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 XMLHttpRequestEventTargetpublic 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 trueuser - 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 XMLHttpRequestEventTargetpublic void setOnreadystatechange(org.htmlunit.corejs.javascript.Function readyStateChangeHandler)
setOnreadystatechange in class XMLHttpRequestEventTargetreadyStateChangeHandler - the event handler that fires on ready state changepublic int getTimeout()
public void setTimeout(int timeout)
timeout - the timeout in millisecondsCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.