spark

Class QueryParamsMap

    • Constructor Detail

      • QueryParamsMap

        public QueryParamsMap(javax.servlet.http.HttpServletRequest request)
        Creates a new QueryParamsMap from and HttpServletRequest.
        Parses the parameters from request.getParameterMap()
        No need to decode, since HttpServletRequest does it for us.
        Parameters:
        request -
      • QueryParamsMap

        protected QueryParamsMap()
      • QueryParamsMap

        protected QueryParamsMap(String key,
                      String... values)
        Parses the key and creates the child QueryParamMaps user[info][name] creates 3 nested QueryParamMaps. For user, info and name.
        Parameters:
        key - The key in the formar fo key1[key2][key3] (for example: user[info][name]).
        values -
    • Method Detail

      • loadQueryString

        protected final void loadQueryString(Map<String,String[]> params)
      • loadKeys

        protected final void loadKeys(String key,
                    String[] value)
      • cleanKey

        protected static final String cleanKey(String group)
      • get

        public QueryParamsMap get(String... keys)
        Retruns and element fro the specified key.
        For querystring:

        user[name]=fede

        get("user").get("name").value() # fede
        or
        get("user","name").value() # fede
        Parameters:
        key - The paramater nested key
        Returns:
      • value

        public String value()
        Returns the value for this key.
        If this key has nested elements and does not have a value returns null.
        Returns:
      • value

        public String value(String... keys)
        Returns the value for that key.
        It is a shortcut for:

        get("user").get("name").value() get("user").value("name")
        Parameters:
        key -
        Returns:
      • hasKeys

        public boolean hasKeys()
      • hasValue

        public boolean hasValue()
      • booleanValue

        public Boolean booleanValue()
      • integerValue

        public Integer integerValue()
      • longValue

        public Long longValue()
      • floatValue

        public Float floatValue()
      • doubleValue

        public Double doubleValue()
      • values

        public String[] values()

Copyright © 2013. All Rights Reserved.