毕业论文

打赏
当前位置: 毕业论文 > 计算机论文 >

HTTP服务器软件系统的设计与实现(11)

时间:2017-02-21 13:09来源:毕业论文
/// summary /// 其他场次派遣一个响应。 /// /summary /// param name=sender/param /// param name=e/param /// param name=req/param public void ShareApplicationOutput(ApplicationInstanceBase se



        /// <summary>
        /// 其他场次派遣一个响应。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="req"></param>
        public void ShareApplicationOutput(ApplicationInstanceBase sender, ApplicationResponse e, HttpRequest req)
        {
            //### 验证是否存在应用
            if (applications.ContainsKey(sender.Info.UniqueApplicationName))
            {
                //### 会话管理器cointains所有实例
                SessionManager session = applications[sender.Info.UniqueApplicationName];                
                foreach (var item in session.SessionList)
                {
                    //### 跳过发件人
                    if (item.Value.ApplicationId != sender.ApplicationId)
                    {
                        item.Value.OnNewShareResponse(sender, e, req);
                    }
                }
            }
        }

        /// <summary>
        /// 这种方法尝试找到一个资源在ResourceDirectory路径,并返回一个响应。
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ApplicationResponse ResponseStaticResource(HttpRequest request)
        {
            string resource = request.Path;
            ApplicationResponse output = null;
            if (resource[0] != '/') resource = "/" + resource;
            //获取资源的mime类型
            MimeType type = HttpHelper.GetResourceMime(resource);
            //检查是否启用Gzip压缩
            bool gzip = request.isGZIPSupported(); HTTP服务器软件系统的设计与实现(11):http://www.751com.cn/jisuanji/lunwen_3170.html
------分隔线----------------------------
推荐内容