本文整理汇总了Java中io.vertx.core.MultiMap.names方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.names方法的具体用法?Java MultiMap.names怎么用?Java MultiMap.names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.MultiMap
的用法示例。
在下文中一共展示了MultiMap.names方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static JsonObject call(HttpServerRequest httpServerRequest) {
JsonObject jsonObject = new JsonObject();
String query = httpServerRequest.query();
String requestLine = String.format("%s %s%s %s", httpServerRequest.method(), httpServerRequest.path(), query != null ? '?' + query : "", httpServerRequest.version().toString());
jsonObject.put("request_line", requestLine);
MultiMap headers = httpServerRequest.headers();
JsonArray jsonHeaders = new JsonArray();
for (String headerName : headers.names()) {
List<String> values = headers.getAll(headerName);
JsonObject jsonHeader = new JsonObject();
jsonHeader.put(headerName, values);
jsonHeaders.add(jsonHeader);
}
jsonObject.put("headers", jsonHeaders);
return jsonObject;
}
示例2: DigestBlob
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public DigestBlob(HttpClientResponse httpClientResponse) {
super(httpClientResponse);
digests = new HashMap<>();
BaseEncoding baseEncoding = base64();
MultiMap headers = httpClientResponse.headers();
for (String headerName : headers.names()) {
Matcher matcher = COMPUTED_DIGEST.matcher(headerName);
if (matcher.find()) {
String digestName = matcher.group(1);
Optional<MessageDigestFactory> oMessageDigestFactory = fromValueIfExists(digestName);
if (oMessageDigestFactory.isPresent()) {
MessageDigestFactory messageDigestFactory = oMessageDigestFactory.get();
withDigest(messageDigestFactory, baseEncoding.decode(headers.get(headerName)));
}
}
}
}
示例3: call
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
MultiMap params = httpServerRequest.params();
for (String param : params.names()) {
Matcher matcher = COMPUTED_DIGEST.matcher(param);
if (matcher.matches()) {
String digestName = matcher.group(1);
if (!fromValueIfExists(digestName).isPresent()) {
JsonObject jsonObject = new JsonObject()
.put("message", format("%s is not a supported digest", digestName));
throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
}
}
}
return httpServerRequest;
}
示例4: call
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Override
public T call(T httpServerRequest) {
if (LOGGER.isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
sb.append("\r\nHttp Header Dump >>>>>\r\n\r\n");
String query = httpServerRequest.query();
sb.append(format("%s %s%s %s\r\n", httpServerRequest.method(), httpServerRequest.path(), query != null ? '?' + query : "", httpServerRequest.version().toString()));
MultiMap headers = httpServerRequest.headers();
for (String headerName : headers.names()) {
List<String> values = headers.getAll(headerName);
sb.append(format("%s: %s\r\n", headerName, on(',').join(values)));
}
sb.append("\r\n");
sb.append("Http Header Dump <<<<<\r\n");
LOGGER.debug(sb.toString());
}
return httpServerRequest;
}
示例5: call
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Override
public HttpClientResponse call(HttpClientResponse httpClientResponse) {
if (LOGGER.isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
sb.append("\r\nHttp Header Dump >>>>>\r\n\r\n");
sb.append(format("HTTP/1.1 %d %s\r\n", httpClientResponse.statusCode(), httpClientResponse.statusMessage()));
MultiMap headers = httpClientResponse.headers();
for (String headerName : headers.names()) {
List<String> values = headers.getAll(headerName);
sb.append(format("%s: %s\r\n", headerName, on(',').join(values)));
}
sb.append("\r\n");
sb.append("Http Header Dump <<<<<\r\n");
LOGGER.debug(sb.toString());
}
return httpClientResponse;
}
示例6: getParameterMap
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> paramMap = new HashMap<>();
MultiMap map = this.vertxRequest.params();
for (String name : map.names()) {
List<String> valueList = map.getAll(name);
paramMap.put(name, (String[]) map.getAll(name).toArray(new String[valueList.size()]));
}
return paramMap;
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:11,代码来源:VertxServerRequestToHttpServletRequest.java
示例7: mutiMapToString
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private String mutiMapToString(MultiMap map, String defaultString) {
StringBuilder s = new StringBuilder();
for (String key : map.names()) {
s.append(key)
.append(":")
.append(Joiner.on(",").join(map.getAll(key)))
.append(";");
}
if (s.length() == 0) {
return defaultString;
}
return s.toString();
}
示例8: toMultimap
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private static Multimap<String, String> toMultimap(MultiMap multiMap) {
Multimap<String, String> guavaMultimap = ArrayListMultimap.create();
Set<String> names = multiMap.names();
for (String paramName : names) {
guavaMultimap.putAll(paramName, multiMap.getAll(paramName));
}
return guavaMultimap;
}
示例9: merge
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public XBlob merge(SfsRequest httpServerRequest) {
MultiMap queryParams = httpServerRequest.params();
MultiMap headers = httpServerRequest.headers();
if (queryParams.contains(VOLUME)) {
volume = tryParse(queryParams.get(VOLUME));
}
if (queryParams.contains(POSITION)) {
position = Longs.tryParse(queryParams.get(POSITION));
}
if (queryParams.contains(VERSION)) {
version = base64().decode(queryParams.get(VERSION));
}
if (headers.contains(CONTENT_LENGTH)) {
length = Longs.tryParse(headers.get(CONTENT_LENGTH));
}
for (String queryParam : queryParams.names()) {
Matcher matcher = COMPUTED_DIGEST.matcher(queryParam);
if (matcher.matches()) {
MessageDigestFactory digest = fromValueIfExists(matcher.group(1)).get();
messageDigests.add(digest);
}
}
return this;
}
示例10: getProxyUrl
import io.vertx.core.MultiMap; //导入方法依赖的package包/类
/**
* Extract the url to Proxy.
*
* @param requestCtx Context of the current request.
* @return The url to proxy or null if it wasn't found.
*/
Optional<String> getProxyUrl(RoutingContext requestCtx) {
final HttpServerRequest serverRequest = requestCtx.request();
final HttpServerResponse serverResponse = requestCtx.response();
// origin = metrics stream endpoint
String origin = serverRequest.getParam("origin");
if (origin == null || origin.isEmpty()) {
log.warn("Request without origin");
serverResponse.setStatusCode(500)
.end(Buffer.buffer("Required parameter 'origin' missing. Example: 107.20.175.135:7001".getBytes(StandardCharsets.UTF_8)));
return Optional.empty();
}
origin = origin.trim();
boolean hasFirstParameter = false;
StringBuilder url = new StringBuilder();
// if there is no http, i add
if (!origin.startsWith("http")) {
url.append("http://");
}
url.append(origin);
// if contains any query parameter
if (origin.contains("?")) {
hasFirstParameter = true;
}
// add the request params to the url to proxy, because need to forward Delay and maybe another future param
MultiMap params = serverRequest.params();
for (String key : params.names()) {
if (!"origin".equals(key) && !"authorization".equals(key)) {
String value = params.get(key);
if (hasFirstParameter) {
url.append("&");
} else {
url.append("?");
hasFirstParameter = true;
}
url.append(key).append("=").append(value);
}
}
return Optional.of(url.toString());
}
开发者ID:kennedyoliveira,项目名称:standalone-hystrix-dashboard,代码行数:52,代码来源:HystrixDashboardProxyConnectionHandler.java