Class HttpRequestKeys

  • All Implemented Interfaces:
    RequestKeys

    public class HttpRequestKeys
    extends GenericRequestKeys
    The HttpRequestKeys class makes available to the application the values of parameters passed on the URL (Query String), post (form data), cookies and session variables.
    It has been implemented as case insensitive, meaning that if one key is recorded as "abc" with value "1" and another with key as "ABC" and value "2", both values will be accessible via the same key (that can be requested as "abc", "ABC", "aBC", etc)
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • COOKIE_SPACE

        public static final int COOKIE_SPACE
        Flag for including cookies on the key space property of the HttpRequestKeys instance
        See Also:
        Constant Field Values
      • FORM_AND_QUERY_DATA_SPACE

        public static final int FORM_AND_QUERY_DATA_SPACE
        Flag for including form data on the key space property of the HttpRequestKeys instance
        See Also:
        Constant Field Values
      • SESSION_SPACE

        public static final int SESSION_SPACE
        Flag for including session variables on the key space property of the HttpRequestKeys instance
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpRequestKeys

        public HttpRequestKeys​(ContainerServices containerServices)
        Class constructor. Initialization requires a non-null Container Services object.
        Parameters:
        containerServices - an initialized instance of ContainerServices
    • Method Detail

      • getValue

        public java.lang.String getValue​(java.lang.String keyName)
        Returns from this collection a comma separated string of all the values mapped by the specified keyName.
        Specified by:
        getValue in interface RequestKeys
        Overrides:
        getValue in class GenericRequestKeys
        Parameters:
        keyName - a key in this collection
        Returns:
        all the values mapped to the keyName, separated by the character comma; null if the key does not exist.
      • getValue

        public java.lang.String getValue​(java.lang.String keyName,
                                         int valueIndex)
        Returns the value at the specified position mapped by the specified keyName.
        Specified by:
        getValue in interface RequestKeys
        Overrides:
        getValue in class GenericRequestKeys
        Parameters:
        keyName - a key in this collection
        valueIndex - the index of a value mapped to the key specified
        Returns:
        the value at the specified position mapped by the specified key; null if the key does not exist.
      • getValueCount

        public int getValueCount​(java.lang.String keyName)
        Returns from this collection the number of values mapped with the keyName.
        Specified by:
        getValueCount in interface RequestKeys
        Overrides:
        getValueCount in class GenericRequestKeys
        Parameters:
        keyName - a key to a value collection
        Returns:
        the count of values to which the specified key is mapped in this collection; 0 if the key is not found.
      • getKeyListByPrefix

        public java.util.Enumeration getKeyListByPrefix​(java.lang.String prefix)
        Returns an enumeration over all the keys with the specified prefix.
        Returns all the keys if the specified prefix is null or empty.
        Returns an empty list if no key is found.
        Specified by:
        getKeyListByPrefix in interface RequestKeys
        Overrides:
        getKeyListByPrefix in class GenericRequestKeys
        Parameters:
        prefix - the prefix of keys.
        Returns:
        an enumeration over all the keys that have the specified prefix.
      • getKeySpace

        public int getKeySpace()
        Get the key space set for this HttpRequestKeys instance.
        Returns:
        an int value representing the flags from where the information for the HttpRequestKeys is going to be taken from.
      • setKeySpace

        public void setKeySpace​(int keySpace)
        Set the key space to be used with this HttpRequestKeys instance.
        Parameters:
        keySpace - an int value representing the flags from where the information for the HttpRequestKeys is going to be taken from.
      • add

        public java.lang.String add​(java.lang.String key,
                                    java.lang.String value)
        Add the requested key and its value to the collection. Before adding manually new key values, this RequestKeys instance should have initialized the session and request properties, so all the values are added correctly.
        Specified by:
        add in interface RequestKeys
        Overrides:
        add in class GenericRequestKeys
        Parameters:
        key - the key under which the new value will be appended
        value - the value to be appended
        Returns:
        a copy of the value added
        Since:
        MicroStrategy Web 9.0.0
      • initializeRequestKeys

        protected void initializeRequestKeys()
        Initializes the collection with the values from the Request and/or Session, according to what was specified by the keySpace.
        Overrides:
        initializeRequestKeys in class GenericRequestKeys