當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiMap.get方法代碼示例

本文整理匯總了Java中io.vertx.core.MultiMap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiMap.get方法的具體用法?Java MultiMap.get怎麽用?Java MultiMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.MultiMap的用法示例。


在下文中一共展示了MultiMap.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFormattedElement

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
  HttpServerResponse response = accessLogParam.getRoutingContext().response();
  if (null == response) {
    return RESULT_NOT_FOUND;
  }

  MultiMap headers = response.headers();
  if (null == headers) {
    return RESULT_NOT_FOUND;
  }

  String result = headers.get(identifier);
  if (null == result) {
    return RESULT_NOT_FOUND;
  }

  return result;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:20,代碼來源:ResponseHeaderElement.java

示例2: TileCtx

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
/**
 * Default constructor.
 * @param params {@link io.vertx.core.http.HttpServerRequest} parameters
 * required for rendering an image region.
 * @param omeroSessionKey OMERO session key.
 */
TileCtx(MultiMap params, String omeroSessionKey) {
    this.omeroSessionKey = omeroSessionKey;
    imageId = Long.parseLong(params.get("imageId"));
    z = Integer.parseInt(params.get("z"));
    c = Integer.parseInt(params.get("c"));
    t = Integer.parseInt(params.get("t"));
    Integer x = Optional.ofNullable(params.get("x"))
            .map(Integer::parseInt)
            .orElse(0);
    Integer y = Optional.ofNullable(params.get("y"))
            .map(Integer::parseInt)
            .orElse(0);
    Integer width = Optional.ofNullable(params.get("w"))
            .map(Integer::parseInt)
            .orElse(0);
    Integer height = Optional.ofNullable(params.get("h"))
            .map(Integer::parseInt)
            .orElse(0);
    region = new RegionDef(x, y, width, height);
    resolution = Optional.ofNullable(params.get("resolution"))
            .map(Integer::parseInt)
            .orElse(null);
    format = params.get("format");
}
 
開發者ID:glencoesoftware,項目名稱:omero-ms-pixel-buffer,代碼行數:31,代碼來源:TileCtx.java

示例3: call

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
    MultiMap headers = httpServerRequest.headers();

    String value = headers.get(headerName);
    if (value != null) {
        boolean failed = false;
        BaseEncoding baseEncoding = base64();
        try {
            byte[] decoded = baseEncoding.decode(value);
            if (decoded == null || !value.equals(baseEncoding.encode(decoded))) {
                failed = true;
            }
        } catch (Throwable e) {
            // do nothing
        }
        if (failed) {
            JsonObject jsonObject = new JsonObject()
                    .put("message", format("%s must be Base64 encoded", headerName));

            throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
        }
    }
    return httpServerRequest;
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:26,代碼來源:ValidateHeaderIsBase64Encoded.java

示例4: call

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
    MultiMap headers = httpServerRequest.headers();

    String value = headers.get(headerName);
    if (value != null) {
        Long parsed = tryParse(value);
        if (parsed == null || parsed < min || parsed > max) {
            JsonObject jsonObject = new JsonObject()
                    .put("message", format("%s must be between %d and %d", headerName, min, max));

            throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
        }
    }
    return httpServerRequest;
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:17,代碼來源:ValidateHeaderBetweenLong.java

示例5: call

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
    MultiMap params = httpServerRequest.params();

    String value = params.get(paramName);
    if (value != null) {
        boolean failed = false;
        BaseEncoding baseEncoding = base64();
        try {
            byte[] decoded = baseEncoding.decode(value);
            if (decoded == null || value.equals(baseEncoding.encode(decoded))) {
                failed = true;
            }
        } catch (Throwable e) {
            // do nothing
        }
        if (failed) {
            JsonObject jsonObject = new JsonObject()
                    .put("message", format("%s must be Base64 encoded", paramName));

            throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
        }
    }
    return httpServerRequest;
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:26,代碼來源:ValidateParamIsBase64Encoded.java

示例6: call

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
    MultiMap param = httpServerRequest.params();

    String value = param.get(paramName);
    if (value != null) {
        Long parsed = tryParse(value);
        if (parsed == null || parsed < min || parsed > max) {
            JsonObject jsonObject = new JsonObject()
                    .put("message", format("%s must be between %d and %d", paramName, min, max));

            throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
        }
    }
    return httpServerRequest;
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:17,代碼來源:ValidateParamBetweenLong.java

示例7: getRemoteServiceUrl

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
public static String getRemoteServiceUrl(HttpServerRequest httpServerRequest) {
    try {
        URI absoluteRequestURI = new URI(httpServerRequest.absoluteURI());
        MultiMap headers = httpServerRequest.headers();

        String host = getFirstHeader(httpServerRequest, "X-Forwarded-Host");
        String contextRoot = getFirstHeader(httpServerRequest, SfsHttpHeaders.X_CONTEXT_ROOT);
        if (host == null) host = getFirstHeader(httpServerRequest, HttpHeaders.HOST);
        if (host == null) host = absoluteRequestURI.getHost();
        String proto = headers.get(HttpHeaders.X_FORWARDED_PROTO);
        if (proto == null) proto = absoluteRequestURI.getScheme();

        String serviceUrl;
        if (contextRoot != null) {
            serviceUrl = String.format("%s://%s/%s", proto, host, contextRoot);
        } else {
            serviceUrl = String.format("%s://%s", proto, host);
        }
        return serviceUrl;
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:24,代碼來源:SfsHttpUtil.java

示例8: getFormattedElement

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
  MultiMap headers = accessLogParam.getRoutingContext().request().headers();
  if (null == headers) {
    return "-";
  }

  String result = headers.get(identifier);

  if (null == result) {
    return RESULT_NOT_FOUND;
  }

  return result;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:16,代碼來源:RequestHeaderElement.java

示例9: userId

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private String userId(MultiMap headers) {

            if (headers == null || headers.get(UserModel.userId) == null) {
                throw new MessageBusException("UserId must be present in message headers or in userId field");
            }

            return headers.get(UserModel.userId);
        }
 
開發者ID:codefacts,項目名稱:Elastic-Components,代碼行數:9,代碼來源:MessageBus.java

示例10: convert

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private SimpleEventBus.Params convert(Params params) {

        final MultiMap headers = params.getOptions().getHeaders();

        if (headers == null) {

            params.getOptions().setHeaders(new VertxMultiMap(
                ImmutableListMultimap.of(UserModel.userId, params.getUserId())
            ));

        } else if (headers.get(UserModel.userId) == null) {

            params.getOptions().setHeaders(new VertxMultiMap(
                ImmutableListMultimap.<String, String>builder()
                    .putAll(headers.entries())
                    .put(UserModel.userId, params.getUserId())
                    .build()
            ));

        }

        return SimpleEventBus.Params.builder()
            .address(params.getAddress())
            .message(params.getMessage())
            .options(params.getOptions())
            .build();
    }
 
開發者ID:codefacts,項目名稱:Elastic-Components,代碼行數:28,代碼來源:MessageBusImpl.java

示例11: WebSession

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private WebSession(SockJSSocket sockJSSocket, MultiMap sessionData,
                   AsyncCallback<WebSession> readyCallback,
                   ErrorCallback errorCallback) {

    this.sessionData = new SessionData(sessionData.get("name"),
            sessionData.get("email"), sessionData.get("topic"));
    this.sockJSSocket = sockJSSocket;

    initWebSocket(sockJSSocket);

    CompletableFuture.runAsync(
            () -> createRoom(readyCallback, errorCallback), executor);

}
 
開發者ID:symphonyoss,項目名稱:helpdesk-bot,代碼行數:15,代碼來源:WebSession.java

示例12: extract

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public String extract(String name, boolean required, HttpServerRequest request) {
    MultiMap params = request.params();
    if (!params.contains(name) && required) {
        throw new IllegalArgumentException("Missing required parameter: " + name);
    }
    return params.get(name);
}
 
開發者ID:diega,項目名稱:vertx-web-swagger,代碼行數:9,代碼來源:SwaggerRouter.java

示例13: manageHeaders

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
private static void manageHeaders(HttpServerResponse httpServerResponse, MultiMap messageHeaders) {
    if(messageHeaders.contains(CUSTOM_STATUS_CODE_HEADER_KEY)) {
        Integer customStatusCode = Integer.valueOf(messageHeaders.get(CUSTOM_STATUS_CODE_HEADER_KEY));
        httpServerResponse.setStatusCode(customStatusCode);
        messageHeaders.remove(CUSTOM_STATUS_CODE_HEADER_KEY);
    }
    if(messageHeaders.contains(CUSTOM_STATUS_MESSAGE_HEADER_KEY)) {
        String customStatusMessage = messageHeaders.get(CUSTOM_STATUS_MESSAGE_HEADER_KEY);
        httpServerResponse.setStatusMessage(customStatusMessage);
        messageHeaders.remove(CUSTOM_STATUS_MESSAGE_HEADER_KEY);
    }
    httpServerResponse.headers().addAll(messageHeaders);
}
 
開發者ID:phiz71,項目名稱:vertx-swagger,代碼行數:14,代碼來源:SwaggerRouter.java

示例14: 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

示例15: call

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
@Override
public SfsRequest call(SfsRequest httpServerRequest) {
    MultiMap headers = httpServerRequest.headers();

    String value = headers.get(headerName);
    if (value != null) {
        JsonObject jsonObject = new JsonObject()
                .put("message", format("%s  is not supported", headerName));

        throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject);
    }
    return httpServerRequest;
}
 
開發者ID:pitchpoint-solutions,項目名稱:sfs,代碼行數:14,代碼來源:ValidateHeaderNotExists.java


注:本文中的io.vertx.core.MultiMap.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。