Java Code Examples for org.springframework.util.MultiValueMap#size()

The following examples show how to use org.springframework.util.MultiValueMap#size() . 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: UrlPathHelper.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Decode the given matrix variables via {@link #decodeRequestString} unless
 * {@link #setUrlDecode} 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 {@link #getLookupPathForRequest(HttpServletRequest)}.
 * @param request current HTTP request
 * @param vars the 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());
		vars.forEach((key, values) -> {
			for (String value : values) {
				decodedVars.add(key, decodeInternal(request, value));
			}
		});
		return decodedVars;
	}
}
 
Example 2
Source File: UrlPathHelper.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * 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
 * {@link #getLookupPathForRequest(HttpServletRequest)}.
 * @param request current HTTP request
 * @param vars the 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());
		vars.forEach((key, values) -> {
			for (String value : values) {
				decodedVars.add(key, decodeInternal(request, value));
			}
		});
		return decodedVars;
	}
}
 
Example 3
Source File: RSQLJPASupportTest.java    From rsql-jpa-specification with MIT License 5 votes vote down vote up
@Test
public final void testToMultiValueMap() {
	String rsql = "sites.trunks.id==2,id==2,company.id=='2',id==3,name==''";
	MultiValueMap<String, String> map = toMultiValueMap(rsql);
	log.info("MultiValueMap<String,String> map:{}", map);
	long count = map.size();
	log.info("rsql: {} -> count: {}", rsql, count);
	assertThat("MultiValueMap", count, is(4l));
	assertThat("MultiValueMap", map.get("id").size(), is(2));
}
 
Example 4
Source File: UrlPathHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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
 * {@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	<String, String>(vars.size());
		for (String key : vars.keySet()) {
			for (String value : vars.get(key)) {
				decodedVars.add(key, decodeInternal(request, value));
			}
		}
		return decodedVars;
	}
}
 
Example 5
Source File: UrlPathHelper.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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
 * {@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	<String, String>(vars.size());
		for (String key : vars.keySet()) {
			for (String value : vars.get(key)) {
				decodedVars.add(key, decodeInternal(request, value));
			}
		}
		return decodedVars;
	}
}
 
Example 6
Source File: SpringSocialUserDetailService.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<Connection<?>> getConnections(ConnectionRepository connectionRepository) {
	MultiValueMap<String, Connection<?>> connections = connectionRepository.findAllConnections();
	List<Connection<?>> allConnections = new ArrayList<Connection<?>>();
	if (connections.size() > 0) {
		for (List<Connection<?>> connectionList : connections.values()) {
			for (Connection<?> connection : connectionList) {
				allConnections.add(connection);
			}
		}
	}
	return allConnections;
}
 
Example 7
Source File: SpringSocialUserDetailService.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<Connection<?>> getConnections(ConnectionRepository connectionRepository) {
	MultiValueMap<String, Connection<?>> connections = connectionRepository.findAllConnections();
	List<Connection<?>> allConnections = new ArrayList<Connection<?>>();
	if (connections.size() > 0) {
		for (List<Connection<?>> connectionList : connections.values()) {
			for (Connection<?> connection : connectionList) {
				allConnections.add(connection);
			}
		}
	}
	return allConnections;
}