本文整理汇总了Java中org.springframework.util.MultiValueMap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java MultiValueMap.keySet方法的具体用法?Java MultiValueMap.keySet怎么用?Java MultiValueMap.keySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.MultiValueMap
的用法示例。
在下文中一共展示了MultiValueMap.keySet方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void save(List<Record> records, PublishModelApi.Form form) throws Conflict {
MultiValueMap<String, String> map = UniqueFinder.find(form);
int count = modelPublicationMapper.countByConflictKey(map.toSingleValueMap());
if (count > 0) {
throw new Conflict(map.keySet());
}
for (Record record : records) {
modelPublicationMapper.insertRecord(
record.getId(),
record.getSet(),
record.getProviderId(),
record.getExtId(),
record.getIntId(),
record.getVersion(),
record.getStability(),
record.getOperatorId(),
record.getBeginTime()
);
}
}
示例2: remember
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void remember(Record record) throws Conflict, BadRequest {
NotBadRequest.from(record);
MultiValueMap<String, String> conflicts = UniqueFinder.find(record);
Record oldRecord = intensionMapper.selectIntensionByConflictKey(conflicts.toSingleValueMap());
if (oldRecord != null) {
throw new Conflict(conflicts.keySet());
}
intensionMapper.insertIntension(
record.getId(),
record.getCommit(),
record.getExtId(),
record.getField(),
record.getSingle(),
record.getStructure(),
record.getRefSet(),
record.getVisibility(),
record.getRequired(),
record.getOperatorId(),
record.getBeginTime()
);
}
示例3: remember
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void remember(Instance instance) throws Conflict {
MultiValueMap<String, String> map = UniqueFinder.find(instance);
int count = modelSubscriptionMapper.countByConflictKeys(map.toSingleValueMap());
if (count > 0) {
throw new Conflict(map.keySet());
}
modelSubscriptionMapper.insertSubscription(
instance.getId(),
instance.getSet(),
instance.getSubscriberId(),
instance.getGroup(),
instance.getName(),
instance.getTree(),
instance.getOperatorId(),
instance.getBeginTime()
);
}
示例4: remember
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void remember(Record record) throws Conflict, BadRequest {
logger.debug("before-remember: Record:{}", record);
NotBadRequest.from(record);
MultiValueMap<String, String> conflicts = UniqueFinder.find(record);
Record lastRecord = extensionMapper.selectExtensionByConflictFactor(conflicts.toSingleValueMap());
logger.debug("after-lastRecord: Record:{}", record);
if (lastRecord != null) {
throw new Conflict(conflicts.keySet());
}
extensionMapper.insertExtension(
record.getId(),
record.getCommit(),
record.getOwnerId(),
record.getGroup(),
record.getName(),
record.getTree(),
record.getVisibility(),
record.getOperatorId(),
record.getBeginTime()
);
}
示例5: remember
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
@Override
public void remember(Publication publication, List<Entry> entries) throws Conflict {
MultiValueMap<String, String> map = UniqueFinder.find(publication);
Integer count = glimpseMapper.countByConflictKey(map.toSingleValueMap());
if (count > 0) {
throw new Conflict(map.keySet());
}
for (Entry entry : entries) {
glimpseMapper.insertPublication(
entry.getId(),
publication.getSet(),
publication.getProviderId(),
publication.getModelSubId(),
entry.getInsId(),
publication.getVersion(),
publication.getStability(),
publication.getVisibility(),
publication.getOperatorId(),
publication.getBeginTime()
);
}
}
示例6: 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;
}
}
示例7: doPost
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
// Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
return;
}
try {
MultipartHttpServletRequest
multiRequest =
new CommonsMultipartResolver().resolveMultipart(request);
MultiValueMap<String, MultipartFile> fileMap = multiRequest.getMultiFileMap();
BlobstoreService blobstoreService = AppFactory.get().getBlobstoreService();
Map<String, String> names = new HashMap<>(1);
for (String fieldName : fileMap.keySet()) {
MultipartFile file = fileMap.getFirst(fieldName);
String fileName = file.getOriginalFilename();
String contentType = file.getContentType();
long sizeInBytes = file.getSize();
String
blobKey =
blobstoreService.store(fileName, contentType, sizeInBytes, file.getInputStream());
names.put(fieldName, blobKey);
}
request.getSession().setAttribute("blobs", names);
RequestDispatcher
dispatcher =
getServletContext().getRequestDispatcher(request.getParameter("ru"));
dispatcher.forward(multiRequest, response);
} catch (Exception ex) {
_logger.severe("Upload failed", ex);
}
}
示例8: doPost
import org.springframework.util.MultiValueMap; //导入方法依赖的package包/类
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
// Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
return;
}
try {
MultipartHttpServletRequest
multiRequest =
new CommonsMultipartResolver().resolveMultipart(request);
MultiValueMap<String, MultipartFile> fileMap = multiRequest.getMultiFileMap();
BlobstoreService blobstoreService = AppFactory.get().getBlobstoreService();
Map<String, String> names = new HashMap<>(1);
for (String fieldName : fileMap.keySet()) {
MultipartFile file = fileMap.getFirst(fieldName);
String fileName = file.getOriginalFilename();
String contentType = file.getContentType();
long sizeInBytes = file.getSize();
String
blobKey =
blobstoreService.store(fileName, contentType, sizeInBytes, file.getInputStream());
names.put(fieldName, blobKey);
names.put("file", fileName);
}
response.getWriter().write(new Gson().toJson(names));
response.setStatus(HttpStatus.SC_CREATED);
} catch (Exception ex) {
_logger.severe("Upload failed", ex);
}
}
示例9: 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;
}
}
示例10: 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;
}
示例11: 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);
}
}
}