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