public class XMLHttpRequest extends SimpleScriptable
| Modifier and Type | Field and Description |
|---|---|
static int |
STATE_COMPLETED
All the data has been received; the complete data is available in responseBody and responseText.
|
static int |
STATE_INTERACTIVE
Some data has been received.
|
static int |
STATE_LOADED
The send() method has been called, but the status and headers are not yet available.
|
static int |
STATE_LOADING
The object has been created, but the send() method has not been called.
|
static int |
STATE_UNINITIALIZED
The object has been created, but not initialized (the open() method has not been called).
|
| Constructor and Description |
|---|
XMLHttpRequest()
Creates a new instance.
|
XMLHttpRequest(boolean caseSensitiveProperties)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object.
|
void |
jsConstructor()
JavaScript constructor.
|
void |
jsxFunction_abort()
Cancels the current HTTP request.
|
String |
jsxFunction_getAllResponseHeaders()
Returns the labels and values of all the HTTP headers.
|
String |
jsxFunction_getResponseHeader(String headerName)
Retrieves the value of an HTTP header from the response body.
|
void |
jsxFunction_open(String method,
Object urlParam,
boolean async,
Object user,
Object password)
Assigns the destination URL, method and other optional attributes of a pending request.
|
void |
jsxFunction_overrideMimeType(String mimeType)
Override the mime type returned by the server (if any).
|
void |
jsxFunction_send(Object content)
Sends the specified content to the server in an HTTP request and receives the response.
|
void |
jsxFunction_setRequestHeader(String name,
String value)
Sets the specified header to the specified value.
|
net.sourceforge.htmlunit.corejs.javascript.Function |
jsxGet_onerror()
Returns the event handler that fires on error.
|
net.sourceforge.htmlunit.corejs.javascript.Function |
jsxGet_onload()
Returns the event handler that fires on load.
|
net.sourceforge.htmlunit.corejs.javascript.Function |
jsxGet_onreadystatechange()
Returns the event handler that fires on every state change.
|
int |
jsxGet_readyState()
Returns the current state of the HTTP request.
|
String |
jsxGet_responseText()
Returns a string version of the data retrieved from the server.
|
Object |
jsxGet_responseXML()
Returns a DOM-compatible document object version of the data retrieved from the server.
|
int |
jsxGet_status()
Returns the numeric status returned by the server, such as 404 for "Not Found"
or 200 for "OK".
|
String |
jsxGet_statusText()
Returns the string message accompanying the status code, such as "Not Found" or "OK".
|
void |
jsxSet_onerror(net.sourceforge.htmlunit.corejs.javascript.Function errorHandler)
Sets the event handler that fires on error.
|
void |
jsxSet_onload(net.sourceforge.htmlunit.corejs.javascript.Function loadHandler)
Sets the event handler that fires on load.
|
void |
jsxSet_onreadystatechange(net.sourceforge.htmlunit.corejs.javascript.Function stateChangeHandler)
Sets the event handler that fires on every state change.
|
void |
put(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start,
Object value) |
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElementapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, sizepublic static final int STATE_UNINITIALIZED
public static final int STATE_LOADING
public static final int STATE_LOADED
public static final int STATE_INTERACTIVE
public static final int STATE_COMPLETED
public XMLHttpRequest()
public XMLHttpRequest(boolean caseSensitiveProperties)
caseSensitiveProperties - if properties and methods are case sensitivepublic void jsConstructor()
public net.sourceforge.htmlunit.corejs.javascript.Function jsxGet_onreadystatechange()
public void jsxSet_onreadystatechange(net.sourceforge.htmlunit.corejs.javascript.Function stateChangeHandler)
stateChangeHandler - the event handler that fires on every state changepublic net.sourceforge.htmlunit.corejs.javascript.Function jsxGet_onload()
public void jsxSet_onload(net.sourceforge.htmlunit.corejs.javascript.Function loadHandler)
loadHandler - the event handler that fires on loadpublic net.sourceforge.htmlunit.corejs.javascript.Function jsxGet_onerror()
public void jsxSet_onerror(net.sourceforge.htmlunit.corejs.javascript.Function errorHandler)
errorHandler - the event handler that fires on errorpublic int jsxGet_readyState()
public String jsxGet_responseText()
public Object jsxGet_responseXML()
public int jsxGet_status()
public String jsxGet_statusText()
public void jsxFunction_abort()
public String jsxFunction_getAllResponseHeaders()
public String jsxFunction_getResponseHeader(String headerName)
headerName - the (case-insensitive) name of the header to retrievepublic void jsxFunction_open(String method, Object urlParam, boolean async, 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 toasync - Whether or not to send the request to the server asynchronouslyuser - 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 jsxFunction_send(Object content)
content - the body of the message being sent with the requestpublic void jsxFunction_setRequestHeader(String name, String value)
name - the name of the header being setvalue - the value of the header being setpublic void jsxFunction_overrideMimeType(String mimeType)
mimeType - the type used to override that returned by the server (if any)public Object get(String name, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
SimpleScriptable.getWithPreemption(String).
For fallback case just implement ScriptableWithFallbackGetter.
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptableget in class SimpleScriptableCopyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.