Пример #1
0
        public WADOResponse Process(WADORequestTypeHandlerContext context)
        {
            //Validate(context.HttpContext.Request);

            ObjectStreamingHandlerFactory factory = new ObjectStreamingHandlerFactory();
            IObjectStreamingHandler       handler = factory.CreateHandler(context.HttpContext.Request);

            return(handler.Process(context));
        }
Пример #2
0
        private static void HandleRequest(HttpListenerContext context)
        {
            WADORequestProcessorStatistics statistics = new WADORequestProcessorStatistics("Image Streaming");

            statistics.TotalProcessTime.Start();

            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                //Don't hold up this thread for logging.
                Task.Factory.StartNew(() => LogRequest(context));
            }

            try
            {
                using (WADORequestTypeHandlerManager handlerManager = new WADORequestTypeHandlerManager())
                {
                    string requestType = context.Request.QueryString["requestType"];
                    IWADORequestTypeHandler typeHandler = handlerManager.GetHandler(requestType);

                    WADORequestTypeHandlerContext ctx = new WADORequestTypeHandlerContext
                    {
                        HttpContext = context,
                        ServerAE    = UriHelper.GetServerAE(context)
                    };

                    using (WADOResponse response = typeHandler.Process(ctx))
                    {
                        if (response != null)
                        {
                            statistics.TransmissionSpeed.Start();
                            SendWADOResponse(response, context);
                            statistics.TransmissionSpeed.End();
                            if (response.Output != null)
                            {
                                statistics.TransmissionSpeed.SetData(response.Output.Length);
                            }
                        }
                    }
                }
            }
            catch (MimeTypeProcessorError error)
            {
                SendError(error.HttpError, context);
            }

            statistics.TotalProcessTime.End();

            //Seems like something you'd only want to log if there was a problem.
            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                //Don't hold up this thread for logging.
                Task.Factory.StartNew(() => StatisticsLogger.Log(LogLevel.Debug, statistics));
            }
        }
Пример #3
0
        private static void HandleRequest(HttpListenerContext context)
        {
            WADORequestProcessorStatistics statistics = new WADORequestProcessorStatistics("Image Streaming");

            statistics.TotalProcessTime.Start();
            LogRequest(context);

            try
            {
                using (WADORequestTypeHandlerManager handlerManager = new WADORequestTypeHandlerManager())
                {
                    string requestType = context.Request.QueryString["requestType"];
                    IWADORequestTypeHandler typeHandler = handlerManager.GetHandler(requestType);

                    WADORequestTypeHandlerContext ctx = new WADORequestTypeHandlerContext
                    {
                        HttpContext = context,
                        ServerAE    = UriHelper.GetServerAE(context)
                    };

                    using (WADOResponse response = typeHandler.Process(ctx))
                    {
                        if (response != null)
                        {
                            statistics.TransmissionSpeed.Start();
                            SendWADOResponse(response, context);
                            statistics.TransmissionSpeed.End();
                            if (response.Output != null)
                            {
                                statistics.TransmissionSpeed.SetData(response.Output.Length);
                            }
                        }
                    }
                }
            }
            catch (MimeTypeProcessorError error)
            {
                SendError(error.HttpError, context);
            }

            statistics.TotalProcessTime.End();
            StatisticsLogger.Log(LogLevel.Debug, statistics);
        }