Example #1
0
  public void init(FilterConfig config) throws ServletException {
    this.context = config.getServletContext();

    // get input and output dirs
    this.inDirName = config.getInitParameter(P_INPUT_DIRNAME);
    if (this.inDirName == null) this.inDirName = DEFAULT_INPUT_DIRNAME;
    this.outDirName = config.getInitParameter(P_OUTPUT_DIRNAME);
    if (this.outDirName == null) this.outDirName = DEFAULT_OUTPUT_DIRNAME;
    if (ZimbraLog.webclient.isDebugEnabled()) {
      ZimbraLog.webclient.debug("### indir:  " + this.inDirName);
      ZimbraLog.webclient.debug("### outdir: " + this.outDirName);
    }
  }
 public void init(FilterConfig filterConfig) {
   this.config = filterConfig;
   this.encoding = config.getInitParameter("encoding");
   if (encoding == null || encoding.length() == 0) {
     encoding = "GBK";
   }
   expiresMap = new HashMap();
   Enumeration names = config.getInitParameterNames();
   while (names.hasMoreElements()) {
     String paramName = (String) names.nextElement();
     if (!"encoding".equals(paramName)) {
       String paramValue = config.getInitParameter(paramName);
       try {
         Integer expires = Integer.valueOf(config.getInitParameter(paramName));
         expiresMap.put(paramName, expires);
       } catch (Exception ex) {
         // LogUtil.logError( "Filter."+paramValue+"="+paramValue);
       }
     }
   }
 }
  public void init(FilterConfig config) throws ServletException {

    Log log = LogFactory.getLog(this.getClass());
    log.info("PsqStoreConfigFilter: init(config) called");

    String path = "";

    try {
      URL pathUrl = config.getServletContext().getResource("/");

      path = new File(config.getServletContext().getRealPath("/")).getAbsolutePath();

      log.info(" protocol=" + pathUrl.getProtocol());
      log.info(" path=" + path);

    } catch (Exception ex) {
      ex.printStackTrace();
    }

    if (config.getInitParameter("derby-home") != null) {

      String myHome = config.getInitParameter("derby-home");
      if (!myHome.startsWith("/")) {
        myHome = path + File.separator + myHome;
      }

      log.info("derby-home(final)=" + myHome);
      System.setProperty("xpsq.derby.home", myHome);

      if (PsqContext.getStore("derby") != null) {
        PsqContext.getStore("derby").initialize();
      }
    }

    if (config.getInitParameter("bdb-home") != null) {

      String myHome = config.getInitParameter("bdb-home");
      if (!myHome.startsWith("/")) {
        myHome = path + File.separator + myHome;
      }

      log.info("bdb-home(final)=" + myHome);
      System.setProperty("xpsq.bdb.home", myHome);

      if (PsqContext.getStore("bdb") != null) {
        PsqContext.getStore("bdb").initialize();
      }
    }
  }