计算机网络课设报告,java平台实现,Java;HTTP;Web服务器
getConfig();
start();
}
public static void main(String[] args)
{
HttpServer httpserver = new HttpServer();
}
private void getConfig()
{
File fileCon=new File(Basic_Root,"config.ini");
File fileDir=new File(WEB_ROOT);
File fileWeb=new File(WEB_ROOT,"index.htm");
if(!fileCon.exists())
{
System.out.println("配置文件Config.ini损坏,重建中..."); reBuildConfig(fileCon);
}
if (!fileDir.exists())
{
System.out.println("网页存放文件夹不存在,重建中...");
fileDir.mkdir();
System.out.print("完成!请在");
System.out.println(WEB_ROOT+"中放置网页文件...");
System.out.println("Web服务器将重新初始化...");
getConfig();
}
if (!fileWeb.exists())
{
reBuildWeb(fileWeb);
}
Properties pps = new Properties();
try
{
pps.load(new FileInputStream("config.ini"));
Enumeration enumer = pps.propertyNames();
String strKey = (String) enumer.nextElement();
String strValue = pps.getProperty(strKey);
if (strValue.equals("") != true)
{
WEB_ROOT = strValue;
}
System.out.println("网页文件的存放路径为: "+WEB_ROOT);
strKey = (String) enumer.nextElement();
strValue = pps.getProperty(strKey);
if (strValue.equals("") != true)