using System;
using System.Collections.Generic;
using System.Web;
using Pullenti.Npa.Documentory;

namespace Pullenti.Documentory.WebServer
{
    /// <summary>
    /// Summary description for Rest1
    /// </summary>
    public class Rest : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            try
            {
                if (MvcApplication.Doc == null) return;
                if (MvcApplication.Status != ServerStatus.Ok) return;
                ProcessRequestWrapper prw = new ProcessRequestWrapper(MvcApplication.Doc, context);
                prw.Process();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}