Beispiel #1
0
        Result IPage.Get(Request request)
        {
            Result r = new Result();

            r.Body = file;

            return r;
        }
Beispiel #2
0
 Result IPage.Post(Request request)
 {
     return generator.Post(request);
 }
Beispiel #3
0
 Result IPage.Get(Request request)
 {
     return generator.Get(request);
 }
Beispiel #4
0
        private static void OnRequest(Request r, HTTPConnection.RequestCompleteHandler callback)
        {
            IPage p;
            if (! pages.TryGetValue(r.URI, out p))
            {
                p = specials[HTTPCode.NotFound];
                callback(p.Get(r));
            }

            var res = p.Get(r);
            if (res.Keep_Alive == null)
            {
                res.Keep_Alive = r.Keep_Alive; // Unless the page specifically accepted or denied keeping the connection open, go with what the client asked.
            }

            foreach (var c in res.cookies)
            {
                if (c.Path == null)
                {
                    c.Path = p.GetPath(); // Set the cookie's path if it wasn't specified.
                }
                CookieManager.AddCookie(c);
            }

            callback(res);
        }
Beispiel #5
0
 public override HTMLComponent Get(Request request)
 {
     return new TextComponent(Encoding.UTF8.GetString(File.ReadAllBytes(Path)));
 }
Beispiel #6
0
        private static void OnRequest(Request r, HTTPConnection.RequestCompleteHandler callback)
        {
            Page p;
            if (! pages.TryGetValue(r.URI, out p))
            {
                p = specials[HTTPCode.NotFound];
            }

            callback(p.Get(r));
        }
Beispiel #7
0
 Result IPage.Post(Request request)
 {
     return null;
 }