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


Java MultiMap.remove方法代碼示例

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


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

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

示例2: authHeaders

import io.vertx.core.MultiMap; //導入方法依賴的package包/類
/**
 * Get the auth bits from the module list into X-Okapi-Permissions-Required
 * and X-Okapi-Permissions-Desired headers. Also X-Okapi-Module-Permissions
 * for each module that has such. At the same time, sets the authToken to
 * default for each module. Some of these will be overwritten once the auth
 * module returns with dedicated tokens, but by default we use the one given
 * to us by the client.
 *
 */
private void authHeaders(List<ModuleInstance> modlist,
  MultiMap requestHeaders, String defaultToken, ProxyContext pc) {
  // Sanitize important headers from the incoming request
  requestHeaders.remove(XOkapiHeaders.PERMISSIONS_REQUIRED);
  requestHeaders.remove(XOkapiHeaders.PERMISSIONS_DESIRED);
  requestHeaders.remove(XOkapiHeaders.MODULE_PERMISSIONS);
  requestHeaders.remove(XOkapiHeaders.EXTRA_PERMISSIONS);
  requestHeaders.remove(XOkapiHeaders.MODULE_TOKENS);
  Set<String> req = new HashSet<>();
  Set<String> want = new HashSet<>();
  Set<String> extraperms = new HashSet<>();
  Map<String, String[]> modperms = new HashMap<>(modlist.size());
  for (ModuleInstance mod : modlist) {
    RoutingEntry re = mod.getRoutingEntry();
    String[] reqp = re.getPermissionsRequired();
    if (reqp != null) {
      req.addAll(Arrays.asList(reqp));
    }
    String[] wap = re.getPermissionsDesired();
    if (wap != null) {
      want.addAll(Arrays.asList(wap));
    }
    String[] modp = re.getModulePermissions();
    if (modp != null) {
      if (re.getProxyType() == ProxyType.REDIRECT) {
        extraperms.addAll(Arrays.asList(modp));
      } else {
        modperms.put(mod.getModuleDescriptor().getId(), modp);
      }
    }
    mod.setAuthToken(defaultToken);
  } // mod loop
  if (!req.isEmpty()) {
    pc.debug("authHeaders: " + XOkapiHeaders.PERMISSIONS_REQUIRED + " " + String.join(",", req));
    requestHeaders.add(XOkapiHeaders.PERMISSIONS_REQUIRED, String.join(",", req));
  }
  if (!want.isEmpty()) {
    pc.debug("authHeaders: " + XOkapiHeaders.PERMISSIONS_DESIRED + " " + String.join(",", want));
    requestHeaders.add(XOkapiHeaders.PERMISSIONS_DESIRED, String.join(",", want));
  }
  // Add the X-Okapi-Module-Permissions even if empty. That causes auth to return
  // an empty X-Okapi-Module-Token, which will tell us that we have done the mod
  // perms, and no other module should be allowed to do the same.
  String mpj = Json.encode(modperms);
  pc.debug("authHeaders: " + XOkapiHeaders.MODULE_PERMISSIONS + " " + mpj);
  requestHeaders.add(XOkapiHeaders.MODULE_PERMISSIONS, mpj);
  if (!extraperms.isEmpty()) {
    String epj = Json.encode(extraperms);
    pc.debug("authHeaders: " + XOkapiHeaders.EXTRA_PERMISSIONS + " " + epj);
    requestHeaders.add(XOkapiHeaders.EXTRA_PERMISSIONS, epj);
  }
}
 
開發者ID:folio-org,項目名稱:okapi,代碼行數:62,代碼來源:ProxyService.java


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