本文整理汇总了Java中org.springframework.util.MultiValueMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java MultiValueMap.get方法的具体用法?Java MultiValueMap.get怎么用?Java MultiValueMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.MultiValueMap
的用法示例。
在下文中一共展示了MultiValueMap.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAllConnections
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public MultiValueMap<String, Connection<?>> findAllConnections() {
List<SocialUserConnection> socialUserConnections = socialUserConnectionRepository
.findAllByUserIdOrderByProviderIdAscRankAsc(userId);
List<Connection<?>> connections = socialUserConnectionsToConnections(socialUserConnections);
MultiValueMap<String, Connection<?>> connectionsByProviderId = new LinkedMultiValueMap<>();
Set<String> registeredProviderIds = connectionFactoryLocator.registeredProviderIds();
for (String registeredProviderId : registeredProviderIds) {
connectionsByProviderId.put(registeredProviderId, Collections.emptyList());
}
for (Connection<?> connection : connections) {
String providerId = connection.getKey().getProviderId();
if (connectionsByProviderId.get(providerId) == null || connectionsByProviderId.get(providerId).size() == 0) {
connectionsByProviderId.put(providerId, new LinkedList<>());
}
connectionsByProviderId.add(providerId, connection);
}
return connectionsByProviderId;
}
示例2: replaceRequestParamNames
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
/**
* 替换请求参数名
*
* @param webhook
* @param requestBody
* @return
*/
private Object replaceRequestParamNames(WebhookDetail webhook, Object requestBody) {
if (ContentType.FORM.equals(webhook.getContentType())) {
// 替换前的参数Map
MultiValueMap<String, Object> sourceParamMap = (MultiValueMap<String, Object>) requestBody;
// 替换后的参数Map
MultiValueMap<String, Object> targetParamMap = new LinkedMultiValueMap<>();
// 参数名映射
Map<String, String> paramMapping = webhook.getRequestParams();
String targetParamName = null;
List<Object> paramValue = null;
for (String sourceParamName : sourceParamMap.keySet()) {
targetParamName = paramMapping.get(sourceParamName);
if (StringUtils.isEmpty(targetParamName)) {
targetParamName = sourceParamName;
}
paramValue = sourceParamMap.get(sourceParamName);
targetParamMap.put(targetParamName, paramValue);
}
return targetParamMap;
} else {
return requestBody;
}
}
示例3: isMultipart
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
private boolean isMultipart(MultiValueMap<String, ?> map, MediaType contentType) {
if (contentType != null) {
return MediaType.MULTIPART_FORM_DATA.includes(contentType)
|| mixed.includes(contentType)
|| related.includes(contentType);
}
for (Map.Entry<String, ?> entiry : map.entrySet()) {
for (Object value : map.get(entiry.getKey())) {
if (value != null && !(value instanceof String)) {
return true;
}
}
}
return false;
}
示例4: collect
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
protected void collect(MultiValueMap<String, Object> attributes, String key, List<String> destination) {
List<?> values = attributes.get(key);
if (values != null) {
for (Object value : values) {
if (value instanceof String[]) {
Collections.addAll(destination, (String[]) value);
} else {
destination.add((String) value);
}
}
}
}
示例5: decodeMatrixVariables
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
/**
* 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;
}
}
示例6: matches
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
if (context.getEnvironment() != null) {
MultiValueMap<String, Object> attrs = metadata.getAllAnnotationAttributes(Profile.class.getName());
if (attrs != null) {
for (Object value : attrs.get("value")) {
if (context.getEnvironment().acceptsProfiles(((String[]) value))) {
return true;
}
}
return false;
}
}
return true;
}
示例7: isMultipart
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
private boolean isMultipart(MultiValueMap<String, ?> map, MediaType contentType) {
if (contentType != null) {
return MediaType.MULTIPART_FORM_DATA.equals(contentType);
}
for (String name : map.keySet()) {
for (Object value : map.get(name)) {
if (value != null && !(value instanceof String)) {
return true;
}
}
}
return false;
}
示例8: restoreAsFieldDict
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
private void restoreAsFieldDict(IntensionDai.ChannelExtensionId extension, MultiValueMap<String, IntensionDai.Record> map) throws BadRequest, NotFound, Panic {
List<IntensionDai.Record> records = intensionDai.loadLast(extension);
for (IntensionDai.Record record : records) {
String refSet = record.getRefSet();
if (refSet != null) {
ModelPublicationDai.ChannelSet set = new ModelPublicationDai.ChannelSet();
set.setSet(refSet);
List<ModelPublicationDai.Record> publications = modelPublicationDai.loadPublications(set);
ModelPublicationDai.Record publication = publications.get(0);
IntensionDai.ChannelExtensionId refExt = new IntensionDai.ChannelExtensionId();
refExt.setBeginTime(publication.getBeginTime());
refExt.setEndTime(record.getBeginTime());
refExt.setId(publication.getExtId());
MultiValueMap<String, IntensionDai.Record> subMap = restoreAsIntensionDict(refExt);
for (String key : subMap.keySet()) {
List<IntensionDai.Record> subRecords = subMap.get(key);
for (IntensionDai.Record subRecord : subRecords) {
map.add(record.getField(), subRecord);
}
}
} else {
map.set(record.getField(), record);
}
}
}
示例9: search
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public SearchResult<Conversation> search(Client client, MultiValueMap<String, String> queryParams) throws IOException {
final ModifiableSolrParams solrParams = new ModifiableSolrParams(toListOfStringArrays(queryParams, "text"));
solrParams.add(CommonParams.FL, "id");
solrParams.add(CommonParams.FQ, String.format("%s:\"%s\"", FIELD_OWNER, client.getId().toHexString()));
solrParams.add(CommonParams.FQ, String.format("%s:\"%s\"", FIELD_TYPE, TYPE_MESSAGE));
solrParams.set(GroupParams.GROUP, "true");
solrParams.set(GroupParams.GROUP_FIELD, "_root_");
solrParams.set("group.ngroups", "true");
if (queryParams.containsKey("text")) {
List<String> searchTerms = queryParams.get("text");
String query = SearchUtils.createSearchWordQuery(searchTerms.stream()
.filter(StringUtils::isNotBlank).collect(Collectors.joining(" ")));
if(query != null){
solrParams.set(CommonParams.Q, query);
}
}
log.trace("SolrParams: {}", solrParams);
try (SolrClient solrClient = solrServer.getSolrClient(conversationCore)) {
final QueryResponse queryResponse = solrClient.query(solrParams);
return fromQueryResponse(queryResponse, this::readConversation);
} catch (SolrServerException e) {
throw new IllegalStateException("Cannot query non-initialized core", e);
}
}
示例10: getConditionClasses
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(Conditional.class.getName(), true);
Object values = (attributes != null ? attributes.get("value") : null);
return (List<String[]>) (values != null ? values : Collections.emptyList());
}