Changeset 10831 in josm for trunk/src/oauth/signpost/http
- Timestamp:
- 2016-08-18T00:21:03+02:00 (9 years ago)
- Location:
- trunk/src/oauth/signpost/http
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oauth/signpost/http/HttpParameters.java
r6849 r10831 30 30 * A multi-map of HTTP request parameters. Each key references a 31 31 * {@link SortedSet} of parameters collected from the request during message 32 * signing. Parameter values are sorted as per {@linkplain http 33 * ://oauth.net/core/1.0a/#anchor13}. Every key/value pair will be 34 * percent-encoded upon insertion. This class has special semantics tailored to 35 * being useful for message signing; it's not a general purpose collection class 36 * to handle request parameters. 37 * 32 * signing. Parameter values are sorted as per {@linkplain http://oauth.net/core/1.0a/#anchor13}. 33 * Every key/value pair will be percent-encoded upon insertion. 34 * This class has special semantics tailored to being useful for message signing; 35 * it's not a general purpose collection class to handle request parameters. 36 * 38 37 * @author Matthias Kaeppler 39 38 */ … … 41 40 public class HttpParameters implements Map<String, SortedSet<String>>, Serializable { 42 41 43 private TreeMap<String, SortedSet<String>> wrappedMap = new TreeMap<String, SortedSet<String>>(); 44 42 private TreeMap<String, SortedSet<String>> wrappedMap = new TreeMap<>(); 43 44 @Override 45 45 public SortedSet<String> put(String key, SortedSet<String> value) { 46 46 return wrappedMap.put(key, value); … … 62 62 * Convenience method to add a single value for the parameter specified by 63 63 * 'key'. 64 * 64 * 65 65 * @param key 66 66 * the parameter name … … 76 76 * Convenience method to add a single value for the parameter specified by 77 77 * 'key'. 78 * 78 * 79 79 * @param key 80 80 * the parameter name … … 91 91 SortedSet<String> values = wrappedMap.get(key); 92 92 if (values == null) { 93 values = new TreeSet< String>();93 values = new TreeSet<>(); 94 94 wrappedMap.put( key, values); 95 95 } … … 105 105 * Convenience method to allow for storing null values. {@link #put} doesn't 106 106 * allow null values, because that would be ambiguous. 107 * 107 * 108 108 * @param key 109 109 * the parameter name … … 116 116 } 117 117 118 @Override 118 119 public void putAll(Map<? extends String, ? extends SortedSet<String>> m) { 119 120 wrappedMap.putAll(m); … … 138 139 /** 139 140 * Convenience method to merge a Map<String, List<String>>. 140 * 141 * 141 142 * @param m 142 143 * the map … … 146 147 SortedSet<String> vals = get(key); 147 148 if (vals == null) { 148 vals = new TreeSet< String>();149 vals = new TreeSet<>(); 149 150 put(key, vals); 150 151 } … … 153 154 } 154 155 156 @Override 155 157 public SortedSet<String> get(Object key) { 156 158 return wrappedMap.get(key); … … 159 161 /** 160 162 * Convenience method for {@link #getFirst(key, false)}. 161 * 163 * 162 164 * @param key 163 165 * the parameter name (must be percent encoded if it contains unsafe … … 176 178 * (that's because upon storing values in this map, keys get 177 179 * percent-encoded). 178 * 180 * 179 181 * @param key 180 182 * the parameter name (must be percent encoded if it contains unsafe … … 196 198 * Concatenates all values for the given key to a list of key/value pairs 197 199 * suitable for use in a URL query string. 198 * 200 * 199 201 * @param key 200 202 * the parameter name … … 208 210 * Concatenates all values for the given key to a list of key/value pairs 209 211 * suitable for use in a URL query string. 210 * 212 * 211 213 * @param key 212 214 * the parameter name … … 237 239 return sb.toString(); 238 240 } 239 241 240 242 public String getAsHeaderElement(String key) { 241 243 String value = getFirst(key); … … 246 248 } 247 249 250 @Override 248 251 public boolean containsKey(Object key) { 249 252 return wrappedMap.containsKey(key); 250 253 } 251 254 255 @Override 252 256 public boolean containsValue(Object value) { 253 257 for (Set<String> values : wrappedMap.values()) { … … 259 263 } 260 264 265 @Override 261 266 public int size() { 262 267 int count = 0; … … 267 272 } 268 273 274 @Override 269 275 public boolean isEmpty() { 270 276 return wrappedMap.isEmpty(); 271 277 } 272 278 279 @Override 273 280 public void clear() { 274 281 wrappedMap.clear(); 275 282 } 276 283 284 @Override 277 285 public SortedSet<String> remove(Object key) { 278 286 return wrappedMap.remove(key); 279 287 } 280 288 289 @Override 281 290 public Set<String> keySet() { 282 291 return wrappedMap.keySet(); 283 292 } 284 293 294 @Override 285 295 public Collection<SortedSet<String>> values() { 286 296 return wrappedMap.values(); 287 297 } 288 298 299 @Override 289 300 public Set<Entry<String, SortedSet<String>>> entrySet() { 290 301 return wrappedMap.entrySet(); -
trunk/src/oauth/signpost/http/HttpRequest.java
r4231 r10831 6 6 7 7 import oauth.signpost.OAuthConsumer; 8 import oauth.signpost.basic.HttpURLConnectionRequestAdapter;9 8 10 9 /** … … 14 13 * currently supported, you'll have to write an adapter which implements this 15 14 * interface and a custom {@link OAuthConsumer} which performs the wrapping. 16 * 17 * @see HttpURLConnectionRequestAdapter 15 * 18 16 * @author Matthias Kaeppler 19 17 */ … … 38 36 /** 39 37 * Returns the wrapped request object, in case you must work directly on it. 40 * 38 * 41 39 * @return the wrapped request object 42 40 */
Note:
See TracChangeset
for help on using the changeset viewer.