Package oauth.signpost.http
Class HttpParameters
java.lang.Object
oauth.signpost.http.HttpParameters
- All Implemented Interfaces:
Serializable
,Map<String,
SortedSet<String>>
A multi-map of HTTP request parameters. Each key references a
. Every key/value pair will be
percent-encoded upon insertion. This class has special semantics tailored to
being useful for message signing; it's not a general purpose collection class
to handle request parameters.
SortedSet
of parameters collected from the request during message
signing. Parameter values are sorted as per
invalid reference
://oauth.net/core/1.0a/#anchor13
- See Also:
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
getAsHeaderElement
(String key) getAsQueryString
(Object key) Concatenates all values for the given key to a list of key/value pairs suitable for use in a URL query string.getAsQueryString
(Object key, boolean percentEncode) Concatenates all values for the given key to a list of key/value pairs suitable for use in a URL query string.Convenience method forinvalid @link
{@link #getFirst(key, false)
Returns the first value from the set of all values for the given parameter name.boolean
isEmpty()
keySet()
Convenience method to add a single value for the parameter specified by 'key'.Convenience method to add a single value for the parameter specified by 'key'.void
void
void
void
Convenience method to merge a Mapinvalid input: '<'String, List>. Convenience method to allow for storing null values.int
size()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
wrappedMap
-
-
Constructor Details
-
HttpParameters
public HttpParameters()
-
-
Method Details
-
put
-
put
-
put
Convenience method to add a single value for the parameter specified by 'key'.- Parameters:
key
- the parameter namevalue
- the parameter value- Returns:
- the value
-
put
Convenience method to add a single value for the parameter specified by 'key'.- Parameters:
key
- the parameter namevalue
- the parameter valuepercentEncode
- whether key and value should be percent encoded before being inserted into the map- Returns:
- the value
-
putNull
Convenience method to allow for storing null values.put(java.lang.String, java.util.SortedSet<java.lang.String>)
doesn't allow null values, because that would be ambiguous.- Parameters:
key
- the parameter namenullString
- can be anything, but probably... null?- Returns:
- null
-
putAll
-
putAll
-
putAll
-
putMap
Convenience method to merge a Mapinvalid input: '<'String, List>. - Parameters:
m
- the map
-
get
-
getFirst
Convenience method forinvalid @link
{@link #getFirst(key, false)
- Parameters:
key
- the parameter name (must be percent encoded if it contains unsafe characters!)- Returns:
- the first value found for this parameter
-
getFirst
Returns the first value from the set of all values for the given parameter name. If the key passed to this method contains special characters, you MUST first percent encode it usingOAuth.percentEncode(String)
, otherwise the lookup will fail (that's because upon storing values in this map, keys get percent-encoded).- Parameters:
key
- the parameter name (must be percent encoded if it contains unsafe characters!)percentDecode
- whether the value being retrieved should be percent decoded- Returns:
- the first value found for this parameter
-
getAsQueryString
Concatenates all values for the given key to a list of key/value pairs suitable for use in a URL query string.- Parameters:
key
- the parameter name- Returns:
- the query string
-
getAsQueryString
Concatenates all values for the given key to a list of key/value pairs suitable for use in a URL query string.- Parameters:
key
- the parameter namepercentEncode
- whether key should be percent encoded before being used with the map- Returns:
- the query string
-
getAsHeaderElement
-
containsKey
- Specified by:
containsKey
in interfaceMap<String,
SortedSet<String>>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
SortedSet<String>>
-
size
public int size() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
remove
-
keySet
-
values
-
entrySet
-
getOAuthParameters
-