Java Code Examples for org.eclipse.jetty.util.MultiMap#entrySet()
The following examples show how to use
org.eclipse.jetty.util.MultiMap#entrySet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuth2InteractiveAuthenticatorTest.java From qpid-broker-j with Apache License 2.0 | 6 votes |
private Map<String, String> getRedirectParameters(final String redirectLocation) { final MultiMap<String> parameterMap = new MultiMap<>(); HttpURI httpURI = new HttpURI(redirectLocation); httpURI.decodeQueryTo(parameterMap); Map<String,String> parameters = new HashMap<>(parameterMap.size()); for (Map.Entry<String, List<String>> paramEntry : parameterMap.entrySet()) { assertEquals(String.format("param '%s' specified more than once", paramEntry.getKey()), (long) 1, (long) paramEntry.getValue().size()); parameters.put(paramEntry.getKey(), paramEntry.getValue().get(0)); } return parameters; }
Example 2
Source File: PHttpServerRequest.java From jphp with Apache License 2.0 | 6 votes |
@Signature public Memory queryParameters() { request.getParameterMap(); MultiMap<String> parameters = request.getQueryParameters(); if (parameters != null) { ArrayMemory result = ArrayMemory.createHashed(parameters.size()); for (Map.Entry<String, List<String>> entry : parameters.entrySet()) { List<String> value = entry.getValue(); if (value == null || value.isEmpty()) { result.putAsKeyString(entry.getKey(), Memory.NULL); } else if (value.size() == 1) { result.putAsKeyString(entry.getKey(), StringMemory.valueOf(value.get(0))); } else { result.putAsKeyString(entry.getKey(), ArrayMemory.ofStringCollection(value)); } } return result; } else { return new ArrayMemory().toConstant(); } }
Example 3
Source File: HttpRequest.java From vespa with Apache License 2.0 | 5 votes |
private static Map<String, List<String>> getUriQueryParameters(URI uri) { MultiMap<String> queryParameters = new MultiMap<>(); new HttpURI(uri).decodeQueryTo(queryParameters); // Do a deep copy so we do not leak Jetty classes outside Map<String, List<String>> deepCopiedQueryParameters = new HashMap<>(); for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) { deepCopiedQueryParameters.put(entry.getKey(), new ArrayList<>(entry.getValue())); } return deepCopiedQueryParameters; }