Package org.nutz.mvc.config

Examples of org.nutz.mvc.config.FilterNutConfig


  private Pattern ignorePtn;

  private boolean skipMode;

  public void init(FilterConfig conf) throws ServletException {
    FilterNutConfig config = new FilterNutConfig(conf);
    // 如果仅仅是用来更新 Message 字符串的,不加载 Nutz.Mvc 设定
    // @see Issue 301
    String skipMode = Strings.sNull(conf.getInitParameter("skip-mode"), "false").toLowerCase();
    if (!"true".equals(skipMode)) {
      handler = new ActionHandler(config);
      String regx = Strings.sNull(config.getInitParameter("ignore"), IGNORE);
      if (!"null".equalsIgnoreCase(regx)) {
        ignorePtn = Pattern.compile(regx, Pattern.CASE_INSENSITIVE);
      }
    } else
      this.skipMode = true;
View Full Code Here


      }
        Mvcs.setServletContext(conf.getServletContext());
        this.selfName = conf.getFilterName();
        Mvcs.set(selfName, null, null);

        FilterNutConfig config = new FilterNutConfig(conf);
        Mvcs.setNutConfig(config);
        handler = new ActionHandler(config);
        String regx = Strings.sNull(config.getInitParameter("ignore"), IGNORE);
        if (!"null".equalsIgnoreCase(regx)) {
            ignorePtn = Pattern.compile(regx, Pattern.CASE_INSENSITIVE);
        }
        sp = config.getSessionProvider();
    }
View Full Code Here

      log.infof("NutFilter[%s] starting ...", conf.getFilterName());
        Mvcs.setServletContext(conf.getServletContext());
        this.selfName = conf.getFilterName();
        Mvcs.set(selfName, null, null);

        FilterNutConfig config = new FilterNutConfig(conf);
        Mvcs.setNutConfig(config);
        handler = new ActionHandler(config);
        String regx = Strings.sNull(config.getInitParameter("ignore"), IGNORE);
        if (!"null".equalsIgnoreCase(regx)) {
            ignorePtn = Pattern.compile(regx, Pattern.CASE_INSENSITIVE);
        }
        String exclusions = config.getInitParameter("exclusions");
        if (exclusions != null) {
          String[] tmps = Strings.splitIgnoreBlank(exclusions);
          Set<String> prefix = new HashSet<String>();
          Set<String> suffix = new HashSet<String>();
          Set<String> paths = new HashSet<String>();
          for (String tmp : tmps) {
            tmp = tmp.trim().intern();
            if (tmp.length() > 1) {
              if (tmp.startsWith("*")) {
              prefix.add(tmp.substring(1));
              continue;
            } else if (tmp.endsWith("*")) {
              suffix.add(tmp.substring(0, tmp.length() - 1));
              continue;
            }
            }
        paths.add(tmp);
      }
          if (prefix.size() > 0) {
            exclusionsPrefix = Pattern.compile("^("+Lang.concat("|", prefix)+")", Pattern.CASE_INSENSITIVE);
            log.info("exclusionsPrefix  = " + exclusionsPrefix);
          }
          if (suffix.size() > 0) {
            exclusionsSuffix = Pattern.compile("^("+Lang.concat("|", suffix)+")", Pattern.CASE_INSENSITIVE);
            log.info("exclusionsSuffix = " + exclusionsSuffix);
          }
          if (paths.size() > 0) {
            exclusionPaths = paths;
            log.info("exclusionsPath   = " + exclusionPaths);
          }
        }
        sp = config.getSessionProvider();
    }
View Full Code Here

TOP

Related Classes of org.nutz.mvc.config.FilterNutConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.