Exemplo n.º 1
0
        public override void Process(Bamboo.WebServer.HttpRequest request, Bamboo.WebServer.HttpResponse response)
        {
            try
            {
                this._processor.Process(request, response);
            }
            catch (System.Exception exception)
            {
                response.Reset();

                Error(exception);

                response.Status = 500;
                response.Headers.Add("Content-Type", "text/plain");

                response.WriteLine(exception.Message);
                response.WriteLine("");
                response.WriteLine(exception.StackTrace);

                while (exception.InnerException != null)
                {
                    response.WriteLine("");
                    response.WriteLine("");
                    response.WriteLine("");

                    exception = exception.InnerException;

                    response.WriteLine(exception.Message);
                    response.WriteLine("");
                    response.WriteLine(exception.StackTrace);
                }
            }
        }
Exemplo n.º 2
0
        public override void Process(Bamboo.WebServer.HttpRequest request, Bamboo.WebServer.HttpResponse response)
        {
            //TODO check containskey instead.
            HttpProcessor processor = (HttpProcessor)this._processors[request.Path];

            if (processor != null)
            {
                processor.Process(request, response);
                return;
            }
            else if (this._defaultProcessor != null)
            {
                this._defaultProcessor.Process(request, response);
                return;
            }
            else
            {
                response.Reset();

                response.Status = 404;
                response.Headers.Add("Content-Type", "text/plain");
                response.WriteLine("Page not found.");
            }
        }