3using System.Threading.Tasks;
18 : base(
"/.well-known/host-meta.json")
22 public override bool HandlesSubPaths =>
false;
23 public override bool UserSessions =>
false;
33 if (
string.IsNullOrEmpty(ContentType))
37 StringBuilder Json =
new StringBuilder();
41 Json.Append(
"{\"links\": [");
43 if (HttpsPorts.Length > 0 || HttpPorts.Length > 0)
45 this.AppendLink(Json, HttpsPorts, HttpPorts,
"urn:xmpp:alt-connections:xbosh",
"http",
"/http-bind");
46 this.AppendLink(Json, HttpsPorts, HttpPorts,
"urn:xmpp:alt-connections:websocket",
"ws",
"/xmpp-websocket");
51 Response.ContentType = ContentType;
52 return Response.
Write(Json.ToString());
55 private void AppendLink(StringBuilder Json,
int[] HttpsPorts,
int[] HttpPorts,
56 string Type,
string Protocol,
string Resource)
58 Json.Append(
"{\"rel\":\"");
60 Json.Append(
"\", \"href\":\"");
61 Json.Append(Protocol);
63 if (HttpsPorts.Length > 0)
71 Json.Append(HttpsPorts[0].ToString());
82 Json.Append(HttpPorts[0].ToString());
86 Json.Append(Resource);
const string DefaultContentType
application/json
static readonly string[] JsonContentTypes
JSON content types.
Static class managing the runtime environment of the IoT Gateway.
static CaseInsensitiveString Domain
Domain name.
static int[] GetConfigPorts(string Protocol)
Gets the port numbers defined for a given protocol in the configuration file.
Represents an HTTP request.
HttpRequestHeader Header
Request header.
Represets a response of an HTTP client request.
async Task Write(byte[] Data)
Returns binary data in the response.
Implements an HTTP server.
const int DefaultHttpPort
Default HTTP Port (80).
const int DefaultHttpsPort
Default HTTPS port (443).
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
The resource identified by the request is only capable of generating response entities which have con...
GET Interface for HTTP resources.