Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.09 MB, 242 trang )
www.it-ebooks.info
REQUIRED and all of the SHOULD level requirements, is said to be “unconditionally
compliant.” One that satisfies all of the MUST level requirements but not all the
SHOULD level requirements is said to be “conditionally compliant.”
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in
this document are to be interpreted as described in RFC 2119.
Design Characteristics
Base Format
HTML
Domain Semantics
Specific (via Semantic Profile)
State Transfer
Ad hoc (via HTML FORMs)
Application Flow
Applied (via Semantic Profile)
H-Factors
LO, LE, LT, LN, CM, CL
Additional Constraints
• All resource representations MUST be valid HTML documents.
• Servers MAY require clients to support HTTP Authentication (BASIC or DIGEST)
for some requests.
• Servers MAY provide additional markup or features not covered in this profile, but
these additions MUST NOT contradict the semantics outlined here.
• Servers MAY supply code-on-demand elements with their resource representations
(JavaScript, CSS, XSLT, etc.), but servers SHOULD NOT assume clients will support them.
Semantic Profile
What follows is a list of HTML attributes and their possible values. Servers SHOULD
send resource representations that contain these values along with appropriate markup
and data. Servers are free to decide which elements are appropriate for each resource
representation. Servers are also free to determine which of the elements below are to
be supported.
200 | Appendix E: Microblogging HTML Semantic Profile
www.it-ebooks.info
Clients SHOULD be prepared to properly handle all of the attributes and elements
described here. Clients SHOULD also be prepared to provide state transfers (FORMs)
back to the server as indicated. Servers MAY provide additional semantics and clients
MAY support those additional semantics.
The phrase “designated user” means: 1) the currently authenticated (logged-in) user;
2) a user identified via other state information such as cookies; or 3) a user selected by
some other means such as following a link.
Class Attribute Values
The following class values MAY appear within the response representation:
all
Applied to a UL tag. A list representation. When this element is a descendant of
DIV.id="messages” it MAY have one or more LI.class="message” descendant elements. When this element is a descendant of DIV.id="users” it MAY have one or
more LI.class="user” descendant elements.
date-time
Applied to a SPAN tag. Contains the UTC date and time the message was posted.
When present, it SHOULD be valid per RFC 3339.
description
Applied to a SPAN tag. Contains the text description of a user.
friends
Applied to a UL tag. A list representation. When this element is a descendant of
DIV.id="messages” it contains the list of messages posted by the designated user’s
friends and MAY have one or more LI.class="message” descendant elements.
When this element is a descendant of DIV.id="users” it contains the list of users
who are the friends of the designated user and MAY have one or more
LI.class="user” descendant elements.
followers
Applied to a UL tag. A list representation of all of the users from the designated
user’s friends list. MAY have one or more LI.class="user” descendant elements.
me
Applied to a UL tag. When this element is a descendant of DIV.id="messages” it
contains the list of messages posted by the designated user and MAY have one or
more LI.class="message” descendant elements. When this element is a descendant
of DIV.id="users” it SHOULD contain a single descendant LI.class="user” with
the designated user’s profile.
Semantic Profile | 201
www.it-ebooks.info
mentions
Applied to a UL tag. A list representation of all of the messages that mention the
designated user. It MAY contain one or more LI.class="message" descendant elements.
message
Applied to an LI tag. A representation of a single message. It SHOULD contain the
following descendant elements:
SPAN.class="user-text"
A.rel="user"
SPAN.class="message-text"
A.rel="message"
It MAY also contain the following descendant elements:
IMG.class="avatar"
SPAN.class="date-time"
message-post
Applied to a FORM tag. A link template to add a new message to the system by
the designated, or logged-in, user. The element MUST be set to
FORM.method="post" and SHOULD contain a descendant element:
TEXTAREA.name="message"
message-reply
Applied to a FORM tag. A link template to reply to an existing message. The element MUST be set to FORM.method="post" and SHOULD contain the following
descendant elements:
INPUT[hidden].name="user" (the author of the original post)
TEXTAREA.name="message"
single
When this element is a descendant of DIV.id="messages" it contains the message
selected via a message link. SHOULD have a single LI.class="message" descendant
element. When this element is a descendant of DIV.id="users" it contains the user
selected via a user link. SHOULD have a single LI.class="user" descendant element.
messages-search
Applied to a FORM tag. A link template to search all of the messages. The element
MUST be set to FORM.method="get" and SHOULD contain the following descendant elements:
INPUT[text].name="search"
message-text
Applied to a SPAN tag. The text of a message posted by a user.
202 | Appendix E: Microblogging HTML Semantic Profile
www.it-ebooks.info
search
Applied to a UL tag. A list representation. When this element is a descendant of
DIV.id="messages" it contains a list of messages and MAY have one or more
LI.class="message" descendant elements. When this element is a descendant of
DIV.id="users" it contains a list of users and MAY have one or more LI.class="user"
descendant elements.
shares
Applied to a UL tag. A list representation of all the messages posted by the designated user that were shared by other users. It MAY contain one or more
LI.class="message" descendant elements.
user
Applied to an LI tag. A representation of a single user. It SHOULD contain the
following descendant elements:
SPAN.class="user-text"
A.rel="user"
A.rel="messages"
It MAY also contain the following descendant elements:
SPAN.class="description"
IMG.class="avatar"
A.rel="website"
user-add
Applied to a FORM tag. A link template to create a new user profile. The element
MUST be set to FORM.method="post" and SHOULD contain the following descendant elements:
INPUT[text].name="user"
INPUT[text].name="email"
INPUT[password].name="password"
It MAY also contain the following descendant elements:
TEXTAREA.name="description"
INPUT[file].name="avatar"
INPUT[text].name="website"
user-follow
Applied to a FORM tag. A link template to add a user to the designated user’s
friend list. The element MUST be set to FORM.method="post" and SHOULD
contain the descendant element:
INPUT[text].name="user"
avatar
Applied to an IMG tag. A reference to an image of the designated user.
Semantic Profile | 203
www.it-ebooks.info
user-text
Applied to a SPAN tag. The user nickname text.
user-update
Applied to a FORM tag. A link template to update the designated user’s profile.
The element MUST be set to FORM.method="post" and SHOULD contain the
following descendant elements:
INPUT[hidden].name="user"
INPUT[hidden].name="email"
INPUT[password].name="password"
It MAY also contain the following descendant elements:
TEXTAREA.name="description"
INPUT[file].name="avatar"
INPUT[text].name="website"
users-search
Applied to a FORM tag. A link template to search all of the users. The element
MUST be set to FORM.method="get" and SHOULD contain the descendant element:
INPUT[text].name="search"
ID Attribute Values
The following id values SHOULD appear within response representations:
messages
Applied to a DIV tag. The list of messages in this representation. MAY have one
or more of the following descendant elements:
UL.class="all"
UL.class="friends"
UL.class="me"
UL.class="mentions"
UL.class="search"
UL.class="shares"
UL.class="single"
queries
Applied to a DIV tag. The list of valid queries in this representation. MAY have
one or more FORM and/or A descendant elements (see “rel” and “class” section
for details).
users
Applied to a DIV tag. The list of users in this representation. MAY have one or
more of the following descendant elements:
204 | Appendix E: Microblogging HTML Semantic Profile
www.it-ebooks.info
UL.class="all"
UL.class="friends"
UL.class="followers"
UL.class="me"
UL.class="search"
UL.class="single"
Name Attribute Values
The following name values MAY appear within response representations:
description
Applied to a TEXTAREA element. The description of the user.
email
Applied to an INPUT[text] or INPUT[hidden] element. The email address of a
user. When supplied, it SHOULD be valid per RFC 5322.
message
Applied to a TEXTAREA element. The message to post (for the designated user).
name
Applied to an INPUT[text] element. The full name of a user.
password
Applied to an INPUT[password] element. The password of the user login.
search
Applied to an INPUT[text]. The search value to use when searching messages
(when applied to FORM.class="message-search") or when searching users (when
applied to FORM.class="users-search").
user
Applied to an INPUT[text] or INPUT[hidden] element. The public nickname of a
user.
avatar
Applied to an INPUT[file] element. The image for the user.
website
Applied to an INPUT[text]. The URL of a website associated with the user profile.
When supplied, it SHOULD be valid per RFC 3986.
Rel Attribute Values
The following rel values MAY appear within response representations.
first
Applied to an A tag. A reference to the first page in a list of data (messages, users).
Semantic Profile | 205
www.it-ebooks.info
index
Applied to an A tag. A reference to the starting URI for the application.
last
Applied to an A tag. A reference to the last page in a list of data (messages, users).
message
Applied to an A tag. A reference to a message representation.
message-post
Applied to an A tag. A reference to the message-post FORM.
message-reply
Applied to an A tag. A reference to the message-reply FORM.
message-share
Applied to an A tag. A reference to the message-share FORM.
messages-all
Applied to an A tag. A reference to a list representation of all the messages in the
system.
messages-friends
Applied to an A tag. A reference to a list representation of all the messages from
the designated user’s friends list.
messages-me
Applied to an A tag. A reference to a list representation of all the messages posted
by the designated user.
messages-mentions
Applied to an A tag. A reference to a list representation of all the messages that
mention the designated user.
messages-shares
Applied to an A tag. A reference to a list representation of all the messages posted
by the designated user that were shared by other users.
messages-search
Applied to an A tag. A reference to the messages-search FORM.
next
Applied to an A tag. A reference to the next page in a list of data (messages, users).
previous
Applied to an A tag. A reference to the previous page in a list of data (messages,
users).
self
Applied to an A tag. A reference to the currently loaded resource representation.
user
Applied to an A tag. A reference to a user representation.
206 | Appendix E: Microblogging HTML Semantic Profile
www.it-ebooks.info
user-add
Applied to an A tag. A reference to the user-add FORM.
user-follow
Applied to an A tag. A reference to the user-follow FORM.
user-me
Applied to an A tag. A reference to the designated user’s representation.
user-update
Applied to an A tag. A reference to the user-update FORM.
users-all
Applied to an A tag. A reference to a list representation of all the users in the system.
users-friends
Applied to an A tag. A reference to list representation of the designated user’s friend
users.
users-followers
Applied to an A tag. A reference to list representation of the users who follow the
designated user.
users-search
Applied to an A tag. A reference to the users-search FORM.
website
Applied to an A tag. A reference to the website associated with a user.
Semantic Profile | 207
www.it-ebooks.info
www.it-ebooks.info
APPENDIX F
IANA Media Type Registration
Document
Below is a completed Internet Assigned Numbers Authority (IANA) media type registration document. This is the result of registering a media type using the IANA’s “Application for Media Types” online form (found at http://www.iana.org/cgi-bin/medi
atypes.pl). This results in the official registration of the application/vnd.amundsen.maze
+xml media type.
The most recent version of this document can be found online at http://www.iana.org/
assignments/media-types/application/vnd.amundsen.maze+xml.
(last updated 2011-02-01)
Name : Mike Amundsen
Email : mca&amundsen.com
MIME media type name : Application
MIME subtype name : Vendor Tree - vnd.amundsen.maze+xml
Required parameters : none
Optional parameters :
charset
This parameter has identical semantics to the charset parameter of
the "application/xml" media type as specified in RFC 3023.
Encoding considerations : binary
Same as encoding considerations of application/xml as specified in RFC 3023.
Security considerations :
Maze+XML shares security issues common to all XML content types. It does
not provide executable content. Information contained in Maze+XML
documents do not require privacy or integrity services.
209
www.it-ebooks.info
Interoperability considerations :
Maze+XML is not described by a DTD and applies only the well-formedness
rules of XML. It should only be parsed by a non-validating parser.
Published specification :
http://amundsen.com/media-types/maze/
Applications which use this media :
Various
Additional information :
1.
2.
3.
4.
Magic number(s) : none
File extension(s) : .xml
Macintosh file type code : TEXT
Object Identifiers: none
Person to contact for further information :
1. Name : Mike Amundsen
2. Email : mca&amunndsen.com
Intended usage : Common
The Maze+XML media type is an XML data format for sharing maze state
information between clients and servers. It can be used to implement
simple mazes, adventure games, and other related data.
Author/Change controller : Mike Amundsen
(file created 2011-02-01)
210 | Appendix F: IANA Media Type Registration Document