Example #1
0
 //解析JSON
 public static DoubleCallAppRequest ParseJson(String body)
 {
     try{
         DoubleCallAppRequest req = Newtonsoft.Json.JsonConvert.DeserializeObject <DoubleCallAppRequest> (body);
         return(req);
     }
     catch (Exception ex) {
         Logger.Fatal("ParseJson", "ParseDoubleCallAppRequest", ex.Message);
         return(null);
     }
 }
Example #2
0
 public DoubleCallApp(HttpListenerContext ctx, String appname) : base(ctx, appname)
 {
     req = null;
     if (ctx.Request.HttpMethod.Equals("POST"))
     {
         String   body         = new StreamReader(ctx.Request.InputStream, ctx.Request.ContentEncoding).ReadToEnd();
         String[] namekeypairs = body.Split('&');
         req = new DoubleCallAppRequest((namekeypairs [0].Split('=')) [1], (namekeypairs [1].Split('=')) [1]);
     }
     if (ctx.Request.HttpMethod.Equals("GET"))
     {
         if (ctx.Request.QueryString ["caller_number"] != null &&
             ctx.Request.QueryString ["called_number"] != null)
         {
             req = new DoubleCallAppRequest(ctx.Request.QueryString ["caller_number"], ctx.Request.QueryString ["called_number"]);
         }
     }
 }