public void GetRoute(HttpContext context, string id) { RoutingEntryWrapper entry = null; foreach (RoutingEntry re in Service.RoutingEngine.RoutingEntries.Values) { if (re.Identifier.ToLower().CompareTo(id.ToLower()) == 0) { entry = new RoutingEntryWrapper(); entry.Nested = re; } } if (entry == null) { context.Response.Status = HttpStatus.NotFound; return; } string json = Serialize(entry); if (json != null) { context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; } else { context.Response.Status = HttpStatus.InternalServerError; } }
public void TestRoute(HttpContext context) { string payload = context.Request.Payload.ReadAll(); PathWrapper path = Deserialize <PathWrapper>(payload); if (path == null) { context.Response.Status = HttpStatus.BadRequest; return; } RoutingEntry re = Service.RoutingEngine.GetEntry(path.Method + path.Path); RoutingEntriesWrapper entries = new RoutingEntriesWrapper(); if (re != null) { RoutingEntryWrapper entry = new RoutingEntryWrapper(); entry.Nested = re; entries.RoutingEntries.Add(entry); } string json = Serialize(entries); if (json != null) { context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; } else { context.Response.Status = HttpStatus.InternalServerError; } }
public void GetRoutes(HttpContext context) { RoutingEntriesWrapper entries = new RoutingEntriesWrapper(); foreach (RoutingEntry re in Service.RoutingEngine.RoutingEntries.Values) { RoutingEntryWrapper entry = new RoutingEntryWrapper(); entry.Nested = re; entries.RoutingEntries.Add(entry); } string json = Serialize(entries); if (json != null) { context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; } else { context.Response.Status = HttpStatus.InternalServerError; } }