Exemplo n.º 1
0
  @Override
  public void init() throws ServletException {
    super.init();

    System.out.println("");
    System.out.println("");
    System.out.println("		    _  ____  _     _     ____");
    System.out.println("		   / |/  _ \\/ \\ |\\/ \\   /  _ \\");
    System.out.println("		   | || / \\|| | //| |   | / \\|");
    System.out.println("		/\\_| || |-||| \\// | |_/\\| \\_/|");
    System.out.println("		\\____/\\_/ \\|\\__/  \\____/\\____/");
    System.out.println("");
    System.out.println("");

    /** JSTL Constant * */
    getServletContext().setAttribute("BACK_PARAM_NAME", ElementaryURLHelper.BACK_PARAM_NAME);

    try {
      DebugHelper.updateLoggerLevel(getServletContext());
    } catch (Exception e1) {
      logger.warning("error when update logger level : " + e1.getMessage());
      e1.printStackTrace();
    }

    StaticConfig staticConfig = StaticConfig.getInstance(getServletContext());

    writeInfo(System.out);

    DebugListening.staticConfig = staticConfig;

    if (staticConfig.isMailingThread()) {
      logger.info("start mailing thread.");
      mailingThread = new MailingThread(getServletContext());
      mailingThread.start();
    } else {
      logger.info("not start mailing thread for this instance");
    }

    threadManager = ThreadManager.getInstance(getServletContext());
    threadManager.setThreadDir(new File(staticConfig.getThreadFolder()));
    threadManager.start();

    try {
      SynchroThread.createInstance(staticConfig.getThreadFolder(), SynchroThread.class);
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    }

    if (staticConfig.getTempDir() != null) {
      System.setProperty("java.io.tmpdir", staticConfig.getTempDir());
    }

    MultiReadRequestWrapper.clearTempDir(getServletContext());
    TemplateFactory.copyDefaultTemplate(getServletContext());
  }
Exemplo n.º 2
0
  private void updateInfo(StaticConfig staticConfig) {
    Properties finalProps = new Properties();

    if (staticConfig.getSMTPHost() != null) {
      finalProps.put(SMTP_HOST_PARAM, staticConfig.getSMTPHost());
    }
    if (staticConfig.getSMTPPort() != null) {
      finalProps.put(SMTP_PORT_PARAM, staticConfig.getSMTPPort());
    }
    if (staticConfig.getSMTPUser() != null) {
      finalProps.put(SMTP_USER_PARAM, staticConfig.getSMTPUser());
    }
    if (staticConfig.getSMTPPasswordParam() != null) {
      finalProps.put(SMTP_PASSWORD_PARAM, staticConfig.getSMTPPasswordParam());
    }

    this.tempDir = staticConfig.getTempDir();

    this.props = finalProps;
  }