Object -
websub
:
Notification
Represents the WebSub Content Delivery Request received.
Methods
Retrieves the query parameters of the content delivery request as a map.
Retrieves the mime:Entity
associated with the content delivery request.
Returns whether the requested header key exists in the header map of the content delivery request.
Returns the value of the specified header.
Retrieves all the header values to which the specified header key maps to.
Retrieves all the names of the headers present in the content delivery request.
Retrieves the type of the payload of the content delivery request (i.
Extracts json
payload from the content delivery request.
Extracts xml
payload from the content delivery request.
Extracts text
payload from the content delivery request.
Retrieves the request payload as a ByteChannel
except in the case of multiparts.
Retrieves the request payload as a byte[]
.
Retrieves the form parameters from the content delivery request as a map
.
Retrieves the query parameters of the content delivery request as a map.
map<string[]> payload = notification.getTextPayload();
-
Return Type
(map<string[]>) String-constrained array map of the query params
Retrieves the mime:Entity
associated with the content delivery request.
mime:Entity|error payload = notification.getEntity();
-
Return Type
(Entity | error) The
mime:Entity
of the request or else anerror
if entity construction fails
Returns whether the requested header key exists in the header map of the content delivery request.
boolean payload = notification.hasHeader("name");
Parameters
- headerName string
-
The header name
-
Return Type
(boolean) true
if the specified header key exists or elsefalse
Returns the value of the specified header. If the specified header key maps to multiple values, the first of these values is returned.
string payload = notification.getHeader("name");
Parameters
- headerName string
-
The header name
-
Return Type
(string) The first header value for the specified header name or else panic if no header is found. Ideally, the
Notification.hasHeader()
needs to be used to check the existence of a header initially.
Retrieves all the header values to which the specified header key maps to.
string[] headersNames = notification.getHeaders("name");
Parameters
- headerName string
-
The header name
-
Return Type
(string[]) The header values the specified header key maps to or else panic if no header is found. Ideally, the
Notification.hasHeader()
needs to be used to check the existence of a header initially.
Retrieves all the names of the headers present in the content delivery request.
string[] headersNames = notification.getHeaderNames();
-
Return Type
(string[]) An array of all the header names
Retrieves the type of the payload of the content delivery request (i.e: the content-type
header value).
string contentType = notification.getContentType();
-
Return Type
(string) The
content-type
header value as astring
Extracts json
payload from the content delivery request.
json|error payload = notification.getJsonPayload();
-
Return Type
(json | error) The
json
payload or else anerror
in case of errors. If the content; type is not JSON, anerror
is returned.
Extracts xml
payload from the content delivery request.
xml|error result = notification.getXmlPayload();
-
Return Type
(xml | error) The
xml
payload or else anerror
in case of errors. If the content; type is not XML, anerror
is returned.
Extracts text
payload from the content delivery request.
string|error result = notification.getTextPayload();
-
Return Type
(string | error) The payload as a
text
or else anerror
in case of errors. If the content type is not of type text, anerror
is returned.
Retrieves the request payload as a ByteChannel
except in the case of multiparts.
io:ReadableByteChannel|error result = notification.getByteChannel();
-
Return Type
(ReadableByteChannel | error) A byte channel from which the message payload can be read or esle an
error
in case of errors
Retrieves the request payload as a byte[]
.
byte[]|error payload = notification.getBinaryPayload();
-
Return Type
(byte[] | error) The message payload as a
byte[]
or else anerror
in case of errors