package com.megalith.support; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * * <p> * 项目常量定义 * </p> * * * * * * @version V1.0.0 * * @author * * @date 2013-7-10 上午11:36:34 * * @class com.support.Constants * */ public class Constants { /*---------------------- 默认分页参数 ---------------------*/ /** * 默认页数从0开始 */ public static Integer DEFAULT_PAGE; /** * 默认每页记录数 */ public static Integer DEFAULT_SIZE; /*----------------------Session key ----------------------*/ public static String SESSION_USER; public static String SESSION_USER_NAME; /*---------------------FileUpload fileds ----------------*/ public static Integer FILE_THRESHOLD_SIZE; public static String FILE_TEMP_PATH; public static Integer FILE_MAX_SIZE; public static String FILE_REAL_PATH; /*---------------------ResouceUpload Path ----------------*/ public static String ZIPPATH_UPLOAD;//默认资源文件zip包上传目录 public static String ZIPPATH_UNZIP;//默认资源文件解压后目录 public static String TEMPLATE_PATH;//默认模板文件上传后路径 Properties props = new Properties(); InputStream inputStream = null; public Constants() { try { inputStream = getClass().getResourceAsStream("/filed.properties"); props.load(inputStream); } catch (IOException e) { e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } FILE_TEMP_PATH = props.getProperty("file.tempPath"); FILE_THRESHOLD_SIZE = Integer.parseInt(props.getProperty("file.thresholdSize")); FILE_MAX_SIZE = Integer.parseInt(props.getProperty("file.maxSize")); FILE_REAL_PATH = props.getProperty("file.realPath"); DEFAULT_PAGE = Integer.parseInt(props.getProperty("DEFAULT_PAGE")); DEFAULT_SIZE = Integer.parseInt(props.getProperty("DEFAULT_SIZE")); SESSION_USER = props.getProperty("SESSION_USER"); SESSION_USER_NAME = props.getProperty("SESSION_USER_NAME"); ZIPPATH_UNZIP = props.getProperty("ZIPPATH_UNZIP"); ZIPPATH_UPLOAD = props.getProperty("ZIPPATH_UPLOAD"); TEMPLATE_PATH = props.getProperty("TEMPLATE_PATH"); } }
最近下载更多