コード例 #1
0
 internal void HandleRtmpt(HttpApplication httpApplication)
 {
     if (httpApplication.Request.ContentType == "application/x-fcs")
     {
         httpApplication.Response.Clear();
         httpApplication.Response.ContentType = "application/x-fcs";
         ILog logger = null;
         try
         {
             logger = LogManager.GetLogger(typeof(FluorineGateway));
             GlobalContext.get_Properties().set_Item("ClientIP", HttpContext.Current.Request.UserHostAddress);
         }
         catch
         {
         }
         if ((logger != null) && logger.get_IsDebugEnabled())
         {
             logger.Debug(__Res.GetString("Rtmpt_Begin"));
         }
         try
         {
             FluorineWebContext.Initialize();
             if (httpApplication.Request.Headers["RTMPT-command"] != null)
             {
                 logger.Debug(string.Format("ISAPI rewrite, original URL {0}", httpApplication.Request.Headers["RTMPT-command"]));
             }
             if (messageServer != null)
             {
                 messageServer.ServiceRtmpt();
             }
             else if (logger != null)
             {
                 logger.Fatal(__Res.GetString("MessageServer_AccessFail"));
             }
             if ((logger != null) && logger.get_IsDebugEnabled())
             {
                 logger.Debug(__Res.GetString("Rtmpt_End"));
             }
             httpApplication.CompleteRequest();
         }
         catch (Exception exception)
         {
             if (logger != null)
             {
                 logger.Fatal(__Res.GetString("Rtmpt_Fatal"), exception);
             }
             httpApplication.Response.Clear();
             httpApplication.Response.ClearHeaders();
             httpApplication.Response.Status = __Res.GetString("Rtmpt_Fatal404") + " " + exception.Message;
             httpApplication.CompleteRequest();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Processing of RTMPT HTTP Web requests.
        /// </summary>
        /// <param name="context">An HttpContext object that provides references to the intrinsic server objects used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            HttpApplication httpApplication = context.ApplicationInstance;

            if (httpApplication.Request.ContentType == ContentType.RTMPT)
            {
                httpApplication.Response.Clear();
                httpApplication.Response.ContentType = ContentType.RTMPT;

                //log4net.ThreadContext.Properties["ClientIP"] = System.Web.HttpContext.Current.Request.UserHostAddress;
                // NOTE TODO Common.Logging push ip into ClientIP variable
                if (log.IsDebugEnabled)
                {
                    log.Debug(__Res.GetString(__Res.Amf_Begin));
                }

                try
                {
                    //FluorineWebContext.Initialize();

                    MessageServer messageServer = GetMessageServer(context);
                    if (messageServer != null)
                    {
                        messageServer.ServiceRtmpt();
                    }
                    else
                    {
                        log.Fatal(__Res.GetString(__Res.MessageServer_AccessFail));
                    }

                    if (log.IsDebugEnabled)
                    {
                        log.Debug(__Res.GetString(__Res.Amf_End));
                    }

                    httpApplication.CompleteRequest();
                }
                catch (Exception ex)
                {
                    log.Fatal(__Res.GetString(__Res.Amf_Fatal), ex);
                    httpApplication.Response.Clear();
                    httpApplication.Response.ClearHeaders();
                    httpApplication.Response.Status = __Res.GetString(__Res.Amf_Fatal404) + " " + ex.Message;
                    httpApplication.CompleteRequest();
                }
            }
        }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            HttpApplication applicationInstance = context.ApplicationInstance;

            if (applicationInstance.Request.ContentType == "application/x-fcs")
            {
                applicationInstance.Response.Clear();
                applicationInstance.Response.ContentType = "application/x-fcs";
                GlobalContext.get_Properties().set_Item("ClientIP", HttpContext.Current.Request.UserHostAddress);
                if (log.get_IsDebugEnabled())
                {
                    log.Debug(__Res.GetString("Amf_Begin"));
                }
                try
                {
                    FluorineWebContext.Initialize();
                    MessageServer messageServer = this.GetMessageServer(context);
                    if (messageServer != null)
                    {
                        messageServer.ServiceRtmpt();
                    }
                    else
                    {
                        log.Fatal(__Res.GetString("MessageServer_AccessFail"));
                    }
                    if (log.get_IsDebugEnabled())
                    {
                        log.Debug(__Res.GetString("Amf_End"));
                    }
                    applicationInstance.CompleteRequest();
                }
                catch (Exception exception)
                {
                    log.Fatal(__Res.GetString("Amf_Fatal"), exception);
                    applicationInstance.Response.Clear();
                    applicationInstance.Response.ClearHeaders();
                    applicationInstance.Response.Status = __Res.GetString("Amf_Fatal404") + " " + exception.Message;
                    applicationInstance.CompleteRequest();
                }
            }
        }