コード例 #1
0
ファイル: Context.java プロジェクト: pedroigorsilva/is
  /**
   * Will add a new security constraint: For all paths: if( match(path) && match(method) && match(
   * transport ) ) then require("roles")
   *
   * <p>This is equivalent with adding a Container with the path, method and transport. If the
   * container will be matched, the request will have to pass the security constraints.
   */
  public void addSecurityConstraint(
      String path[], String methods[], String roles[], String transport) throws TomcatException {
    for (int i = 0; i < path.length; i++) {
      Container ct = new Container();
      ct.setContext(this);
      ct.setTransport(transport);
      ct.setRoles(roles);
      ct.setPath(path[i]);
      ct.setMethods(methods);

      // XXX check if exists, merge if true.
      constraints.put(path[i], ct);
      // contextM.addSecurityConstraint( this, path[i], ct);
      contextM.addContainer(ct);
    }
  }