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


Java MultiMap.contains方法代码示例

本文整理汇总了Java中io.vertx.core.MultiMap.contains方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.contains方法的具体用法?Java MultiMap.contains怎么用?Java MultiMap.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.MultiMap的用法示例。


在下文中一共展示了MultiMap.contains方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

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

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

示例4: fixcyberduck

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
protected void fixcyberduck() {
    SfsRequest serverRequest = getSfsRequest();
    MultiMap headers = serverRequest.headers();
    // cyberduck sends keep-alive but then gets screwed up when connection: close isn't sent
    // if this is not a proxied request and originated in cyberduck then send the connection: close
    // headers. If it is a proxied request let the proxy deal with the issue
    if (!headers.contains((X_FORWARDED_FOR))) {
        String userAgent = toLowerCase(headers.get(USER_AGENT));
        if (userAgent != null && userAgent.contains("cyberduck")) {
            serverRequest.response()
                    .putHeader(CONNECTION, "close");
        }
    }
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:15,代码来源:ConnectionCloseTerminus.java

示例5: merge

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public T merge(SfsRequest httpServerRequest) {
    MultiMap headers = httpServerRequest.headers();

    if (headers.contains(X_SFS_OBJECT_REPLICAS)) {
        setObjectReplicas(parseInt(headers.get(X_SFS_OBJECT_REPLICAS)));
    } else {
        setObjectReplicas(NOT_SET);
    }

    getMetadata().withHttpHeaders(headers);

    return (T) this;
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:14,代码来源:Container.java

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

示例7: mergeIntoResponseHeadersDistinct

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
private void mergeIntoResponseHeadersDistinct(MultiMap responseHeaders, MultiMap requestHeaders){
  Consumer<Map.Entry<String,String>> consumer = entry -> {
    String headerName = entry.getKey().toLowerCase();
    if(!responseHeaders.contains(headerName)){
      responseHeaders.add(headerName, entry.getValue());
    }
  };
  requestHeaders.forEach(consumer);
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:10,代码来源:RestVerticle.java

示例8: extractContentType

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static ContentType extractContentType(MultiMap headers) {
  if (headers.contains(HttpHeaders.CONTENT_TYPE)) {
    Matcher regexMatcher = CONTENTTYPE_REGEX_PATTERN.matcher(headers.get(HttpHeaders.CONTENT_TYPE));
    if (regexMatcher.find()) {
        return new ContentType(regexMatcher.group(1), regexMatcher.group(2), regexMatcher.group(3));
    }
  }
  return null;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:10,代码来源:HttpUtils.java

示例9: extractContentDisposition

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static ContentDisposition extractContentDisposition(MultiMap headers) {
  if (headers.contains(HEADER_CONTENT_DISPOSITION)) {
    String disposition = headers.get(HEADER_CONTENT_DISPOSITION);
    Matcher regexMatcher = DISPOSITION_REGEX_PATTERN.matcher(disposition);
    if (regexMatcher.find()) {
      return new ContentDisposition(regexMatcher.group("TYPE"),
               regexMatcher.group("FILENAME"),
               regexMatcher.group("CATEGORY"),
               regexMatcher.group("FORMAT"));
    }
  }
  return null;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:14,代码来源:HttpUtils.java

示例10: extractDocumentUri

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static String extractDocumentUri(MultiMap headers) {
  if (headers.contains(HttpHeaders.LOCATION)) {
    String location = headers.get(HttpHeaders.LOCATION);
    return location.substring(location.indexOf(DOCUMENT_URI_PREFIX) + DOCUMENT_URI_PREFIX.length());
  } else if (headers.contains(HEADER_CONTENT_DISPOSITION)) {
    String disposition = headers.get(HEADER_CONTENT_DISPOSITION);
    Matcher regexMatcher = DISPOSITION_REGEX_PATTERN.matcher(disposition);
    if (regexMatcher.find()) {
      return regexMatcher.group(2);
    }
  }
  return null;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:14,代码来源:HttpUtils.java

示例11: extractFormat

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static Format extractFormat(MultiMap headers) {
  if (headers.contains(VND_MARKLOGIC_DOCUMENT_FORMAT)) {
    return Format.getValue(headers.get(VND_MARKLOGIC_DOCUMENT_FORMAT));
  } else if (headers.contains(HEADER_CONTENT_DISPOSITION)) {
    String disposition = headers.get(HEADER_CONTENT_DISPOSITION);
    Matcher regexMatcher = DISPOSITION_REGEX_PATTERN.matcher(disposition);
    if (regexMatcher.find()) {
      return Format.getValue(regexMatcher.group(4));
    }
  }
  return null;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:13,代码来源:HttpUtils.java

示例12: extractPagination

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static Pagination extractPagination(MultiMap headers) {
  Pagination pagination = new Pagination();
  if (headers.contains(VND_MARKLOGIC_START)) {
    pagination.setStart(Long.parseLong(headers.get(VND_MARKLOGIC_START)));
  }
  if (headers.contains(VND_MARKLOGIC_PAGELEN)) {
    pagination.setPageLen(Long.parseLong(headers.get(VND_MARKLOGIC_PAGELEN)));
  }
  if (headers.contains(VND_MARKLOGIC_ESTIMATE)) {
    pagination.setEstimate(Long.parseLong(headers.get(VND_MARKLOGIC_ESTIMATE)));
  }
  return pagination;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:14,代码来源:HttpUtils.java

示例13: getUserByCredentials

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
protected UserAndRole getUserByCredentials(SfsRequest sfsRequest) {

        MultiMap headers = sfsRequest.headers();
        Optional<String> oToken;
        if (headers.contains(X_AUTH_TOKEN)) {
            oToken = fromNullable(headers.get(X_AUTH_TOKEN));
        } else if (headers.contains(AUTHORIZATION)) {
            oToken = extractToken(headers.get(AUTHORIZATION), "Basic");
        } else {
            oToken = absent();
        }

        if (oToken.isPresent()) {
            String token = oToken.get();

            String decoded = new String(base64().decode(token), StandardCharsets.UTF_8);
            String[] parts =
                    toArray(
                            on(':')
                                    .limit(2)
                                    .split(decoded),
                            String.class
                    );

            if (parts.length == 2) {
                String username = parts[0];
                String password = parts[1];
                for (Role role : new Role[]{ADMIN, USER}) {
                    Set<User> usersForRole = this.roles.get(role);
                    if (usersForRole != null) {
                        for (User user : usersForRole) {
                            if (equal(user.getUsername(), username)
                                    && equal(user.getPassword(), password)) {
                                return new UserAndRole(role, user);
                            }
                        }
                    }
                }
            }
        }
        return null;
    }
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:43,代码来源:SimpleAuthProvider.java

示例14: extractContentLength

import io.vertx.core.MultiMap; //导入方法依赖的package包/类
public static long extractContentLength(MultiMap headers) {
  if (headers.contains(HttpHeaders.CONTENT_LENGTH)) {
    return Long.parseLong(headers.get(HttpHeaders.CONTENT_LENGTH));
  }
  return 0;
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:7,代码来源:HttpUtils.java


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