source: binary-improvements/WebInterface/Web/API/WebAPI.cs@ 224

Last change on this file since 224 was 224, checked in by alloc, 10 years ago

A11 preps

File size: 578 bytes
RevLine 
[224]1using System;
2using System.Net;
3using System.Text;
4
5namespace AllocsFixes.NetConnections.Servers.Web.API
6{
7 public abstract class WebAPI
8 {
9 public void WriteJSON (HttpListenerResponse resp, JSON.JSONNode root)
10 {
11 byte[] buf = Encoding.UTF8.GetBytes (root.ToString());
12 resp.ContentLength64 = buf.Length;
13 resp.ContentType = "application/json";
14 resp.ContentEncoding = Encoding.UTF8;
15 resp.OutputStream.Write (buf, 0, buf.Length);
16 }
17
18 public abstract void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, HttpListenerBasicIdentity user);
19 }
20}
21
Note: See TracBrowser for help on using the repository browser.