当前位置: 首页>>代码示例>>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;未经允许,请勿转载。