123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- package com.kingdee.customer.Auth.handler;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.util.Properties;
- import com.kingdee.bos.BOSException;
- import org.apache.commons.configuration.ConfigurationException;
- import org.apache.commons.configuration.PropertiesConfiguration;
- import org.apache.log4j.Logger;
- /**
- * @author dengzhouhong
- * @version 1.0.0
- * @ClassName ConfigAddressServletUtil.java
- * @Description TODO
- * @createTime 2024年04月29日 10:25
- */
- public class ConfigAddressServletUtil {
- private static Logger logger =
- Logger.getLogger(ConfigAddressServletUtil.class);
- static Properties prop = null;
- /**
- * 获取登陆邮箱信息
- * @param
- * @return
- * @throws IOException
- * @throws ConfigurationException
- * @throws BOSException
- */
- public static void getProperties()
- {
- String configFilePath= System.getProperty("eas.properties.dir")+ "/adSsoConfig.properties";
- logger.info("配置文件路径:"+configFilePath);
- System.out.println("配置文件路径:"+configFilePath);
- File configFile = new File(configFilePath);
- prop = new Properties();
- FileInputStream fin = null;
- try
- {
- //createPropertiesFileIfNotExist(configFile);
- fin = new FileInputStream(configFile);
- PropertiesConfiguration config = new PropertiesConfiguration();
- config.load(fin, "UTF-8");
- prop.setProperty("authUrl", config.getString("authUrl"));
- prop.setProperty("tokenUrl", config.getString("tokenUrl"));
- prop.setProperty("refreshTokenUrl", config.getString("refreshTokenUrl"));
- prop.setProperty("client_id", config.getString("client_id"));
- prop.setProperty("client_secret", config.getString("client_secret"));
- prop.setProperty("url", config.getString("shrUrl"));
- prop.setProperty("userUrl", config.getString("userUrl"));
- prop.setProperty("dataCenter", config.getString("dataCenter"));
- prop.setProperty("locale", config.getString("locale"));
- prop.setProperty("mobileEid", config.getString("mobileEid"));
- }
- catch (FileNotFoundException e) {
- logger.error("ConfigAddressUtil.....FileNotFoundException ",e);
- } catch (IOException e) {
- logger.error("ConfigAddressUtil.....IOException ",e);
- } catch (ConfigurationException e) {
- logger.error("ConfigAddressUtil.....ConfigurationException ",e);
- } finally {
- try {
- fin.close();
- } catch (IOException e) {
- logger.error("ConfigAddressUtil.....IOException ",e);
- }
- }
- }
- public static String getProperty(String fileName) {
- getProperties();
- return prop.getProperty(fileName);
- }
- }
|