List of usage examples for org.springframework.web.servlet FlashMap getTargetRequestParams
public MultiValueMap<String, String> getTargetRequestParams()
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 w w.j a v a2 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./*w w w . j a v a 2 s . c om*/ */ 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; }