本文整理汇总了Java中io.vertx.core.MultiMap.forEach方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.forEach方法的具体用法?Java MultiMap.forEach怎么用?Java MultiMap.forEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.MultiMap
的用法示例。
在下文中一共展示了MultiMap.forEach方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: in
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static void in(final IpcData data, final Envelop envelop) {
if (null != envelop) {
// User
final User user = envelop.user();
final JsonObject sendData = new JsonObject();
if (null != user) {
sendData.put("user", user.principal());
}
// Header
final MultiMap headers = envelop.headers();
if (null != headers) {
final JsonObject headerData = new JsonObject();
headers.forEach((entry) -> headerData.put(entry.getKey(), entry.getValue()));
sendData.put("header", headerData);
}
// Data
final Object content = envelop.data();
sendData.put("data", content);
sendData.put("config", data.getConfig());
// Data Prepared finished.
sendData.put("address", data.getAddress());
data.setData(sendData.toBuffer());
}
}
示例2: toMultivaluedStringMap
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
/**
* This returns a case-insensitive multivalued map suitable for headers.
*
* @param multimap
* @return
*/
public static MultivaluedMap<String, String> toMultivaluedStringMap(final MultiMap multimap) {
final MultivaluedMap<String, String> mvm = new CaseInsenstiveMultivalueStringMap();
multimap.forEach(entry -> mvm.add(entry.getKey(), entry.getValue()));
return mvm;
}
示例3: mergeRequestParams
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private void mergeRequestParams(JsonObject body, MultiMap params) {
if (params == null) {
return;
}
params.forEach(entry -> body.put(entry.getKey(), entry.getValue()));
logger.debug("Merged paramaters {}: ", body);
}
示例4: handle
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public void handle(HttpServerRequest clientRequest, HttpServerResponse clientResponse,
HttpResponse<Buffer> appResponse) {
int statusCode = appResponse.statusCode();
clientResponse.setStatusCode(statusCode);
// clientResponse.setStatusMessage(appResponse.statusMessage());
// System.out.println(appResponse.statusMessage());
MultiMap appHeaders = appResponse.headers();
appHeaders.forEach(entry -> {
String k = entry.getKey();
String v = entry.getValue();
// System.out.println("Header Response:[" + k + "]=" + v);
if ("Location".equalsIgnoreCase(k) && S.isNotBlank(v)) {
String schemal = clientRequest.scheme();
String host = clientRequest.host();
clientResponse.putHeader("Location", v.replaceAll(HTTP_SCHEMAL_HOST_REG, schemal + "://" + host + "/"));
} else
clientResponse.putHeader(k, v);
});
clientResponse.setChunked(true);
Buffer buff = appResponse.bodyAsBuffer();
if (buff != null && buff.length() > 0)
clientResponse.write(buff);
}
示例5: mergeIntoResponseHeadersDistinct
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private void mergeIntoResponseHeadersDistinct(MultiMap responseHeaders, MultiMap requestHeaders){
Consumer<Map.Entry<String,String>> consumer = entry -> {
String headerName = entry.getKey().toLowerCase();
if(!responseHeaders.contains(headerName)){
responseHeaders.add(headerName, entry.getValue());
}
};
requestHeaders.forEach(consumer);
}
示例6: getOkapiHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private void getOkapiHeaders(RoutingContext rc, Map<String, String> headers, String[] tenantId){
MultiMap mm = rc.request().headers();
Consumer<Map.Entry<String,String>> consumer = entry -> {
String headerKey = entry.getKey().toLowerCase();
if(headerKey.startsWith(OKAPI_HEADER_PREFIX)){
if(headerKey.equalsIgnoreCase(ClientGenerator.OKAPI_HEADER_TENANT)){
tenantId[0] = entry.getValue();
}
headers.put(headerKey, entry.getValue());
}
};
mm.forEach(consumer);
}
示例7: mergeHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private void mergeHeaders(Map<String, String >headers1, MultiMap headers2, String endpoint){
Consumer<Map.Entry<String,String>> consumer = entry -> {
String headerKey = entry.getKey().toLowerCase();
if(headerKey.startsWith("x-okapi")){
headers1.put(headerKey, entry.getValue());
}
};
if(headers != null){
headers2.forEach(consumer);
}
else{
log.warn("headers passed into chainedRequest are null, from endpoint " + endpoint);
}
}
示例8: toMultivaluedMap
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static MultivaluedMap<String, Object> toMultivaluedMap(final MultiMap multimap) {
final MultivaluedMap<String, Object> mvm = new MultivaluedHashMap<>(multimap.size());
multimap.forEach(entry -> mvm.add(entry.getKey(), entry.getValue()));
return mvm;
}
示例9: toListMultimap
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
static ImmutableListMultimap<String, String> toListMultimap(MultiMap headers) {
ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
headers.forEach(entry -> builder.put(entry.getKey(), entry.getValue()));
return builder.build();
}
示例10: extractHeaders
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private JsonObject extractHeaders(final MultiMap headersMap){
JsonObject headers = new JsonObject();
headersMap.forEach(entry -> {
headers.put(entry.getKey(), entry.getValue());
});
return headers;
}