当前位置: 首页>>代码示例>>Java>>正文


Java MultiMap.getAll方法代码示例

本文整理汇总了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;
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:18,代码来源:HttpServerRequestHeaderToJsonObject.java

示例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;
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:19,代码来源:HttpServerRequestHeaderLogger.java

示例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;
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:18,代码来源:HttpClientResponseHeaderLogger.java

示例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"));
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:41,代码来源:TestDefaultHttpClientFilter.java

示例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()));
	}

}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:33,代码来源:AbstractSFDCDedupVerticle.java

示例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;
}
 
开发者ID:kuangcao,项目名称:ninja-vertx-standalone,代码行数:11,代码来源:VertxHttpServletRequest.java

示例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);
}
 
开发者ID:phiz71,项目名称:vertx-swagger,代码行数:34,代码来源:AbstractSerializableParameterExtractor.java


注:本文中的io.vertx.core.MultiMap.getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。