Closed mwherman2000 closed 2 years ago
It turns out that
RootHttpHandler()
is overridable in the implementation class for your GE server, andprotocol
REST endpoint for.The implication is that by overriding RootHttpHandler()
, your GE server can support any custom URLs you need (e.g. http://localhost:8081/v2/swagger.json
). Here's the skeleton code you need in your GE server implementation class:
protected override void RootHttpHandler(HttpListenerContext ctx)
{
Debug.WriteLine("RootHttpHandler <<<<");
if (ctx.Request.RawUrl.ToLower() == "/v2/swagger.json")
{
using (StreamWriter streamWriter = new StreamWriter(ctx.Response.OutputStream))
{
streamWriter.WriteLine("<html><body><h3>TODO: Generate Swagger API Definition</h3></body></html>");
}
ctx.Response.StatusCode = 200;
}
else
{
base.RootHttpHandler(ctx);
}
}
Will update this as I make progress on the actual Swagger implementation.
The changes would need to take place somewhere near this method in the code-generated
HTTP.cs
file......and/or where this method is called in the same
HTTP.cs
file...