Java Code Examples for org.springframework.util.MultiValueMap#entrySet()
The following examples show how to use
org.springframework.util.MultiValueMap#entrySet() .
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: ModelBuilder.java From lemon with Apache License 2.0 | 6 votes |
public ModelInfoDTO build(ModelInfoDTO modelInfoDto, MultiValueMap<String, String> multiValueMap, String tenantId) throws Exception { for (Map.Entry<String, List<String>> entry : multiValueMap.entrySet()) { String key = entry.getKey(); if (key == null) { continue; } List<String> value = entry.getValue(); if ((value == null) || (value.isEmpty())) { continue; } String theValue = this.getValue(value); this.updateItem(modelInfoDto, key, theValue); } return modelInfoDto; }
Example 2
Source File: RecordBuilder.java From lemon with Apache License 2.0 | 6 votes |
public Record build(Record record, MultiValueMap<String, String> multiValueMap, String tenantId) throws Exception { for (Map.Entry<String, List<String>> entry : multiValueMap.entrySet()) { String key = entry.getKey(); if (key == null) { continue; } List<String> value = entry.getValue(); if ((value == null) || (value.isEmpty())) { continue; } Prop prop = new Prop(); prop.setCode(key); prop.setType(0); prop.setValue(this.getValue(value)); record.getProps().put(prop.getCode(), prop); } return record; }
Example 3
Source File: MainController.java From blog-social-login-with-spring-social with Apache License 2.0 | 6 votes |
@RequestMapping(value= "/updateStatus", method = POST) public String updateStatus( WebRequest webRequest, HttpServletRequest request, Principal currentUser, Model model, @RequestParam(value = "status", required = true) String status) { MultiValueMap<String, Connection<?>> cmap = connectionRepository.findAllConnections(); LOG.error("cs.size = {}", cmap.size()); Set<Map.Entry<String, List<Connection<?>>>> entries = cmap.entrySet(); for (Map.Entry<String, List<Connection<?>>> entry : entries) { for (Connection<?> c : entry.getValue()) { LOG.debug("Updates {} with the status '{}'", entry.getKey(), status); c.updateStatus(status); } } return "home"; }
Example 4
Source File: HttpRemoteService.java From pinpoint with Apache License 2.0 | 6 votes |
private HttpPost createPost(String url, MultiValueMap<String, String> params) throws UnsupportedEncodingException { HttpPost post = new HttpPost(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); for (Map.Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { nvps.add(new BasicNameValuePair(key, value)); } } post.setEntity(new UrlEncodedFormEntity(nvps)); return post; }
Example 5
Source File: FormHttpMessageConverter.java From java-technology-stack with MIT License | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, Object> parts, byte[] boundary) throws IOException { for (Map.Entry<String, List<Object>> entry : parts.entrySet()) { String name = entry.getKey(); for (Object part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, getHttpEntity(part), os); writeNewLine(os); } } } }
Example 6
Source File: ApiClient.java From tutorials with MIT License | 5 votes |
/** * Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3"> * RFC6265 section 5.3</a>). * * @param cookies map all cookies * @return header string for cookies. */ private String buildCookieHeader(MultiValueMap<String, String> cookies) { final StringBuilder cookieValue = new StringBuilder(); String delimiter = ""; for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) { final String value = entry.getValue().get(entry.getValue().size() - 1); cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value)); delimiter = "; "; } return cookieValue.toString(); }
Example 7
Source File: HttpRemoteService.java From pinpoint with Apache License 2.0 | 5 votes |
private HttpGet createGet(String url, MultiValueMap<String, String> params) throws URISyntaxException { URIBuilder uri = new URIBuilder(url); for (Map.Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { uri.addParameter(key, value); } } return new HttpGet(uri.build()); }
Example 8
Source File: DataSourceDataCollector.java From pinpoint with Apache License 2.0 | 5 votes |
@Override public void collect() { if (init.get()) { return; } Range range = Range.newUncheckedRange(timeSlotEndTime - slotInterval, timeSlotEndTime); List<String> agentIds = applicationIndexDao.selectAgentIds(application.getName()); for (String agentId : agentIds) { List<DataSourceListBo> dataSourceListBos = dataSourceDao.getAgentStatList(agentId, range); MultiValueMap<Integer, DataSourceBo> partitions = partitionDataSourceId(dataSourceListBos); for (Map.Entry<Integer, List<DataSourceBo>> entry : partitions.entrySet()) { List<DataSourceBo> dataSourceBoList = entry.getValue(); if (CollectionUtils.hasLength(dataSourceBoList)) { long usedPercent = getPercent(dataSourceBoList); DataSourceBo dataSourceBo = ListUtils.getFirst(dataSourceBoList); DataSourceAlarmVO dataSourceAlarmVO = new DataSourceAlarmVO(dataSourceBo.getId(), dataSourceBo.getDatabaseName(), usedPercent); agentDataSourceConnectionUsageRateMap.add(agentId, dataSourceAlarmVO); } } } init.set(true); }
Example 9
Source File: FormHttpMessageConverter.java From onetwo with Apache License 2.0 | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, Object> parts, byte[] boundary) throws IOException { for (Map.Entry<String, List<Object>> entry : parts.entrySet()) { String name = entry.getKey(); for (Object part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, getHttpEntity(part), os); writeNewLine(os); } } } }
Example 10
Source File: MultipartBatchHttpMessageConverter.java From documentum-rest-client-java with Apache License 2.0 | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, HttpEntity<InputStream>> parts, String boundary) throws IOException { for (Map.Entry<String, List<HttpEntity<InputStream>>> entry : parts.entrySet()) { String name = entry.getKey(); for (HttpEntity<InputStream> part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, part, os); writeNewLine(os); } } } writeEnd(os, boundary); }
Example 11
Source File: StubRunnerCamelConfiguration.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Bean public RoutesBuilder myRouter(final BatchStubRunner batchStubRunner) { return new SpringRouteBuilder() { @Override public void configure() throws Exception { Map<StubConfiguration, Collection<Contract>> contracts = batchStubRunner .getContracts(); for (Map.Entry<StubConfiguration, Collection<Contract>> entry : contracts .entrySet()) { Collection<Contract> value = entry.getValue(); MultiValueMap<String, Contract> map = new LinkedMultiValueMap<>(); for (Contract dsl : value) { if (dsl == null) { continue; } if (dsl.getInput() != null && dsl.getInput().getMessageFrom() != null && StringUtils.hasText(dsl.getInput().getMessageFrom() .getClientValue())) { String from = dsl.getInput().getMessageFrom() .getClientValue(); map.add(from, dsl); } } for (Map.Entry<String, List<Contract>> entries : map.entrySet()) { from(entries.getKey()) .filter(new StubRunnerCamelPredicate(entries.getValue())) .process(new StubRunnerCamelProcessor()) .dynamicRouter(header( StubRunnerCamelConfiguration.STUBRUNNER_DESTINATION_URL_HEADER_NAME)); } } } }; }
Example 12
Source File: _CustomSocialConnectionRepository.java From jhipster-ribbon-hystrix with GNU General Public License v3.0 | 5 votes |
@Override public MultiValueMap<String, Connection<?>> findConnectionsToUsers(MultiValueMap<String, String> providerUserIdsByProviderId) { if (providerUserIdsByProviderId == null || providerUserIdsByProviderId.isEmpty()) { throw new IllegalArgumentException("Unable to execute find: no providerUsers provided"); } MultiValueMap<String, Connection<?>> connectionsForUsers = new LinkedMultiValueMap<>(); for (Map.Entry<String, List<String>> entry : providerUserIdsByProviderId.entrySet()) { String providerId = entry.getKey(); List<String> providerUserIds = entry.getValue(); List<Connection<?>> connections = providerUserIdsToConnections(providerId, providerUserIds); connections.forEach(connection -> connectionsForUsers.add(providerId, connection)); } return connectionsForUsers; }
Example 13
Source File: FormHttpMessageConverter.java From spring4-understanding with Apache License 2.0 | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, Object> parts, byte[] boundary) throws IOException { for (Map.Entry<String, List<Object>> entry : parts.entrySet()) { String name = entry.getKey(); for (Object part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, getHttpEntity(part), os); writeNewLine(os); } } } }
Example 14
Source File: FormHttpMessageConverter.java From lams with GNU General Public License v2.0 | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, Object> parts, byte[] boundary) throws IOException { for (Map.Entry<String, List<Object>> entry : parts.entrySet()) { String name = entry.getKey(); for (Object part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, getHttpEntity(part), os); writeNewLine(os); } } } }
Example 15
Source File: TokenServiceHttpEntityMatcher.java From cloud-security-xsuaa-integration with Apache License 2.0 | 5 votes |
private Map<String, String> convertMultiToRegularMap(MultiValueMap<String, String> multiValueMap) { Map<String, String> map = new HashMap(); if (multiValueMap == null) { return map; } for (Entry<String, List<String>> entry : multiValueMap.entrySet()) { String entryValues = String.join(",", entry.getValue()); map.put(entry.getKey(), entryValues); } return map; }
Example 16
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3"> * RFC6265 section 5.3</a>). * * @param cookies map all cookies * @return header string for cookies. */ private String buildCookieHeader(MultiValueMap<String, String> cookies) { final StringBuilder cookieValue = new StringBuilder(); String delimiter = ""; for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) { final String value = entry.getValue().get(entry.getValue().size() - 1); cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value)); delimiter = "; "; } return cookieValue.toString(); }
Example 17
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3"> * RFC6265 section 5.3</a>). * * @param cookies map all cookies * @return header string for cookies. */ private String buildCookieHeader(MultiValueMap<String, String> cookies) { final StringBuilder cookieValue = new StringBuilder(); String delimiter = ""; for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) { final String value = entry.getValue().get(entry.getValue().size() - 1); cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value)); delimiter = "; "; } return cookieValue.toString(); }
Example 18
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Add cookies to the request that is being built * @param cookies The cookies to add * @param requestBuilder The current request */ protected void addCookiesToRequest(MultiValueMap<String, String> cookies, WebClient.RequestBodySpec requestBuilder) { for (Entry<String, List<String>> entry : cookies.entrySet()) { List<String> values = entry.getValue(); for(String value : values) { if (value != null) { requestBuilder.cookie(entry.getKey(), value); } } } }
Example 19
Source File: FormHttpMessageConverter.java From spring-analysis-note with MIT License | 5 votes |
private void writeParts(OutputStream os, MultiValueMap<String, Object> parts, byte[] boundary) throws IOException { for (Map.Entry<String, List<Object>> entry : parts.entrySet()) { String name = entry.getKey(); for (Object part : entry.getValue()) { if (part != null) { writeBoundary(os, boundary); writePart(name, getHttpEntity(part), os); writeNewLine(os); } } } }
Example 20
Source File: AbstractDynamoDBQueryCriteria.java From spring-data-dynamodb with Apache License 2.0 | 4 votes |
protected String getGlobalSecondaryIndexName() { // Lazy evaluate the globalSecondaryIndexName if not already set // We must have attribute conditions specified in order to use a global secondary index, otherwise return null for index name // Also this method only evaluates the if (globalSecondaryIndexName == null && attributeConditions != null && !attributeConditions.isEmpty()) { // Declare map of index names by attribute name which we will populate below - this will be used to determine which index to use if multiple indexes are applicable Map<String,String[]> indexNamesByAttributeName = new HashMap<String,String[]>(); // Declare map of attribute lists by index name which we will populate below - this will be used to determine whether we have an exact match index for specified attribute conditions MultiValueMap<String,String> attributeListsByIndexName = new LinkedMultiValueMap<String,String>(); // Populate the above maps for (Entry<String, String[]> indexNamesForPropertyNameEntry : entityInformation.getGlobalSecondaryIndexNamesByPropertyName().entrySet()) { String propertyName = indexNamesForPropertyNameEntry.getKey(); String attributeName = getAttributeName(propertyName); indexNamesByAttributeName.put(attributeName, indexNamesForPropertyNameEntry.getValue()); for (String indexNameForPropertyName : indexNamesForPropertyNameEntry.getValue()) { attributeListsByIndexName.add(indexNameForPropertyName, attributeName); } } // Declare lists to store matching index names List<String> exactMatchIndexNames = new ArrayList<String>(); List<String> partialMatchIndexNames = new ArrayList<String>(); // Populate matching index name lists - an index is either an exact match ( the index attributes match all the specified criteria exactly) // or a partial match ( the properties for the specified criteria are contained within the property set for an index ) for (Entry<String, List<String>> attributeListForIndexNameEntry : attributeListsByIndexName.entrySet()) { String indexNameForAttributeList = attributeListForIndexNameEntry.getKey(); List<String> attributeList = attributeListForIndexNameEntry.getValue(); if (attributeList.containsAll(attributeConditions.keySet())) { if (attributeConditions.keySet().containsAll(attributeList)) { exactMatchIndexNames.add(indexNameForAttributeList); } else { partialMatchIndexNames.add(indexNameForAttributeList); } } } if (exactMatchIndexNames.size() > 1) { throw new RuntimeException("Multiple indexes defined on same attribute set:" + attributeConditions.keySet()); } else if (exactMatchIndexNames.size() == 1) { globalSecondaryIndexName = exactMatchIndexNames.get(0); } else if (partialMatchIndexNames.size() > 1) { if (attributeConditions.size() == 1) { globalSecondaryIndexName = getFirstDeclaredIndexNameForAttribute(indexNamesByAttributeName, partialMatchIndexNames, attributeConditions.keySet().iterator().next()); } if (globalSecondaryIndexName == null) { globalSecondaryIndexName = partialMatchIndexNames.get(0); } } else if (partialMatchIndexNames.size() == 1) { globalSecondaryIndexName = partialMatchIndexNames.get(0); } } return globalSecondaryIndexName; }