コード例 #1
0
ファイル: Dispatcher.java プロジェクト: faithyee/Struts2
 private void init_FileManager() throws ClassNotFoundException {
   if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
     final String fileManagerClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER);
     final Class<FileManager> fileManagerClass =
         (Class<FileManager>) Class.forName(fileManagerClassName);
     if (LOG.isInfoEnabled()) {
       LOG.info("Custom FileManager specified: #0", fileManagerClassName);
     }
     configurationManager.addContainerProvider(
         new FileManagerProvider(fileManagerClass, fileManagerClass.getSimpleName()));
   } else {
     // add any other Struts 2 provided implementations of FileManager
     configurationManager.addContainerProvider(
         new FileManagerProvider(JBossFileManager.class, "jboss"));
   }
   if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY)) {
     final String fileManagerFactoryClassName =
         initParams.get(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY);
     final Class<FileManagerFactory> fileManagerFactoryClass =
         (Class<FileManagerFactory>) Class.forName(fileManagerFactoryClassName);
     if (LOG.isInfoEnabled()) {
       LOG.info("Custom FileManagerFactory specified: #0", fileManagerFactoryClassName);
     }
     configurationManager.addContainerProvider(
         new FileManagerFactoryProvider(fileManagerFactoryClass));
   }
 }
コード例 #2
0
ファイル: S2FileTag.java プロジェクト: rockjava/s2jh
 public int doEndTag() throws JspException {
   JspWriter writer = pageContext.getOut();
   if (label != null) {
     try {
       writer.write("<div class='control-group'><label class='control-label'>");
       writer.write(label);
       writer.write("</label><div class='controls'>");
     } catch (IOException e) {
       if (LOG.isInfoEnabled()) {
         LOG.info("Could not print out value '" + label + "'", e);
       }
     }
   }
   component.end(writer, getBody());
   if (label != null) {
     try {
       writer.write("</div></div>");
     } catch (IOException e) {
       if (LOG.isInfoEnabled()) {
         LOG.info("Could not print out value '" + label + "'", e);
       }
     }
   }
   component = null;
   return EVAL_PAGE;
 }
コード例 #3
0
ファイル: Property.java プロジェクト: samlin/struts218
  public boolean start(Writer writer) {
    boolean result = super.start(writer);

    String actualValue = null;

    if (value == null) {
      value = "top";
    } else {
      value = stripExpressionIfAltSyntax(value);
    }

    // exception: don't call findString(), since we don't want the
    //            expression parsed in this one case. it really
    //            doesn't make sense, in fact.
    actualValue = (String) getStack().findValue(value, String.class, throwExceptionOnELFailure);

    try {
      if (actualValue != null) {
        writer.write(prepare(actualValue));
      } else if (defaultValue != null) {
        writer.write(prepare(defaultValue));
      }
    } catch (IOException e) {
      LOG.info("Could not print out value '" + value + "'", e);
    }

    return result;
  }
コード例 #4
0
ファイル: Dispatcher.java プロジェクト: phani6292/struts
 private void init_CheckWebLogicWorkaround(Container container) {
   // test whether param-access workaround needs to be enabled
   if (servletContext != null
       && servletContext.getServerInfo() != null
       && servletContext.getServerInfo().indexOf("WebLogic") >= 0) {
     LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");
     paramsWorkaroundEnabled = true;
   } else {
     paramsWorkaroundEnabled =
         "true"
             .equals(
                 container.getInstance(
                     String.class, StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND));
   }
 }
コード例 #5
0
ファイル: Dispatcher.java プロジェクト: faithyee/Struts2
  /**
   * Return the path to save uploaded files to (this is configurable).
   *
   * @return the path to save uploaded files to
   * @param servletContext Our ServletContext
   */
  private String getSaveDir(ServletContext servletContext) {
    String saveDir = multipartSaveDir.trim();

    if (saveDir.equals("")) {
      File tempdir = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
      if (LOG.isInfoEnabled()) {
        LOG.info(
            "Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir");
      }

      if (tempdir != null) {
        saveDir = tempdir.toString();
        setMultipartSaveDir(saveDir);
      }
    } else {
      File multipartSaveDir = new File(saveDir);

      if (!multipartSaveDir.exists()) {
        if (!multipartSaveDir.mkdirs()) {
          String logMessage;
          try {
            logMessage =
                "Could not find create multipart save directory '"
                    + multipartSaveDir.getCanonicalPath()
                    + "'.";
          } catch (IOException e) {
            logMessage =
                "Could not find create multipart save directory '"
                    + multipartSaveDir.toString()
                    + "'.";
          }
          if (devMode) {
            LOG.error(logMessage);
          } else {
            if (LOG.isWarnEnabled()) {
              LOG.warn(logMessage);
            }
          }
        }
      }
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("saveDir=" + saveDir);
    }

    return saveDir;
  }
コード例 #6
0
  /**
   * Gracefully shut down this database, releasing any resources that were allocated at
   * initialization.
   *
   * @param event ServletContextEvent to process
   */
  public void contextDestroyed(ServletContextEvent event) {

    log.info("Finalizing memory database plug in");

    if (database != null) {
      try {
        database.close();
      } catch (Exception e) {
        log.error("Closing memory database", e);
      }
    }

    context.removeAttribute(DATABASE_KEY);
    context.removeAttribute(PROTOCOLS_KEY);
    database = null;
    context = null;
  }
コード例 #7
0
  /**
   * Initialize and load our initial database from persistent storage.
   *
   * @param event The context initialization event
   */
  public void contextInitialized(ServletContextEvent event) {

    log.info("Initializing memory database plug in from '" + pathname + "'");

    // Remember our associated ServletContext
    this.context = event.getServletContext();

    // Construct a new database and make it available
    database = new MemoryUserDatabase();
    try {
      String path = calculatePath();
      if (log.isDebugEnabled()) {
        log.debug(" Loading database from '" + path + "'");
      }
      database.setPathname(path);
      database.open();
    } catch (Exception e) {
      log.error("Opening memory database", e);
      throw new IllegalStateException("Cannot load database from '" + pathname + "': " + e);
    }
    context.setAttribute(DATABASE_KEY, database);
  }
コード例 #8
0
ファイル: GETTEXT021.java プロジェクト: jamy888/AutoData
  public void safeExecute() throws ComException, Exception {
    HttpServletRequest request = ServletActionContext.getRequest();
    String mobilePay = request.getParameter("mobilePay");
    String active = request.getParameter("active");
    String abegDt = request.getParameter("abegDt");
    String aendDt = request.getParameter("aendDt");
    String begDt = request.getParameter("begDt");
    String endDt = request.getParameter("endDt");
    String[] rowNm = {"手机号码", "电子券余额", "到期时间"};
    String title = "电子券到期数据";
    String fileName = "未剔除未开通手机支付(活跃无限制)" + title;
    String nowDate = ComFunc.getLocalDate();
    String[] params = {"MOBILE", "SVC_BAL", "INVALID_DT"};

    // 支付活跃查询语句sql1
    String sql1 =
        "select SPO_NO as MOBILE "
            + " from TBL_APP_MOBPAY_ACCOUNT_DTL "
            + " where ACCOUNT_DT between '"
            + abegDt
            + "' and '"
            + aendDt
            + "' "
            + " AND ACCOUNT_TYPE = '100' "
            + " and REVERED_TRANS_LOG = 'N' "
            + " and REVERED_LOG = 'N' "
            + " and TRANS_TYPE IN ('01', '34', '02', '03', '05', '24', '25', '26') "
            + " and BUSSINESS_TYPE NOT in ('0801', '0701', '0019', '0119') "
            + " and BALOFPAY_FLAG in ('C', 'D') "
            + " union all "
            + " select MOBILE_NO  MOBILE "
            + "from TBL_APP_MARKETING_TOOL_USEDTL "
            + " where USE_MARK in ('1', '2') "
            + "  and PROD_TYPE = '0' "
            + " and TRANS_STA = 'S' "
            + " and ACCOUNT_DT between '"
            + abegDt
            + "' and '"
            + aendDt
            + "' "
            + " and BUSSINESS_ACCEPT_CHANNEL <> 'LPS' "
            + " group by MOBILE_NO, INNER_ORDER_NO, ORDER_AMT "
            + " having ORDER_AMT = sum(USE_AMT)";
    // 开通手机支付业务用户查询语句sql2
    String sql2 =
        "select distinct trim(PHONE_CD) MOBILE from TBL_APP_OPEN_CANCEL_DTL where (trim(CANCEL_DT) is null or CANCEL_DT > '"
            + nowDate
            + "') and ACCOUNT_TYPE = '100'";
    // 电子券到期sql3
    String sql =
        "select MOBILE,SVC_BAL,INVALID_DT from TBL_APP_MARKETING_TOOL_DTL where INVALID_DT between '"
            + begDt
            + "' and '"
            + endDt
            + "' and to_number(SVC_BAL) > 0 and MK_TYPE = '0' and SVC_STAT not in ('R', 'P', 'D', 'T','E')";

    if (active == "01" && mobilePay == "01") { // 有活跃sql1&&剔除未开通手机支付业务-sql2
      sql = sql + "and MOBILE in (" + sql1 + "minus" + sql2 + ")";
      fileName = "剔除未开通手机支付(有活跃)" + title;
    } else if (active == "02" && mobilePay == "01") { // 无活跃-sql1&&剔除未开通手机支付业务-sql2
      sql = sql + "and MOBILE not in (" + sql1 + "union all" + sql2 + ")";
      fileName = "剔除未开通手机支付(无活跃)" + title;
    } else if (active == "01" && mobilePay == "02") { // 有活跃sql1&&不剔除未开通手机支付业务sql2
      sql = sql + "and MOBILE in (" + sql1 + ")";
      fileName = "未剔除未开通手机支付(有活跃)" + title;
    } else if (active == "02" && mobilePay == "02") { // 无活跃-sql&&不剔除开通手机支付业务sql2
      sql = sql + "and MOBILE not in (" + sql1 + ")";
      fileName = "未剔除未开通手机支付(无活跃)" + title;
    } else if (active == "03" && mobilePay == "01") { // 活跃不限&&剔除开通手机支付业务sql2
      sql = sql + "and MOBILE in (" + sql2 + ")";
      fileName = "未剔除未开通手机支付(活跃无限制)" + title;
    } /*else if(active=="03"&&mobilePay=="02"){//活跃不限&&不剔除开通手机支付业务sql2
      	//sql=sql ;
      }*/
    logger.info(sql);

    CommonAction ca = new CommonAction();
    ca.comAction(fileName, sql, comTbldtlService, params, rowNm, title);
  }