| Name: | data: scheme | | Description: | defines identifiers which contain an inline SOURCE representation | | Id: | layer1.DataScheme | | Category: | accessor |
Identifier Syntaxdata: scheme is an accessor using a
standard identifier grammar:
<grammar> <group> <group>data: <group min="0"> <group name="mimetype"> <regex type="nmtoken" />/ <regex type="nmtoken" /> </group> <group min="0">;charset= <group name="charset"> <regex type="nmtoken" /> </group> </group> </group> <group min="0" name="encoding">;base64</group>, <group name="data"> <regex type="anything" /> </group> </group> </group> </grammar>
with the following arguments: (for more details on argument passing details see here)
| Argument | Rules | Typing | Description | | mimetype | | String (unknown) | (no description available) | | charset | | String (nmtoken) | (no description available) | | encoding | | String (unknown) | (no description available) | | data | | String (anything) | (no description available) |
Request VerbsThe following
verbs are supported:
Response
The following response representations can be returned for SOURCE requests:
This accessor throws no documented exceptions.Import RequirementsTo use data: scheme accessor you must import the module
urn:org:netkernel:ext:layer1:
<import> <uri>urn:org:netkernel:ext:layer1</uri> </import>
|
The data: scheme supports the IETF RFC2397 specification for in-line data
within a URI.
Syntax
The syntax for the scheme is:
For example, the following embeds a picture of a small red dot:
data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==
and the following:
data:text/html;base64,PGh0bWw+PGJvZHk+PHA+aGk8L3A+PC9ib2R5PjwvaHRtbD4=
embeds the following HTML:
<html>
<body>
<p>hi</p>
</body>
</html>
SOURCE
When a request with the SOURCE verb is issued for a
representation encoded with the data: scheme, the value
of the information is returned as a
org.netkernel.layer0.representation.IReadableBinaryStreamRepresentation.
Example
In the following example the contents of the variable text
will be set to "this is data":
request = context.createRequest("data:text/plain,this%20is%20data");
request.setRepresentationClass(String.class);
text = context.issueRequest(request);EXISTS
When a request with the EXISTS verb is issued a test is made to see if
the data exists.
The response contains a boolean value of either true or false
indicating if the file or directory exists or not.
Example
In the following example the data: scheme is queried for the existence of a representation:
request = context.createRequest("data:text/html;base64,PGh0bWw+PGJvZHk+PHA+aGk8L3A+PC9ib2R5PjwvaHRtbD4=");
request.setVerb(INKFRequestReadOnly.VERB_EXISTS);
request.setRepresentationClass(Boolean.class);
dataAvailable = context.issueRequest(request);