Class URLSearchParams
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.URLSearchParams
- All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
URLSearchParams.- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.commons.logging.Logprivate URLstatic final StringConstant used to register the prototype in the context.Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance.URLSearchParams(URL url) Constructs a new instance for the given js url. -
Method Summary
Modifier and TypeMethodDescriptionvoidThe append() method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.private static org.htmlunit.corejs.javascript.IteratorLikeIterablebuildIteratorLikeIterable(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable iterable) voidThe delete() method of the URLSearchParams interface deletes the given search parameter and its associated value, from the list of all search parameters.entries()The URLSearchParams.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.voidfillRequest(WebRequest webRequest) Sets the specified request with the parameters in thisFormData.voidThe URLSearchParams.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.The get() method of the URLSearchParams interface returns the first value associated to the given search parameter.org.htmlunit.corejs.javascript.ScriptableThe getAll() method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.getDefaultValue(Class<?> hint) Calls for instance for implicit conversion to string.intgetSize()booleanThe has() method of the URLSearchParams interface returns a Boolean that indicates whether a parameter with the specified name exists.voidjsConstructor(Object params) Constructs a new instance.keys()The URLSearchParams.keys() method returns an iterator allowing to go through all keys contained in this object.private static List<NameValuePair> resolveParams(Object params) voidThe set() method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.private List<NameValuePair> private static List<NameValuePair> splitQuery(String params) private static NameValuePairsplitQueryParameter(String singleParam) values()The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object.Methods inherited from class HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods 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, 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 Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
URL_SEARCH_PARMS_TAG
Constant used to register the prototype in the context.- See Also:
-
url_
-
-
Constructor Details
-
URLSearchParams
public URLSearchParams()Constructs a new instance. -
URLSearchParams
URLSearchParams(URL url) Constructs a new instance for the given js url.- Parameters:
url- the base url
-
-
Method Details
-
jsConstructor
Constructs a new instance.- Parameters:
params- the params string
-
resolveParams
-
splitQuery
-
splitQuery
-
splitQueryParameter
-
buildIteratorLikeIterable
private static org.htmlunit.corejs.javascript.IteratorLikeIterable buildIteratorLikeIterable(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable iterable) -
append
-
delete
The delete() method of the URLSearchParams interface deletes the given search parameter and its associated value, from the list of all search parameters.- Specified by:
deletein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
deletein classorg.htmlunit.corejs.javascript.ScriptableObject- Parameters:
name- The name of the parameter to be deleted.
-
get
-
getAll
The getAll() method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.- Parameters:
name- The name of the parameter to return.- Returns:
- An array of USVStrings.
-
set
The set() method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.- Parameters:
name- The name of the parameter to set.value- The value of the parameter to set.
-
has
The has() method of the URLSearchParams interface returns a Boolean that indicates whether a parameter with the specified name exists.- Parameters:
name- The name of the parameter to find.- Returns:
- A Boolean.
-
forEach
The URLSearchParams.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
-
entries
The URLSearchParams.entries() method returns an iterator allowing to go through all key/value pairs contained in this object. The key and value of each pair are USVString objects.- Returns:
- an iterator.
-
keys
The URLSearchParams.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are USVString objects.- Returns:
- an iterator.
-
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.
-
getSize
public int getSize()- Returns:
- the total number of search parameter entries
-
jsToString
- Returns:
- the text of the URLSearchParams
-
getDefaultValue
Calls for instance for implicit conversion to string.- Specified by:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- the type hint- Returns:
- the default value
- See Also:
-
fillRequest
Sets the specified request with the parameters in thisFormData.- Parameters:
webRequest- the web request to fill
-