public void ProcessRequest(HttpContext context)
        {
            try
            {
                var headers = DependencyInjector.GetObject <IHttpApplicationConfigurer>().GetReponseHeaders();
                foreach (var header in headers)
                {
                    context.Response.Headers.Add(header.Key, header.Value);
                }

                Request  = new RestServiceHttpRequest(context.Request, ServiceName, MethodName);
                Response = new RestServiceHttpResponse(context.Response);

                var container = DependencyInjector.GetContainer <HttpServerAssemblyContainer>();
                if (container == null)
                {
                    throw new Exception("http server container is null.");
                }

                Execute(container);
                Response.StatusCode = 200;
            }
            catch (Exception e)
            {
                DependencyInjector.GetObject <IFileLogger>().LogEvent("RestServiceHttpHandler", Severity.Error, "failed to process restservice request.", e);
                Response.Write("error occurs when processing request.", DataFormat.Text);
                Response.StatusCode = 500;
            }
        }
        public void Run()
        {
            DependencyInjector.GetContainer <BaseDirectoryAssemblyContainer>().RegisterAssemblies <DynamicProxyAssemblyInfo>();

            var result = -1;

            var childBananaClass = DependencyInjector.GetObject <IBananaInterface>();

            result = childBananaClass.F(1, 2);
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.IsWebSocketRequest)
            {
                try
                {
                    var container = DependencyInjector.GetContainer <HttpServerAssemblyContainer>();
                    if (container == null)
                    {
                        throw new Exception("http server container is null.");
                    }

                    var handler = GetExecutionHandler(container);
                    context.AcceptWebSocketRequest(handler.Process);
                }
                catch (Exception e)
                {
                    DependencyInjector.GetObject <IFileLogger>().LogEvent("RestServiceHttpHandler", Severity.Error, "failed to process websocket request.", e);
                }
            }
        }