Exemple #1
0
        public void Options(ConfigRequest request)
        {
            var resp = this.Response;
            resp.StatusCode = 200;
            resp.AddHeader("Access-Control-Allow-Origin", "*");
            resp.AddHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
            resp.AddHeader("Access-Control-Allow-Headers", "X-PINGOTHER, Content-Type");
            resp.AddHeader("Access-Control-Max-Age", "1728000");

            resp.End();
        }
Exemple #2
0
 public ConfigResponse Post(ConfigRequest request)
 {
     if (request.MainPart)
     {
         QueueService.ModProducer.broker.RegisterNewConfiguration(request.ConfigId, request.Body);
         //Console.Write("conf main part set: {0}", request.Body);
     }
     else if (request.ModulesPart)
     {
         //Console.Write("conf mod part set: {0}", request.Body);
     }
     else if (request.AssemblysPart)
     {
         QueueService.ModProducer.broker.RegisterNewConfiguration(request.ConfigId, request.Body);
         //Console.Write("conf mod part set: {0}", request.Body);
     }
     return new ConfigResponse()
     {
         Result = "OK", // OR SOME ERROR DESCRIPTION
         ConfigCommitID = request.ConfigId
     };
 }
Exemple #3
0
 public object Get(ConfigRequest request)
 {
     if (request.ChannelMTypeMap)
     {
         return //Newtonsoft.Json.JsonConvert.SerializeObject(
           QueueService.ModProducer.broker.GetCurrentChannelMTypeMap()
             //)
         ;
     }
     //Encoding enc = Encoding.UTF8;
     //// already in json
     //string conf = QueueService.ModProducer.broker.GetCurrentConfiguration(request.MainPart, request.ModulesPart, request.AssemblysPart, request.ConfigurationExtra);
     //byte[] jsonUtf8 = enc.GetBytes(conf);
     //return jsonUtf8;
     return QueueService.ModProducer.broker.GetCurrentConfiguration(request.MainPart, request.ModulesPart, request.AssemblysPart, request.ConfigurationExtra);
 }