This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new ee89873  REST refactoring.
ee89873 is described below

commit ee8987393f48ee0d647c22ca6464e662c6a83c39
Author: JamesBognar <james.bog...@salesforce.com>
AuthorDate: Sat Feb 20 13:37:48 2021 -0500

    REST refactoring.
---
 .../org/apache/juneau/rest/RequestHeaders.java     | 223 ++++++++--------
 .../org/apache/juneau/rest/RequestQueryParams.java | 291 ++++++++++++++-------
 .../java/org/apache/juneau/rest/RestRequest.java   |   2 +-
 .../org/apache/juneau/rest/args/HasQueryArg.java   |   4 +-
 .../juneau/rest/annotation/HasQuery_Test.java      |   4 +-
 5 files changed, 322 insertions(+), 202 deletions(-)

diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestHeaders.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestHeaders.java
index c5ddde4..6815735 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestHeaders.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestHeaders.java
@@ -23,7 +23,6 @@ import java.util.*;
 import java.util.function.*;
 
 import org.apache.http.*;
-import org.apache.http.message.*;
 import org.apache.juneau.httppart.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.collections.*;
@@ -34,7 +33,7 @@ import org.apache.juneau.http.header.Date;
  * Represents the headers in an HTTP request.
  *
  * <p>
- * Entries are stored in a case-insensitive map.
+ * Entries are stored in a case-insensitive map unless overridden via the 
constructor.
  *
  * <ul class='seealso'>
  *     <li class='link'>{@doc RestmRequestHeaders}
@@ -83,12 +82,23 @@ public class RequestHeaders {
        }
 
        /**
+        * Copy constructor.
+        */
+       private RequestHeaders(RequestHeaders copyFrom) {
+               req = copyFrom.req;
+               caseSensitive = copyFrom.caseSensitive;
+               parser = copyFrom.parser;
+               list.addAll(copyFrom.list);
+               map.putAll(copyFrom.map);
+       }
+
+       /**
         * Subset constructor.
         */
-       RequestHeaders(RestRequest req, Map<String,List<RequestHeader>> 
headerMap, HttpPartParserSession parser, boolean caseSensitive) {
+       private RequestHeaders(RestRequest req, Map<String,List<RequestHeader>> 
headerMap, HttpPartParserSession parser, boolean caseSensitive) {
                this.req = req;
-               this.map.putAll(headerMap);
-               this.list = 
headerMap.values().stream().flatMap(List::stream).collect(toList());
+               map.putAll(headerMap);
+               list = 
headerMap.values().stream().flatMap(List::stream).collect(toList());
                this.parser = parser;
                this.caseSensitive = caseSensitive;
        }
@@ -132,74 +142,68 @@ public class RequestHeaders {
        }
 
        /**
-        * Returns the first header with the specified name.
-        *
-        * <p>
-        * Note that this method never returns <jk>null</jk> and that {@link 
RequestHeader#isPresent()} can be used
-        * to test for the existence of the header.
+        * Returns all the headers with the specified name.
         *
         * @param name The header name.  Must not be <jk>null</jk>.
-        * @return The header.  Never <jk>null</jk>.
+        * @return The list of all headers with the specified name, or an empty 
list if none are found.
         */
-       public RequestHeader getFirst(String name) {
+       public List<RequestHeader> getAll(String name) {
                assertArgNotNull("name", name);
                List<RequestHeader> l = map.get(key(name));
-               return (l == null || l.isEmpty() ? new RequestHeader(req, name, 
null).parser(parser) : l.get(0));
+               return unmodifiableList(l == null ? emptyList() : l);
        }
 
        /**
-        * Returns the last header with the specified name.
-        *
-        * <p>
-        * Note that this method never returns <jk>null</jk> and that {@link 
RequestHeader#isPresent()} can be used
-        * to test for the existence of the header.
+        * Returns all the headers in this request.
         *
-        * @param name The header name.  Must not be <jk>null</jk>.
-        * @return The header.  Never <jk>null</jk>.
+        * @return All the headers in this request.
         */
-       public RequestHeader getLast(String name) {
-               assertArgNotNull("name", name);
-               List<RequestHeader> l = map.get(key(name));
-               return (l == null || l.isEmpty() ? new RequestHeader(req, name, 
null).parser(parser) : l.get(l.size()-1));
+       public List<RequestHeader> getAll() {
+               return unmodifiableList(list);
        }
 
        /**
-        * Returns all the headers with the specified name.
+        * Returns <jk>true</jk> if the headers with the specified names are 
present.
         *
-        * @param name The header name.  Must not be <jk>null</jk>.
-        * @return The list of all headers with the specified name, or an empty 
list if none are found.
+        * @param names The header names.  Must not be <jk>null</jk>.
+        * @return <jk>true</jk> if the headers with the specified names are 
present.
         */
-       public List<RequestHeader> getAll(String name) {
-               assertArgNotNull("name", name);
-               List<RequestHeader> l = map.get(key(name));
-               return unmodifiableList(l == null ? emptyList() : l);
+       public boolean contains(String...names) {
+               assertArgNotNull("names", names);
+               for (String n : names)
+                       if (! map.containsKey(key(n)))
+                               return false;
+               return true;
        }
 
        /**
-        * Returns all the headers in this request.
+        * Returns <jk>true</jk> if the header with any of the specified names 
are present.
         *
-        * @return All the headers in this request.
+        * @param names The header names.  Must not be <jk>null</jk>.
+        * @return <jk>true</jk> if the header with any of the specified names 
are present.
         */
-       public List<RequestHeader> getAll() {
-               return unmodifiableList(list);
+       public boolean containsAny(String...names) {
+               assertArgNotNull("names", names);
+               for (String n : names)
+                       if (map.containsKey(key(n)))
+                               return true;
+               return false;
        }
 
        /**
-        * Returns <jk>true</jk> if the header with the specified name is 
present.
+        * Returns <jk>true</jk> if these headers are empty.
         *
-        * @param name The header name.  Must not be <jk>null</jk>.
-        * @return <jk>true</jk> if the header with the specified name is 
present.
+        * @return <jk>true</jk> if these headers are empty.
         */
-       public boolean contains(String name) {
-               assertArgNotNull("name", name);
-               return map.containsKey(key(name));
+       public boolean isEmpty() {
+               return list.isEmpty();
        }
 
        /**
         * Adds a request header value.
         *
         * <p>
-        * Header is added to the end of the headers.
+        * Header is added to the end.
         * <br>Existing headers with the same name are not changed.
         *
         * @param name The header name.  Must not be <jk>null</jk>.
@@ -222,17 +226,17 @@ public class RequestHeaders {
         * Adds request header values.
         *
         * <p>
-        * Headers are added to the end of the headers.
+        * Headers are added to the end.
         * <br>Existing headers with the same name are not changed.
         *
-        * @param header The header objects.  Must not be <jk>null</jk>.
+        * @param headers The header objects.  Must not be <jk>null</jk>.
         * @return This object (for method chaining).
         */
-       public RequestHeaders add(Header...header) {
-               assertArgNotNull("header", header);
-               for (Header h : header) {
-                       assertArgNotNull("header entry", h);
-                       add(h.getName(), h.getValue());
+       public RequestHeaders add(Header...headers) {
+               assertArgNotNull("headers", headers);
+               for (Header h : headers) {
+                       if (h != null)
+                               add(h.getName(), h.getValue());
                }
                return this;
        }
@@ -241,7 +245,7 @@ public class RequestHeaders {
         * Sets a request header value.
         *
         * <p>
-        * Header is added to the end of the headers.
+        * Header is added to the end.
         * <br>Any previous headers with the same name are removed.
         *
         * @param name The header name.  Must not be <jk>null</jk>.
@@ -265,10 +269,10 @@ public class RequestHeaders {
         * Sets request header values.
         *
         * <p>
-        * Headers are added to the end of the headers.
+        * Headers are added to the end.
         * <br>Any previous headers with the same name are removed.
         *
-        * @param headers The header beans.  Must not be <jk>null</jk> or 
contain <jk>null</jk>.
+        * @param headers The header to set.  Must not be <jk>null</jk> or 
contain <jk>null</jk>.
         * @return This object (for method chaining).
         */
        public RequestHeaders set(Header...headers) {
@@ -310,27 +314,6 @@ public class RequestHeaders {
        }
 
        /**
-        * Returns an iterator of all the headers.
-        *
-        * @return An iterator of all the headers.  Never <jk>null</jk>.
-        */
-       @SuppressWarnings({ "rawtypes", "unchecked" })
-       public HeaderIterator iterator() {
-               return new BasicListHeaderIterator((List)list, null);
-       }
-
-       /**
-        * Returns an iterator of all the headers with the specified name.
-        *
-        * @param name The header name.
-        * @return An iterator of all the headers with the specified name.  
Never <jk>null</jk>.
-        */
-       @SuppressWarnings({ "unchecked", "rawtypes" })
-       public HeaderIterator iterator(String name) {
-               return new BasicListHeaderIterator((List)map.get(key(name)), 
null);
-       }
-
-       /**
         * Returns a copy of this object but only with the specified header 
names copied.
         *
         * @param headers The list to include in the copy.
@@ -352,12 +335,52 @@ public class RequestHeaders {
        
//-----------------------------------------------------------------------------------------------------------------
 
        /**
-        * Returns the last header with the specified name as a string.
+        * Returns the first header with the specified name.
+        *
+        * <p>
+        * Note that this method never returns <jk>null</jk> and that {@link 
RequestHeader#isPresent()} can be used
+        * to test for the existence of the header.
+        *
+        * @param name The header name.  Must not be <jk>null</jk>.
+        * @return The header.  Never <jk>null</jk>.
+        */
+       public RequestHeader getFirst(String name) {
+               assertArgNotNull("name", name);
+               List<RequestHeader> l = map.get(key(name));
+               return (l == null || l.isEmpty() ? new RequestHeader(req, name, 
null).parser(parser) : l.get(0));
+       }
+
+       /**
+        * Returns the last header with the specified name.
+        *
+        * <p>
+        * Note that this method never returns <jk>null</jk> and that {@link 
RequestHeader#isPresent()} can be used
+        * to test for the existence of the header.
+        *
+        * @param name The header name.  Must not be <jk>null</jk>.
+        * @return The header.  Never <jk>null</jk>.
+        */
+       public RequestHeader getLast(String name) {
+               assertArgNotNull("name", name);
+               List<RequestHeader> l = map.get(key(name));
+               return (l == null || l.isEmpty() ? new RequestHeader(req, name, 
null).parser(parser) : l.get(l.size()-1));
+       }
+
+       /**
+        * Returns the last header with the specified name.
+        *
+        * <p>
+        * This is equivalent to {@link #getLast(String)}.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
+        * @param name The header name.
+        * @return The header, never <jk>null</jk>.
+        */
+       public RequestHeader get(String name) {
+               return getLast(name);
+       }
+
+       /**
+        * Returns the last header with the specified name as a string.
         *
         * @param name The header name.
         * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
@@ -369,13 +392,8 @@ public class RequestHeaders {
        /**
         * Returns the last header with the specified name as an integer.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
-        *
         * @param name The header name.
-        * @return The header value, or {@link Optional#empty()} if the header 
isn't present.
+        * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
         */
        public Optional<Integer> getInteger(String name) {
                return getLast(name).asInteger();
@@ -384,13 +402,8 @@ public class RequestHeaders {
        /**
         * Returns the last header with the specified name as a boolean.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
-        *
         * @param name The header name.
-        * @return The header value, or {@link Optional#empty()} if the header 
isn't present.
+        * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
         */
        public Optional<Boolean> getBoolean(String name) {
                return getLast(name).asBoolean();
@@ -399,13 +412,8 @@ public class RequestHeaders {
        /**
         * Returns the last header with the specified name as a list from a 
comma-delimited string.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
-        *
         * @param name The header name.
-        * @return The header value, or {@link Optional#empty()} if the header 
isn't present.
+        * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
         */
        public Optional<List<String>> getCsvArray(String name) {
                return getLast(name).asCsvArray();
@@ -414,13 +422,8 @@ public class RequestHeaders {
        /**
         * Returns the last header with the specified name as a long.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
-        *
         * @param name The header name.
-        * @return The header value, or {@link Optional#empty()} if the header 
isn't present.
+        * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
         */
        public Optional<Long> getLong(String name) {
                return getLast(name).asLong();
@@ -429,13 +432,8 @@ public class RequestHeaders {
        /**
         * Returns the last header with the specified name as a boolean.
         *
-        * <ul class='notes'>
-        *      <li>
-        *              If {@code allowHeaderParams} init parameter is 
<jk>true</jk>, then first looks for {@code &HeaderName=x} in the URL query 
string.
-        * </ul>
-        *
         * @param name The header name.
-        * @return The header value, or {@link Optional#empty()} if the header 
isn't present.
+        * @return The header value, or {@link Optional#empty()} if it doesn't 
exist.
         */
        public Optional<ZonedDateTime> getDate(String name) {
                return getLast(name).asDate();
@@ -948,6 +946,15 @@ public class RequestHeaders {
        
//-----------------------------------------------------------------------------------------------------------------
 
        /**
+        * Makes a copy of these parameters.
+        *
+        * @return A new parameters object.
+        */
+       public RequestHeaders copy() {
+               return new RequestHeaders(this);
+       }
+
+       /**
         * Converts the headers to a readable string.
         *
         * @param sorted Sort the headers by name.
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestQueryParams.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestQueryParams.java
index ec403d7..5b88159 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestQueryParams.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestQueryParams.java
@@ -26,7 +26,14 @@ import org.apache.juneau.utils.*;
 import org.apache.juneau.collections.*;
 
 /**
- * Represents the query parameters on an HTTP request.
+ * Represents the query parameters in an HTTP request.
+ *
+ * <p>
+ * Entries are stored in a case-sensitive map unless overridden via the 
constructor.
+ *
+ * <ul class='seealso'>
+ *     <li class='link'>{@doc RestmRequestHeaders}
+ * </ul>
  */
 public class RequestQueryParams {
 
@@ -65,7 +72,10 @@ public class RequestQueryParams {
                }
        }
 
-       RequestQueryParams(RequestQueryParams copyFrom) {
+       /**
+        * Copy constructor.
+        */
+       private RequestQueryParams(RequestQueryParams copyFrom) {
                req = copyFrom.req;
                caseSensitive = copyFrom.caseSensitive;
                parser = copyFrom.parser;
@@ -80,11 +90,15 @@ public class RequestQueryParams {
                return this;
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Basic operations.
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Adds default entries to these parameters.
         *
         * <p>
-        * Similar to {@link #put(String, Object)} but doesn't override 
existing values.
+        * Similar to {@link #set(String, Object)} but doesn't override 
existing values.
         *
         * @param pairs
         *      The default entries.
@@ -109,6 +123,184 @@ public class RequestQueryParams {
        }
 
        /**
+        * Returns all the parameters with the specified name.
+        *
+        * @param name The parameter name.
+        * @return The list of all parameters with the specified name, or an 
empty list if none are found.
+        */
+       public List<RequestQueryParam> getAll(String name) {
+               assertArgNotNull("name", name);
+               List<RequestQueryParam> l = map.get(key(name));
+               return unmodifiableList(l == null ? emptyList() : l);
+       }
+
+       /**
+        * Returns all the parameters on this request.
+        *
+        * @return All the parameters on this request.
+        */
+       public List<RequestQueryParam> getAll() {
+               return unmodifiableList(list);
+       }
+
+       /**
+        * Returns <jk>true</jk> if the parameters with the specified names are 
present.
+        *
+        * @param names The parameter names.  Must not be <jk>null</jk>.
+        * @return <jk>true</jk> if the parameters with the specified names are 
present.
+        */
+       public boolean contains(String...names) {
+               assertArgNotNull("names", names);
+               for (String n : names)
+                       if (! map.containsKey(key(n)))
+                               return false;
+               return true;
+       }
+
+       /**
+        * Returns <jk>true</jk> if the parameter with any of the specified 
names are present.
+        *
+        * @param names The parameter names.  Must not be <jk>null</jk>.
+        * @return <jk>true</jk> if the parameter with any of the specified 
names are present.
+        */
+       public boolean containsAny(String...names) {
+               assertArgNotNull("names", names);
+               for (String n : names)
+                       if (map.containsKey(key(n)))
+                               return true;
+               return false;
+       }
+
+       /**
+        * Returns <jk>true</jk> if these parameters are empty.
+        *
+        * @return <jk>true</jk> if these parameters are empty.
+        */
+       public boolean isEmpty() {
+               return list.isEmpty();
+       }
+
+       /**
+        * Adds a parameter value.
+        *
+        * <p>
+        * Parameter is added to the end.
+        * <br>Existing parameter with the same name are not changed.
+        *
+        * @param name The parameter name.  Must not be <jk>null</jk>.
+        * @param value The parameter value.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams add(String name, Object value) {
+               assertArgNotNull("name", name);
+               String key = key(name);
+               RequestQueryParam h = new RequestQueryParam(req, name, 
stringify(value)).parser(parser);
+               if (map.containsKey(key))
+                       map.get(key).add(h);
+               else
+                       map.put(key, AList.of(h));
+               list.add(h);
+               return this;
+       }
+
+       /**
+        * Adds request parameter values.
+        *
+        * <p>
+        * Parameters are added to the end.
+        * <br>Existing parameters with the same name are not changed.
+        *
+        * @param parameters The parameter objects.  Must not be <jk>null</jk>.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams add(NameValuePair...parameters) {
+               assertArgNotNull("parameters", parameters);
+               for (NameValuePair p : parameters) {
+                       if (p != null)
+                               add(p.getName(), p.getValue());
+               }
+               return this;
+       }
+
+       /**
+        * Sets a parameter value.
+        *
+        * <p>
+        * Parameter is added to the end.
+        * <br>Any previous parameters with the same name are removed.
+        *
+        * @param name The parameter name.  Must not be <jk>null</jk>.
+        * @param value
+        *      The parameter value.
+        *      <br>Converted to a string using {@link Object#toString()}.
+        *      <br>Can be <jk>null</jk>.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams set(String name, Object value) {
+               assertArgNotNull("name", name);
+               String key = key(name);
+               RequestQueryParam p = new RequestQueryParam(req, name, 
stringify(value)).parser(parser);
+               if (map.containsKey(key))
+                       
list.removeIf(x->caseSensitive?x.getName().equals(name):x.getName().equalsIgnoreCase(name));
+               list.add(p);
+               map.put(key, AList.of(p));
+               return this;
+       }
+
+
+       /**
+        * Sets request header values.
+        *
+        * <p>
+        * Parameters are added to the end of the headers.
+        * <br>Any previous parameters with the same name are removed.
+        *
+        * @param parameters The parameters to set.  Must not be <jk>null</jk> 
or contain <jk>null</jk>.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams set(NameValuePair...parameters) {
+               assertArgNotNull("headers", parameters);
+               for (NameValuePair p : parameters)
+                       remove(p);
+               for (NameValuePair p : parameters)
+                       add(p);
+               return this;
+       }
+
+       /**
+        * Remove parameters.
+        *
+        * @param name The parameter names.  Must not be <jk>null</jk>.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams remove(String...name) {
+               assertArgNotNull("name", name);
+               for (String n : name) {
+                       String key = key(n);
+                       if (map.containsKey(key))
+                               list.removeAll(map.get(key));
+                       map.remove(key);
+               }
+               return this;
+       }
+
+       /**
+        * Remove parameters.
+        *
+        * @param parameters The parameters to remove.  Must not be 
<jk>null</jk>.
+        * @return This object (for method chaining).
+        */
+       public RequestQueryParams remove(NameValuePair...parameters) {
+               for (NameValuePair p : parameters)
+                       remove(p.getName());
+               return this;
+       }
+
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Convenience getters.
+       
//-----------------------------------------------------------------------------------------------------------------
+
+       /**
         * Returns the first parameter with the specified name.
         *
         * <p>
@@ -141,28 +333,10 @@ public class RequestQueryParams {
        }
 
        /**
-        * Returns all the parameters with the specified name.
-        *
-        * @param name The parameter name.
-        * @return The list of all parameters with the specified name, or an 
empty list if none are found.
-        */
-       public List<RequestQueryParam> getAll(String name) {
-               assertArgNotNull("name", name);
-               List<RequestQueryParam> l = map.get(key(name));
-               return unmodifiableList(l == null ? emptyList() : l);
-       }
-
-       /**
-        * Returns all the parameters on this request.
+        * Returns the last parameter with the specified name.
         *
-        * @return All the parameters on this request.
-        */
-       public List<RequestQueryParam> getAll() {
-               return unmodifiableList(list);
-       }
-
-       /**
-        * Returns the last parameter with the specified name as a string.
+        * <p>
+        * This is equivalent to {@link #getLast(String)}.
         *
         * @param name The parameter name.
         * @return The parameter value, or {@link Optional#empty()} if it 
doesn't exist.
@@ -231,48 +405,9 @@ public class RequestQueryParams {
                return getLast(name).asDate();
        }
 
-       /**
-        * Sets a parameter value.
-        *
-        * <p>
-        * This overwrites any previous value.
-        *
-        * @param name The parameter name.
-        * @param value The parameter value.
-        * @return This object (for method chaining).
-        */
-       public RequestQueryParams put(String name, Object value) {
-               assertArgNotNull("name", name);
-               String key = key(name);
-               RequestQueryParam p = new RequestQueryParam(req, name, 
stringify(value)).parser(parser);
-               if (map.containsKey(key))
-                       
list.removeIf(x->caseSensitive?x.getName().equals(name):x.getName().equalsIgnoreCase(name));
-               list.add(p);
-               map.put(key, AList.of(p));
-               return this;
-       }
-
-       /**
-        * Adds a parameter value.
-        *
-        * <p>
-        * Parameter is added to the end of the parameters.
-        *
-        * @param name The parameter name.
-        * @param value The parameter value.
-        * @return This object (for method chaining).
-        */
-       public RequestQueryParams add(String name, Object value) {
-               assertArgNotNull("name", name);
-               String key = key(name);
-               RequestQueryParam h = new RequestQueryParam(req, name, 
stringify(value)).parser(parser);
-               if (map.containsKey(key))
-                       map.get(key).add(h);
-               else
-                       map.put(key, AList.of(h));
-               list.add(h);
-               return this;
-       }
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Other methods.
+       
//-----------------------------------------------------------------------------------------------------------------
 
        /**
         * Converts this object to a query string.
@@ -302,28 +437,6 @@ public class RequestQueryParams {
        }
 
        /**
-        * Returns <jk>true</jk> if these parameters are empty.
-        *
-        * @return <jk>true</jk> if these parameters are empty.
-        */
-       public boolean isEmpty() {
-               return list.isEmpty();
-       }
-
-       /**
-        * Returns <jk>true</jk> if these parameters contain the specified name.
-        *
-        * @param name The parameter name.
-        * @return <jk>true</jk> if these parameters contain the specified name.
-        */
-       public boolean containsName(String...name) {
-               for (String n : name)
-                       if (map.containsKey(key(n)))
-                               return true;
-               return false;
-       }
-
-       /**
         * Locates the special search query arguments in the query and returns 
them as a {@link SearchArgs} object.
         *
         * <p>
@@ -361,7 +474,7 @@ public class RequestQueryParams {
         *      <br>Returns <jk>null</jk> if no search arguments were found.
         */
        public SearchArgs getSearchArgs() {
-               if (containsName("s","v","o","p","l","i")) {
+               if (contains("s","v","o","p","l","i")) {
                        return new SearchArgs.Builder()
                                .search(getString("s").orElse(null))
                                .view(getString("v").orElse(null))
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index 2aaf8d1..2cb9525 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -923,7 +923,7 @@ public final class RestRequest {
                        RequestQueryParams rq = this.queryParams.copy();
                        if (addQueryParams != null)
                                for (Map.Entry<String,?> e : 
addQueryParams.entrySet())
-                                       rq.put(e.getKey(), e.getValue());
+                                       rq.set(e.getKey(), e.getValue());
                        if (! rq.isEmpty())
                                sb.append('?').append(rq.asQueryString());
                        uri = sb.toString();
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/args/HasQueryArg.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/args/HasQueryArg.java
index 55ee9d9..a66a92f 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/args/HasQueryArg.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/args/HasQueryArg.java
@@ -26,7 +26,7 @@ import org.apache.juneau.rest.annotation.*;
  * Resolves method parameters annotated with {@link HasQuery} on {@link 
RestOp}-annotated Java methods.
  *
  * <p>
- * The parameter value is resolved using <c><jv>call</jv>.{@link 
RestCall#getRestRequest() getRestRequest}().{@link 
RestRequest#getRequestQuery() getQuery}().{@link 
RequestQueryParams#containsName(String...) containsName}(<jv>name</jv>)</c>
+ * The parameter value is resolved using <c><jv>call</jv>.{@link 
RestCall#getRestRequest() getRestRequest}().{@link 
RestRequest#getRequestQuery() getQuery}().{@link 
RequestQueryParams#contains(String...) contains}(<jv>name</jv>)</c>
  *
  * <p>
  * The parameter type can be a <jk>boolean</jk> or anything convertible from a 
<jk>boolean</jk>.
@@ -71,6 +71,6 @@ public class HasQueryArg implements RestOperationArg {
        public Object resolve(RestCall call) throws Exception {
                RestRequest req = call.getRestRequest();
                BeanSession bs = req.getBeanSession();
-               return 
bs.convertToType(req.getRequestQuery().containsName(name), 
bs.getClassMeta(type));
+               return bs.convertToType(req.getRequestQuery().contains(name), 
bs.getClassMeta(type));
        }
 }
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/HasQuery_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/HasQuery_Test.java
index acc0b20..503c05c 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/HasQuery_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/HasQuery_Test.java
@@ -33,12 +33,12 @@ public class HasQuery_Test {
                @RestGet
                public String a(RestRequest req, @HasQuery("p1") boolean p1, 
@HasQuery("p2") Boolean p2) throws Exception {
                        RequestQueryParams q = req.getRequestQuery();
-                       return 
"p1=["+p1+","+q.containsName("p1")+"],p2=["+p2+","+q.containsName("p2")+"]";
+                       return 
"p1=["+p1+","+q.contains("p1")+"],p2=["+p2+","+q.contains("p2")+"]";
                }
                @RestPost
                public String b(RestRequest req, @HasQuery("p1") boolean p1, 
@HasQuery("p2") Boolean p2) throws Exception {
                        RequestQueryParams q = req.getRequestQuery();
-                       return 
"p1=["+p1+","+q.containsName("p1")+"],p2=["+p2+","+q.containsName("p2")+"]";
+                       return 
"p1=["+p1+","+q.contains("p1")+"],p2=["+p2+","+q.contains("p2")+"]";
                }
        }
 

Reply via email to