List of usage examples for org.springframework.util MultiValueMap keySet
Set<K> keySet();
From source file:org.springframework.social.weibo.connect.WeiboOAuth2Template.java
@Override @SuppressWarnings("unchecked") protected AccessGrant postForAccessGrant(String accessTokenUrl, MultiValueMap<String, String> parameters) { List<String> params = new ArrayList<>(); for (String key : parameters.keySet()) { params.add(key + "=" + parameters.getFirst(key)); }// w w w . j a va 2 s . c o m String url = accessTokenUrl + "?" + params.stream().collect(Collectors.joining("&")); if (logger.isDebugEnabled()) { logger.debug("url = " + url); } MultiValueMap<String, String> response = getRestTemplate().postForObject(url, null, MultiValueMap.class); String expires = response.getFirst("expires_in"); String accessToken = response.getFirst("access_token"); if (logger.isDebugEnabled()) { logger.debug("access token value = " + accessToken); } return new AccessGrant(accessToken, null, null, expires != null ? Long.valueOf(expires) : null); }
From source file:org.springframework.web.servlet.support.AbstractFlashMapManager.java
/** * Whether the given FlashMap matches the current request. * Uses the expected request path and query parameters saved in the FlashMap. *///from w ww . ja va2 s .c o m protected boolean isFlashMapForRequest(FlashMap flashMap, HttpServletRequest request) { String expectedPath = flashMap.getTargetRequestPath(); if (expectedPath != null) { String requestUri = getUrlPathHelper().getOriginatingRequestUri(request); if (!requestUri.equals(expectedPath) && !requestUri.equals(expectedPath + "/")) { return false; } } MultiValueMap<String, String> actualParams = getOriginatingRequestParams(request); MultiValueMap<String, String> expectedParams = flashMap.getTargetRequestParams(); for (String expectedName : expectedParams.keySet()) { List<String> actualValues = actualParams.get(expectedName); if (actualValues == null) { return false; } for (String expectedValue : expectedParams.get(expectedName)) { if (!actualValues.contains(expectedValue)) { return false; } } } return true; }
From source file:org.springframework.web.servlet.support.DefaultFlashMapManager.java
/** * Whether the given FlashMap matches the current request. * The default implementation uses the target request path and query params * saved in the FlashMap./*from www . j ava 2 s .co m*/ */ protected boolean isFlashMapForRequest(FlashMap flashMap, HttpServletRequest request) { if (flashMap.getTargetRequestPath() != null) { String requestUri = this.urlPathHelper.getOriginatingRequestUri(request); if (!requestUri.equals(flashMap.getTargetRequestPath()) && !requestUri.equals(flashMap.getTargetRequestPath() + "/")) { return false; } } MultiValueMap<String, String> targetParams = flashMap.getTargetRequestParams(); for (String paramName : targetParams.keySet()) { for (String targetValue : targetParams.get(paramName)) { if (!ObjectUtils.containsElement(request.getParameterValues(paramName), targetValue)) { return false; } } } return true; }
From source file:org.springframework.web.util.UrlPathHelper.java
/** * Decode the given matrix variables via * {@link #decodeRequestString(HttpServletRequest, String)} unless * {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is * assumed the URL path from which the variables were extracted is already * decoded through a call to/*from w w w .j ava 2 s . c o m*/ * {@link #getLookupPathForRequest(HttpServletRequest)}. * @param request current HTTP request * @param vars URI variables extracted from the URL path * @return the same Map or a new Map instance */ public MultiValueMap<String, String> decodeMatrixVariables(HttpServletRequest request, MultiValueMap<String, String> vars) { if (this.urlDecode) { return vars; } else { MultiValueMap<String, String> decodedVars = new LinkedMultiValueMap<>(vars.size()); for (String key : vars.keySet()) { for (String value : vars.get(key)) { decodedVars.add(key, decodeInternal(request, value)); } } return decodedVars; } }
From source file:org.springframework.ws.wsdl.wsdl11.provider.AbstractPortTypesProvider.java
private void createOperations(Definition definition, PortType portType) throws WSDLException { MultiValueMap<String, Message> operations = new LinkedMultiValueMap<String, Message>(); for (Iterator<?> iterator = definition.getMessages().values().iterator(); iterator.hasNext();) { Message message = (Message) iterator.next(); String operationName = getOperationName(message); if (StringUtils.hasText(operationName)) { operations.add(operationName, message); }//from ww w. j a va 2 s .co m } if (operations.isEmpty() && logger.isWarnEnabled()) { logger.warn("No operations were created, make sure the WSDL contains messages"); } for (String operationName : operations.keySet()) { Operation operation = definition.createOperation(); operation.setName(operationName); List<Message> messages = operations.get(operationName); for (Message message : messages) { if (isInputMessage(message)) { Input input = definition.createInput(); input.setMessage(message); populateInput(definition, input); operation.setInput(input); } else if (isOutputMessage(message)) { Output output = definition.createOutput(); output.setMessage(message); populateOutput(definition, output); operation.setOutput(output); } else if (isFaultMessage(message)) { Fault fault = definition.createFault(); fault.setMessage(message); populateFault(definition, fault); operation.addFault(fault); } } operation.setStyle(getOperationType(operation)); operation.setUndefined(false); if (logger.isDebugEnabled()) { logger.debug("Adding operation [" + operation.getName() + "] to port type [" + portType.getQName() + "]"); } portType.addOperation(operation); } }