Class URLSearchParams

  • 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 URLSearchParams
    extends HtmlUnitScriptable
    A JavaScript object for URLSearchParams.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  URLSearchParams.NativeParamsIterator  
      • Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.commons.logging.Log LOG  
      private URL url_  
      static java.lang.String URL_SEARCH_PARMS_TAG
      Constant used to register the prototype in the context.
      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      URLSearchParams()
      Constructs a new instance.
      URLSearchParams​(URL url)
      Constructs a new instance for the given js url.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(java.lang.String name, java.lang.String value)
      The append() method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
      private static org.htmlunit.corejs.javascript.IteratorLikeIterable buildIteratorLikeIterable​(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable iterable)  
      void delete​(java.lang.String name)
      The delete() method of the URLSearchParams interface deletes the given search parameter and its associated value, from the list of all search parameters.
      java.lang.Object entries()
      The URLSearchParams.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
      void fillRequest​(WebRequest webRequest)
      Sets the specified request with the parameters in this FormData.
      void forEach​(java.lang.Object callback)
      The URLSearchParams.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.
      java.lang.String get​(java.lang.String name)
      The get() method of the URLSearchParams interface returns the first value associated to the given search parameter.
      org.htmlunit.corejs.javascript.Scriptable getAll​(java.lang.String name)
      The getAll() method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
      java.lang.Object getDefaultValue​(java.lang.Class<?> hint)
      Calls for instance for implicit conversion to string.
      int getSize()  
      boolean has​(java.lang.String name)
      The has() method of the URLSearchParams interface returns a Boolean that indicates whether a parameter with the specified name exists.
      void jsConstructor​(java.lang.Object params)
      Constructs a new instance.
      java.lang.String jsToString()  
      java.lang.Object keys()
      The URLSearchParams.keys() method returns an iterator allowing to go through all keys contained in this object.
      private static java.util.List<NameValuePair> resolveParams​(java.lang.Object params)  
      void set​(java.lang.String name, java.lang.String value)
      The set() method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
      private java.util.List<NameValuePair> splitQuery()  
      private static java.util.List<NameValuePair> splitQuery​(java.lang.String params)  
      private static NameValuePair splitQueryParameter​(java.lang.String singleParam)  
      java.lang.Object values()
      The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object.
      • 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, 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
      • URL_SEARCH_PARMS_TAG

        public static final java.lang.String URL_SEARCH_PARMS_TAG
        Constant used to register the prototype in the context.
        See Also:
        Constant Field Values
      • url_

        private URL url_
    • Constructor Detail

      • 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 Detail

      • jsConstructor

        public void jsConstructor​(java.lang.Object params)
        Constructs a new instance.
        Parameters:
        params - the params string
      • resolveParams

        private static java.util.List<NameValuePair> resolveParams​(java.lang.Object params)
      • splitQuery

        private java.util.List<NameValuePair> splitQuery()
      • splitQuery

        private static java.util.List<NameValuePair> splitQuery​(java.lang.String params)
      • splitQueryParameter

        private static NameValuePair splitQueryParameter​(java.lang.String singleParam)
      • buildIteratorLikeIterable

        private static org.htmlunit.corejs.javascript.IteratorLikeIterable buildIteratorLikeIterable​(org.htmlunit.corejs.javascript.Context cx,
                                                                                                     org.htmlunit.corejs.javascript.Scriptable iterable)
      • append

        public void append​(java.lang.String name,
                           java.lang.String value)
        The append() method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
        Parameters:
        name - The name of the parameter to append.
        value - The value of the parameter to append.
      • delete

        public void delete​(java.lang.String name)
        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:
        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 be deleted.
      • get

        public java.lang.String get​(java.lang.String name)
        The get() method of the URLSearchParams interface returns the first value associated to the given search parameter.
        Parameters:
        name - The name of the parameter to return.
        Returns:
        An array of USVStrings.
      • getAll

        public org.htmlunit.corejs.javascript.Scriptable getAll​(java.lang.String name)
        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

        public void set​(java.lang.String name,
                        java.lang.String value)
        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

        public boolean has​(java.lang.String name)
        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

        public void forEach​(java.lang.Object callback)
        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

        public java.lang.Object 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

        public java.lang.Object 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

        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.
      • getSize

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

        public java.lang.String jsToString()
        Returns:
        the text of the URLSearchParams
      • fillRequest

        public void fillRequest​(WebRequest webRequest)
        Sets the specified request with the parameters in this FormData.
        Parameters:
        webRequest - the web request to fill