當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。