Module org.htmlunit

Class URLSearchParams

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
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.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class URLSearchParams extends HtmlUnitScriptable
JavaScript host object for URLSearchParams.
Author:
Ahmed Ashour, Ronald Brill, Ween Jiann, cd alexndr, Lai Quang Duong
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    ES6Iterator implementation for JavaScript support.

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(String name, String value)
    Appends a new key/value pair as a search parameter.
    void
    delete(String name)
    Deletes the given search parameter and all its associated values.
    org.htmlunit.corejs.javascript.ES6Iterator
    Returns an iterator over all key/value pairs in this object.
    void
    fillRequest(WebRequest webRequest)
    Populates the given WebRequest with the parameters from this object.
    void
    forEach(Object callback)
    Iterates over all key/value pairs, calling the given callback for each.
    get(String name)
    Returns the first value associated with the given search parameter.
    org.htmlunit.corejs.javascript.Scriptable
    getAll(String name)
    Returns all values associated with the given search parameter.
    Returns the default string representation of this object.
    int
    Returns the total number of search parameter entries.
    boolean
    has(String name)
    Returns whether a parameter with the given name exists.
    void
    Creates an instance of this object.
    Returns the URL-encoded string representation of this search params object.
    org.htmlunit.corejs.javascript.ES6Iterator
    Returns an iterator over all keys in this object.
    void
    set(String name, String value)
    Sets the value associated with the given search parameter, replacing all existing values.
    org.htmlunit.corejs.javascript.ES6Iterator
    Returns an iterator over all values in this object.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Constructor Details

    • URLSearchParams

      public URLSearchParams()
      Default constructor.
  • Method Details

    • jsConstructor

      public void jsConstructor(Object params)
      Creates an instance of this object.
      Parameters:
      params - initial search parameters; may be a string, a sequence of [name, value] pairs, or a record object
    • append

      public void append(String name, String value)
      Appends a new key/value pair as a search parameter.
      Parameters:
      name - the name of the parameter to append
      value - the value of the parameter to append
    • delete

      public void delete(String name)
      Deletes the given search parameter and all its associated values.
      Specified by:
      delete in interface org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>
      Specified by:
      delete in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      delete in class org.htmlunit.corejs.javascript.ScriptableObject
      Parameters:
      name - the name of the parameter to delete
    • get

      public String get(String name)
      Returns the first value associated with the given search parameter.
      Parameters:
      name - the name of the parameter to find
      Returns:
      the first value for the given name, or null if not found
    • getAll

      public org.htmlunit.corejs.javascript.Scriptable getAll(String name)
      Returns all values associated with the given search parameter.
      Parameters:
      name - the name of the parameter to find
      Returns:
      an array of all values for the given name
    • set

      public void set(String name, String value)
      Sets the value associated with the given search parameter, replacing all existing values. If the parameter does not exist, it is appended.
      Parameters:
      name - the name of the parameter to set
      value - the new value
    • has

      public boolean has(String name)
      Returns whether a parameter with the given name exists.
      Parameters:
      name - the name of the parameter to check
      Returns:
      true if the parameter exists, false otherwise
    • forEach

      public void forEach(Object callback)
      Iterates over all key/value pairs, calling the given callback for each.
      Parameters:
      callback - the function to call for each key/value pair
    • entries

      public org.htmlunit.corejs.javascript.ES6Iterator entries()
      Returns an iterator over all key/value pairs in this object. Keys and values are USVString objects.
      Returns:
      an iterator of [name, value] arrays
    • keys

      public org.htmlunit.corejs.javascript.ES6Iterator keys()
      Returns an iterator over all keys in this object.
      Returns:
      an iterator of key strings
    • values

      public org.htmlunit.corejs.javascript.ES6Iterator values()
      Returns an iterator over all values in this object.
      Returns:
      an iterator of value strings
    • getSize

      public int getSize()
      Returns the total number of search parameter entries.
      Returns:
      the number of entries
    • jsToString

      public String jsToString()
      Returns the URL-encoded string representation of this search params object.
      Returns:
      the encoded query string
    • getDefaultValue

      public Object getDefaultValue(Class<?> hint)
      Returns the default string representation of this object.
      Specified by:
      getDefaultValue in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      getDefaultValue in class HtmlUnitScriptable
      Parameters:
      hint - the type hint
      Returns:
      the URL-encoded query string
      See Also:
    • fillRequest

      public void fillRequest(WebRequest webRequest)
      Populates the given WebRequest with the parameters from this object.
      Parameters:
      webRequest - the web request to fill