/
850.txt
200 lines (156 loc) · 8.22 KB
/
850.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
[1]
>
:[DFN[[RUBYB[成員]@en[member]]]] (または [DFN[[RUBYB[成員資源]@en[member resource]]]]):
[[IRI]] が[[集成]]中に [CODE(XMLe)@en[atom:[[link]]]] [[要素]]で[[関係]]
[CODE(XML)@en[[[edit]]]] または [CODE(XMLe)@en[[[edit-media]]]]
で列挙されている[[資源]]。9.1節参照。[[Atom Protocol]] は2種類の[[成員]]を定義しています。
- [[エントリー資源]]: [[RFC 4287]] に定義されている通り、 [[Atomエントリー文書]]で表現されている[[集成]]の[[成員]]。
- [[媒体資源]]: [[Atomエントリー文書]]以外の[[表現]]を持つ[[集成]]の[[資源]]。
仕様書:
-[CITE@en[RFC 5023 - The Atom Publishing Protocol]]
-- <http://tools.ietf.org/html/rfc5023#section-3>
--<http://tools.ietf.org/html/rfc5023#section-4.2>
--<http://tools.ietf.org/html/rfc5023#section-9.1>
* メンバー URI
[201] [[クライアント]]は [DFN[[RUBYB[メンバー]@en[Member]] URI]] を使って[[成員資源]]を[[取り出し]]、
[[編集]]、[[削除]]できます。[[成員URI]] は [CODE(HTTP)@en[[[POST]]]]
を使って[[資源]]を作成するのに成功した場合の [CODE(HTTP)@en[[[Location]]:]]
[[頭欄]]や、[[集成フィード]]中の[[エントリー]]の[[関係]] [CODE(XML)@en[[[edit]]]]
の [CODE(XMLe)@en[atom:[[link]]]] に現れます。
[SRC@en[[[AtomPub]]]]
[202] [[成員エントリー]]は[[リンク関係]]が [CODE(XML)@en[[[edit]]]]
であって[[成員URI]] を表す [CODE(XMLe)@en[atom:[[link]]]] を含む[['''べきです''']]。
[SRC@en[[[AtomPub]]]]
* 列挙
[2] [[集成]]の[[成員]]の列挙には[[集成]]に対して [CODE(HTTP)@en[[[GET]]]] [[要求]]を使います。
詳しくは[[集成フィード]]の項を参照してください。
* 取り出し
[3] [[成員資源]] (の[[表現]]) を[[取り出し]]するには、
[[クライアント]]は[[成員資源]]の [[URI]] について [CODE(HTTP)@en[[[GET]]]]
[[要求]]を送信します。[[鯖]]はそれに対して[[成員資源]]の[[表現]]を[[応答]]します。
[SRC@en[[[AtomPub]]]]
[208] 実装者は、[[キャッシュ制御]]や[[実体札]]などを適当に使うように注意するべきです。
[[キャッシュ]]が介在している場合には、 [CODE(HTTP)@en[[[GET]]]]
で得られた[[表現]]が最新のものとは限りません。
[SRC@en[[[AtomPub]]]]
[207] 仕様書:
-[CITE@en[RFC 5023 - The Atom Publishing Protocol]]
--<http://tools.ietf.org/html/rfc5023#section-5.4.1>
--<http://tools.ietf.org/html/rfc5023#section-9.5>
** 例
[209] [[AtomPub]] 仕様書より:
まず、 [CODE(HTTP)@en[[[POST]]]] で[[成員エントリー]]を作成します。
[PRE(HTTP example code)[
POST /myblog/entries HTTP/1.1
Host: example.org
Authorization: Basic ZGFmZnk6c2VjZXJldA==
Content-Type: application/atom+xml;type=entry
Content-Length: nnn
Slug: First Post
<?xml version="1.0" ?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>Atom-Powered Robots Run Amok</title>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2007-02-123T17:09:02Z</updated>
<author><name>Captain Lansing</name></author>
<content>It's something moving... solid metal</content>
</entry>
]PRE]
[[鯖]]は作成が成功したことを示す[[応答]]を返します。
[PRE(HTTP example code)[
HTTP/1.1 201 Created
Date: Fri, 23 Feb 2007 21:17:11 GMT
Content-Length: nnn
Content-Type: application/atom+xml;type=entry
Location: http://example.org/edit/first-post.atom
Content-Location: http://example.org/edit/first-post.atom
ETag: "e180ee84f0671b1"
<?xml version="1.0" ?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>Atom-Powered Robots Run Amok</title>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2007-02-123T17:09:02Z</updated>
<author><name>Captain Lansing</name></author>
<content>It's something moving... solid metal</content>
</entry>
]PRE]
[CODE(HTTP)@en[[[Location]]:]] と [CODE(HTTP)@en[[[Content-Location]]:]]
の値が[[一致]]しているので、この[[応答実体]]は作成された[[資源]]の[[表現]]そのものです。
[[応答実体]]には [CODE(HTTP)@en[[[ETag]]:]] も指定されていて、
この[[実体札]]を次に[[条件付[CODE(HTTP)@en[GET]]]] を行う場合に用いることができます。
[PRE(HTTP example code)[
GET /edit/first-post.atom HTTP/1.1
Host: example.org
Authorization: Basic ZGFmZnk6c2VjZXJldA==
If-None-Match: "e180ee84f0671b1"
]PRE]
[[エントリー]]が変更されていない場合には、 [CODE(HTTP)[[[304]]]] [[応答]]が返されます。
[PRE(HTTP example code)[
HTTP/1.1 304 Not Modified
Date: Sat, 24 Feb 2007 13:17:11 GMT
]PRE]
そうでない場合は[[エントリー]]が[[応答実体]]として返されます。
さて、[[クライアント]]が[[エントリー]]を変更し、それを
[CODE(HTTP)@en[[[PUT]]]] するとします。
[PRE(HTTP example code)[
PUT /edit/first-post.atom HTTP/1.1
Host: example.org
Authorization: Basic ZGFmZnk6c2VjZXJldA==
Content-Type: application/atom+xml;type=entry
Content-Length: nnn
If-Match: "e180ee84f0671b1"
<?xml version="1.0" ?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>Atom-Powered Robots Run Amok</title>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2007-02-24T16:34:06Z</updated>
<author><name>Captain Lansing</name></author>
<content>Update: it's a hoax!</content>
</entry>
]PRE]
ここで [CODE(HTTP)@en[[[If-Match]]:]] 欄に先程の[[実体札]]が指定されていますから、
[[鯖]]で[[エントリー]]が変更されていなければ [CODE(HTTP)@en[[[PUT]]]] により[[エントリー]]は更新されますが、
変更されている場合には [CODE(HTTP)[[[412]]]] [[応答]]が返されます。
[PRE(HTTP example code)[
HTTP/1.1 412 Precondition Failed
Date: Sat, 24 Feb 2007 16:34:11 GMT
]PRE]
* 編集
[4]
[[成員資源]] (の[[表現]]) を編集するには、[[クライアント]]は[[成員資源]]の [[URI]]
([[成員URI]]) について [CODE(HTTP)@en[[[PUT]]]] [[要求]]を、[[蓄積]]する[[表現]]と共に行います。
それに対して[[鯖]]は、[[要求]]が成功すれば[[状態符号]]
[CODE(HTTP)@en[[[200]]]] で[[応答]]します。
[SRC@en[[[AtomPub]]]]
[204]
[[クライアント]]は、意図せぬデータの損失を防ぐため、[[成員エントリー]]や[[成員リンク・エントリー]]の編集の際には[[外来マーク付け]]も含めて変更しようとしていない[[メタデータ]]をすべて保持する[['''べきです''']]
[SRC@en[[[AtomPub]]]]。
[203]
仕様書:
-[CITE@en[RFC 5023 - The Atom Publishing Protocol]]
-- <http://tools.ietf.org/html/rfc5023#section-5.4.2>
--<http://tools.ietf.org/html/rfc5023#section-9.3>
* 削除
[5]
[[成員資源]]を削除するには、[[クライアント]]は[[成員資源]]の [[URI]]
について [CODE(HTTP)@en[[[DELETE]]]] [[要求]]を送信します。
それに対して[[鯖]]は、[[要求]]が成功すれば[[状態符号]]
[CODE(HTTP)@en[[[200]]]] で[[応答]]します。
[SRC@en[[[AtomPub]]]]
[206] [[媒体リンク・エントリー]]を削除したら、
対応する[[媒体資源]]も削除される[['''べきです''']]。
[SRC@en[[[AtomPub]]]]
[205]
仕様書:
-[CITE@en[RFC 5023 - The Atom Publishing Protocol]]
-- <http://tools.ietf.org/html/rfc5023#section-5.4.3>
--<http://tools.ietf.org/html/rfc5023#section-9.4>
* 関連
[REFS[
- [413] [CITE@en-us[Ontology for Media Resources 1.0]]
( ([TIME[2012-02-07 07:39:04 +09:00]] 版))
<http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#media-resource>
]REFS]
[414] >>413 は「[[メンバー資源]]」という用語を定義しています。
[415] [[Web Linking]] には[[メンバー資源]]に相当するものを表す[[リンク関係型]] [CODE(HTTP)@en[[[item]]]]
があります。