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