Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
WhatsMyEndpointResource.cs
1using System;
2using System.Threading.Tasks;
5
7{
12 {
18 : base(ResourceName)
19 {
20 }
21
25 public override bool HandlesSubPaths => false;
26
30 public override bool UserSessions => false;
31
35 public bool AllowsGET => true;
36
43 public async Task GET(HttpRequest Request, HttpResponse Response)
44 {
45 Response.StatusCode = 200;
46 Response.ContentType = PlainTextCodec.DefaultContentType;
47 await Response.Write(Request.RemoteEndPoint);
48 await Response.SendResponse();
49 }
50
54 public bool AllowsPOST => true;
55
62 public Task POST(HttpRequest Request, HttpResponse Response)
63 {
64 return this.GET(Request, Response);
65 }
66
67 }
68}
Plain text encoder/decoder.
const string DefaultContentType
text/plain
Base class for all asynchronous HTTP resources. An asynchronous resource responds outside of the meth...
Represents an HTTP request.
Definition: HttpRequest.cs:18
string RemoteEndPoint
Remote end-point.
Definition: HttpRequest.cs:195
string ResourceName
Name of resource.
Represets a response of an HTTP client request.
Definition: HttpResponse.cs:21
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
async Task Write(byte[] Data)
Returns binary data in the response.
WhatsMyEndpointResource(string ResourceName)
Provides IP information about the caller.
Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
async Task GET(HttpRequest Request, HttpResponse Response)
Executes the GET method on the resource.
override bool HandlesSubPaths
If the resource handles sub-paths.
override bool UserSessions
If the resource uses user sessions.
GET Interface for HTTP resources.
POST Interface for HTTP resources.