本文整理匯總了Java中io.vertx.core.MultiMap.getAll方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiMap.getAll方法的具體用法?Java MultiMap.getAll怎麽用?Java MultiMap.getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.MultiMap
的用法示例。
在下文中一共展示了MultiMap.getAll方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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;
}
示例3: 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;
}
示例4: 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
示例5: testAfterReceiveResponseNormal
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Test
public void testAfterReceiveResponseNormal(@Mocked Invocation invocation,
@Mocked HttpServletResponseEx responseEx,
@Mocked Buffer bodyBuffer,
@Mocked OperationMeta operationMeta,
@Mocked ResponseMeta responseMeta,
@Mocked RestOperationMeta swaggerRestOperation,
@Mocked ProduceProcessor produceProcessor) throws Exception {
MultiMap responseHeader = new CaseInsensitiveHeaders();
responseHeader.add("b", "bValue");
Object decodedResult = new Object();
new Expectations() {
{
responseEx.getHeader(HttpHeaders.CONTENT_TYPE);
result = "json";
responseEx.getHeaderNames();
result = Arrays.asList("a", "b");
responseEx.getHeaders("b");
result = responseHeader.getAll("b");
swaggerRestOperation.findProduceProcessor("json");
result = produceProcessor;
produceProcessor.decodeResponse(bodyBuffer, responseMeta.getJavaType());
result = decodedResult;
invocation.getOperationMeta();
result = operationMeta;
operationMeta.getExtData(RestConst.SWAGGER_REST_OPERATION);
result = swaggerRestOperation;
responseEx.getStatusType();
result = Status.OK;
}
};
Response response = filter.afterReceiveResponse(invocation, responseEx);
Assert.assertSame(decodedResult, response.getResult());
Assert.assertEquals(1, response.getHeaders().getHeaderMap().size());
Assert.assertEquals(response.getHeaders().getHeader("b"), Arrays.asList("bValue"));
}
示例6: processIncoming
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
/**
* Check incoming messages for final destinations and then forward them if they are not
* duplicates
*
* @param incomingData received from event bus
*/
protected void processIncoming(final Message<JsonObject> incomingData) {
final MultiMap headers = incomingData.headers();
final List<String> finalDestination = headers.getAll(Constants.BUS_FINAL_DESTINATION);
if ((finalDestination != null) && !finalDestination.isEmpty()) {
final JsonObject j = incomingData.body();
// Forwarding the original headers
final DeliveryOptions dOpts = new DeliveryOptions();
dOpts.setHeaders(headers);
final Future<Void> duplicate = Future.future(f -> {
if (f.succeeded()) {
// Forwarding it to where it should go
final EventBus eb = this.getVertx().eventBus();
finalDestination.forEach(d -> {
eb.send(d, j, dOpts);
});
} else {
this.logger.info("Dropped duplicate Object:" + String.valueOf(j));
}
});
// The duplicate check happens here!
this.checkForDuplicate(duplicate, j);
} else {
this.logger.fatal(new Exception("Incoming message without final destination" + incomingData.toString()));
}
}
示例7: getParameterMap
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public Map<String, String[]> getParameterMap() {
MultiMap map = httpServerRequest.params();
Map<String, String[]> parameterMap = new HashMap<>();
for (String name : httpServerRequest.params().names()) {
List<String> values = map.getAll(name);
parameterMap.put(name, values.toArray(new String[values.size()]));
}
return parameterMap;
}
示例8: extract
import io.vertx.core.MultiMap; //導入方法依賴的package包/類
public Object extract(String name, Parameter parameter, MultiMap params) {
AbstractSerializableParameter abstractSerializableParameter = (AbstractSerializableParameter) parameter;
if (!params.contains(name)) {
if (abstractSerializableParameter.getRequired()) {
throw new IllegalArgumentException("Missing required parameter: " + name);
} else if (abstractSerializableParameter.getDefaultValue()!=null){
return abstractSerializableParameter.getDefaultValue();
} else {
return null;
}
}
if ((abstractSerializableParameter.getAllowEmptyValue() == null
|| !abstractSerializableParameter.getAllowEmptyValue())
&& StringUtils.isEmpty(params.get(name))) {
throw new IllegalArgumentException(
"Empty value is not authorized for parameter: " + name);
}
if ("array".equals(abstractSerializableParameter.getType())) {
if ("multi".equals(abstractSerializableParameter.getCollectionFormat())) {
return params.getAll(name);
} else {
List<String> resultParams = this.splitArrayParam(abstractSerializableParameter,
params.get(name));
if (resultParams != null) {
return resultParams;
}
}
}
return params.get(name);
}