HTTP服务器软件系统的设计与实现(11)_毕业论文

毕业论文移动版

毕业论文 > 计算机论文 >

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



        /// <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(); (责任编辑:qin)