示例#1
0
        /// <summary>
        /// 发送项目起始界面
        /// </summary>
        public void SendProjectStartFile(Client client, string httpVersion, string realPath, string rootPath)
        {
            XmlHelper xmlHelper = new XmlHelper();
            XmlNode node = xmlHelper.GetServerContext(rootPath + "\\conf\\server.xml");
            string docBase = node.Attributes["docBase"].Value;
            string file = node.Attributes["default"].Value;

            string path = rootPath + "\\webapps";

            string temp = rootPath + "\\webapps" + Init.Instance.DocBase;
            DirectoryInfo dirInfo1 = new DirectoryInfo(temp);
            DirectoryInfo dirInfo2 = new DirectoryInfo(realPath);
            if (dirInfo1.Exists && dirInfo2.Exists)
            {
                if (dirInfo1.FullName == dirInfo2.FullName || dirInfo1.Parent.FullName == dirInfo2.FullName)
                {
                    path += docBase;
                }
                else
                {
                    path += "\\ROOT";
                }
            }
            else
            {
                path += "\\ROOT";
            }
            if (!string.IsNullOrEmpty(file))
            {
                path += "\\" + file;
            }
            else
            {
                path += "\\index.html";
            }
            FileManager fileManager = new FileManager();
            fileManager.SendFileToBroswer(client, httpVersion, "text/html", path, rootPath);
        }
示例#2
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            HandlerBusinuess hb = new HandlerBusinuess();

            string rootPath = GetRootPath();
            XmlHelper xmlHelper = new XmlHelper();
            XmlNode node = xmlHelper.GetServerContext(rootPath + "\\conf\\server.xml");
            string docBase = node.Attributes["docBase"].Value;
            string file = node.Attributes["default"].Value;
            Init.Instance.DocBase = docBase;
        }