Package org.htmlunit.javascript.host.xml
Class FormData
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.xml.FormData
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.htmlunit.corejs.javascript.ConstProperties,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
public class FormData extends HtmlUnitScriptable
A JavaScript object forFormData.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormData.FormDataIterator
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFORM_DATA_TAGConstant used to register the prototype in the context.private java.util.List<NameValuePair>requestParameters_
-
Constructor Summary
Constructors Constructor Description FormData()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(java.lang.String name, java.lang.Object value, java.lang.Object filename)Appends a new value onto an existing key inside aFormDataobject, or adds the key if it does not already exist.voiddelete_js(java.lang.String name)Removes the entry (if exists).org.htmlunit.corejs.javascript.Scriptableentries()voidfillRequest(WebRequest webRequest)Sets the specified request with the parameters in thisFormData.voidforEach(java.lang.Object callback)The FormData.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.java.lang.Stringget(java.lang.String name)org.htmlunit.corejs.javascript.ScriptablegetAll(java.lang.String name)booleanhas(java.lang.String name)voidjsConstructor(java.lang.Object formObj)Constructor.java.lang.Objectkeys()The FormData.keys() method returns an iterator allowing to go through all keys contained in this object.voidset(java.lang.String name, java.lang.Object value, java.lang.Object filename)Sets a new value for an existing key inside aFormDataobject, or adds the key if it does not already exist.java.lang.Objectvalues()The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object.-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, 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
-
-
-
-
Field Detail
-
FORM_DATA_TAG
public static final java.lang.String FORM_DATA_TAG
Constant used to register the prototype in the context.- See Also:
- Constant Field Values
-
requestParameters_
private final java.util.List<NameValuePair> requestParameters_
-
-
Method Detail
-
jsConstructor
public void jsConstructor(java.lang.Object formObj)
Constructor.- Parameters:
formObj- a form
-
append
public void append(java.lang.String name, java.lang.Object value, java.lang.Object filename)Appends a new value onto an existing key inside aFormDataobject, or adds the key if it does not already exist.- Parameters:
name- the name of the field whose data is contained invaluevalue- the field's valuefilename- the filename reported to the server (optional)
-
delete_js
public void delete_js(java.lang.String name)
Removes the entry (if exists).- Parameters:
name- the name of the field to remove
-
get
public java.lang.String get(java.lang.String name)
- Parameters:
name- the name of the field to check- Returns:
- the first value found for the give name
-
getAll
public org.htmlunit.corejs.javascript.Scriptable getAll(java.lang.String name)
- Parameters:
name- the name of the field to check- Returns:
- the values found for the give name
-
has
public boolean has(java.lang.String name)
- Parameters:
name- the name of the field to check- Returns:
- true if the name exists
-
set
public void set(java.lang.String name, java.lang.Object value, java.lang.Object filename)Sets a new value for an existing key inside aFormDataobject, or adds the key if it does not already exist.- Parameters:
name- the name of the field whose data is contained invaluevalue- the field's valuefilename- the filename reported to the server (optional)
-
entries
public org.htmlunit.corejs.javascript.Scriptable entries()
- Returns:
- An Iterator that contains all the requestParameters name[0] and value[1]
-
fillRequest
public void fillRequest(WebRequest webRequest)
Sets the specified request with the parameters in thisFormData.- Parameters:
webRequest- the web request to fill
-
forEach
public void forEach(java.lang.Object callback)
The FormData.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.- Parameters:
callback- Function to execute on each key/value pairs
-
keys
public java.lang.Object keys()
The FormData.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are USVString objects.- Returns:
- an iterator.
-
values
public java.lang.Object values()
The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object. The values are USVString objects.- Returns:
- an iterator.
-
-