4using System.Threading.Tasks;
23 public override bool HandlesSubPaths =>
true;
24 public override bool UserSessions =>
true;
29 if (
string.IsNullOrEmpty(Request.
SubPath))
32 int i = Request.
SubPath.IndexOf(
'/', 1);
33 string NodeName = HttpUtility.UrlDecode(i < 0 ? Request.
SubPath[1..] : Request.
SubPath[1..i]);
46 StringBuilder sb =
new StringBuilder();
50 sb.AppendLine(
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
51 sb.AppendLine(
"<rss version=\"2.0\">");
52 sb.AppendLine(
"<channel>");
55 sb.AppendLine(
"</title>");
58 sb.AppendLine(
"</link>");
59 sb.Append(
"<description>");
75 sb.AppendLine(
"</description>");
77 if (!
string.IsNullOrEmpty(Node.
Language))
79 sb.Append(
"<language>");
81 sb.AppendLine(
"</language>");
88 "-Service",
"-Node",
"-Created");
97 sb.Append(
"<pubDate>");
99 sb.AppendLine(
"</pubDate>");
102 sb.AppendLine(
"<item>");
103 sb.Append(
"<title>");
105 sb.AppendLine(
"</title>");
106 sb.Append(
"<author>");
108 sb.AppendLine(
"</author>");
109 sb.Append(
"<pubDate>");
111 sb.AppendLine(
"</pubDate>");
112 sb.AppendLine(
"<description>Published item</description>");
118 sb.AppendLine(
"</link>");
119 sb.Append(
"<guid isPermaLink=\"false\">");
121 sb.AppendLine(
"</guid>");
122 sb.AppendLine(
"</item>");
125 sb.AppendLine(
"</channel>");
126 sb.AppendLine(
"</rss>");
138 throw new NotFoundException(
"PubSub item `" + ItemId +
"` on node `" + NodeName +
"` not found.");
144 await Response.
Write(Xml);
Helps with parsing of commong data types.
static string EncodeRfc822(DateTime Timestamp)
Encodes a date and time, according to RFC 822 §5.
const string DefaultContentType
Default content type for XML documents.
Helps with common XML-related tasks.
static string Encode(string s)
Encodes a string for use in XML.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Represents an HTTP request.
HttpRequestHeader Header
Request header.
string SubPath
Sub-path. If a resource is found handling the request, this property contains the trailing sub-path o...
Represets a response of an HTTP client request.
Task Write(byte[] Data)
Returns binary data in the response.
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
The server has not found anything matching the Request-URI. No indication is given of whether the con...
Represents a case-insensitive string.
string Value
String-representation of the case-insensitive string. (Representation is case sensitive....
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
static bool IsNullOrEmpty(CaseInsensitiveString value)
Indicates whether the specified string is null or an CaseInsensitiveString.Empty string.
bool StartsWith(CaseInsensitiveString value)
Determines whether the beginning of this string instance matches the specified string.
CaseInsensitiveString Substring(int startIndex, int length)
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
Defines a published item.
CaseInsensitiveString Publisher
Publisher of content.
override string ToString()
object.ToString
string ObjectId
Object ID.
DateTime Created
When item was created.
DateTime Updated
When item was updated.
CaseInsensitiveString ItemId
Item ID.
Defines a node on which items can be published.
NodeAccessModel AccessModel
Who may subscribe and retrieve items
string[] Description
A description of the node
string Language
Default language of the node
string Title
A friendly name for the node
async Task GET(HttpRequest Request, HttpResponse Response)
Executes the GET method on the resource.
bool AllowsGET
If the GET method is allowed.
Service Module hosting the XMPP broker and its components.
GET Interface for HTTP resources.
NodeAccessModel
Node access model.