本文整理匯總了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;
}