コード例 #1
0
  public void init(FilterConfig config) throws ServletException {
    String access = config.getInitParameter("jspDirectAccess");
    if (StringUtil.isNotBlank(access)) {
      jspDirectAccess = Boolean.valueOf(access);
    }

    String routesPath = config.getInitParameter("routes");
    if (StringUtil.isNotEmpty(routesPath)) {
      String realRoutesPath = config.getServletContext().getRealPath(routesPath);
      if (realRoutesPath != null) {
        routes = new File(realRoutesPath);
      }
      InputStream routesStream = config.getServletContext().getResourceAsStream(routesPath);
      try {
        Routes.load(routesStream);
      } finally {
        InputStreamUtil.close(routesStream);
      }
      lastLoaded = System.currentTimeMillis();
    }

    String interval = config.getInitParameter("checkInterval");
    if (StringUtil.isNotEmpty(interval)) {
      checkInterval = LongConversionUtil.toLong(interval);
    }
    if (checkInterval == null || checkInterval < 0) {
      checkInterval = -1L;
    }

    String contextSensitiveParam = config.getInitParameter("contextSensitive");
    if (StringUtil.isNotBlank(contextSensitiveParam)) {
      contextSensitive = Boolean.valueOf(contextSensitiveParam);
    }
    if (contextSensitive) {
      try {
        Method getContextPath = ReflectionUtil.getMethod(ServletContext.class, "getContextPath");
        UrlRewriter.contextPath =
            (String) MethodUtil.invoke(getContextPath, config.getServletContext(), null);
      } catch (NoSuchMethodRuntimeException e) {
        UrlRewriter.contextPath = config.getServletContext().getServletContextName();
      }
    }
    requestUriHeader = config.getInitParameter("requestUriHeader");

    String fallThroughParam = config.getInitParameter("fallThrough");
    if (StringUtil.isNotBlank(fallThroughParam)) {
      fallThrough = Boolean.valueOf(fallThroughParam);
    }
  }
コード例 #2
0
  public FacesConfig configure() {
    List configs = new LinkedList();
    String path = getPath();
    if (logger_.isDebugEnabled()) {
      logger_.debug("target file path = " + path);
    }
    if (path == null) {
      return null;
    }
    String[] paths = StringUtil.split(path, FACES_CONFIG_DELIMETER);

    for (int i = 0; i < paths.length; i++) {
      final String targetPath = paths[i];
      final SaxHandlerParser parser = createSaxHandlerParser();
      InputStream is = resourceResolver_.getInputStream(targetPath.trim());
      try {
        configs.add(parser.parse(is, targetPath));
      } finally {
        InputStreamUtil.close(is);
      }
    }
    return FacesConfigUtil.collectAllFacesConfig(configs);
  }