📄 serverconfig.java
字号:
/*
* Created on 2004-7-3
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package Angel;
import java.io.InputStream;
import javax.servlet.http.HttpServletRequest;
import Base.ServletCtl.servlet;
import Base.Util.Configuration;
/**
* @author Zhang Kai
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ServerConfig {
public servlet m_servlet=null;
public HttpServletRequest m_request=null;
Base.Util.Configuration m_conf = null;
String m_configFile = "/WEB-INF/server-config.xml";
String strDBURL = null;
String strDBDriver = null;
String strDBUser = null;
String strDBPass = null;
String strMPCURL = null;
String strMapEngineURL = null;
String strMPCInterval = null;
public ServerConfig(servlet m_servlet, HttpServletRequest m_request) {
this.m_servlet = m_servlet;
this.m_request = m_request;
try {
loadMappingFile();
} catch (Exception e) {
m_servlet.log("server config :",e);
}
}
public void loadMappingFile() throws Exception
{
InputStream input = m_servlet.getServletContext().getResourceAsStream(
m_configFile);
if (input == null) {
m_servlet.log("not found config file'" + m_configFile + "'");
return;
}
m_servlet.log("config file path:" + m_servlet.getServletContext().getResource(m_configFile));
m_conf = new Configuration( input );
}
public String getByTagName(String tagName)
{
String value = m_conf.getValue("Server-config0." + tagName,0);
return value;
}
/**
* @return Returns the strDBDriver.
*/
public String getStrDBDriver() {
strDBDriver = getByTagName("DB0.Driver");
return strDBDriver;
}
/**
* @return Returns the strDBPass.
*/
public String getStrDBPass() {
strDBPass = getByTagName("DB0.Pass");
return strDBPass;
}
/**
* @return Returns the strDBURL.
*/
public String getStrDBURL() {
strDBURL = getByTagName("DB0.URL");
return strDBURL;
}
/**
* @return Returns the strDBUser.
*/
public String getStrDBUser() {
strDBUser = getByTagName("DB0.User");
return strDBUser;
}
/**
* @return Returns the strMapEngine.
*/
public String getStrMapEngineURL() {
strMapEngineURL = getByTagName("MapEngine0.URL");
return strMapEngineURL;
}
/**
* @return Returns the strMPCURL.
*/
public String getStrMPCInterval() {
strMPCURL = getByTagName("MPC0.Interval");
return strMPCURL;
}
/**
* @return Returns the strMPCURL.
*/
public String getStrMPCURL() {
strMPCURL = getByTagName("MPC0.URL");
return strMPCURL;
}
public static void main(String[] args) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -