Content-Location ãããã¼
Baseline
åºãå©ç¨å¯è½
ãã®æ©è½ã¯åºãå®è£ ããã¦ãããå¤ãã®ãã¼ã¸ã§ã³ã®ç«¯æ«ããã©ã¦ã¶ã¼ã§åä½ãã¾ãã2015å¹´7æä»¥éããã¹ã¦ã®ãã©ã¦ã¶ã¼ã§å©ç¨å¯è½ã§ãã
HTTP ã® Content-Location 表ç¾ãããã¼ã¯ãè¿ããããã¼ã¿ã®ä»£æ¿å ´æã示ãã¾ãã
主ãªç¨éã¯ãã³ã³ãã³ããã´ã·ã¨ã¼ã·ã§ã³ã®çµæã¨ãã¦éä¿¡ããããªã½ã¼ã¹ã® URL ã示ããã¨ã§ãã
Content-Location 㯠Location ã¨ã¯ç°ãªãã¾ãã
Content-Location ã¯ãã³ã³ãã³ããã´ã·ã¨ã¼ã·ã§ã³ãçºçããéã«ããªã½ã¼ã¹ã«ã¢ã¯ã»ã¹ããããã®ç´æ¥ URL ã示ããã®ã§ãããã«ããã¯ã©ã¤ã¢ã³ãã¯ãã®ãªã½ã¼ã¹ã«å¯¾ããä»å¾ã®ã³ã³ãã³ããã´ã·ã¨ã¼ã·ã§ã³ãçç¥ãããã¨ãã§ãã¾ãã
䏿¹ãLocation ã¯ã3XX ãªãã¤ã¬ã¯ãã®å¯¾è±¡ãã¾ã㯠201 Created ã¬ã¹ãã³ã¹ã§æ°è¦ã«ä½æããããªã½ã¼ã¹ã® URL ã®ã©ã¡ããã示ãã¾ãã
| ãããã¼ç¨®å¥ | 表ç¾ãããã¼ |
|---|---|
| ç¦æ¢ãªã¯ã¨ã¹ããããã¼ | ããã |
æ§æ
Content-Location: <url>
ãã£ã¬ã¯ãã£ã
ä¾
>ãµã¼ãã¼ããã®ãã¼ã¿ã®ãªã¯ã¨ã¹ããæ§ã ãªå½¢å¼ã§è¡ã
ãã¨ãã°ããµã¤ãã® API ã JSON, XML, ã¾ã㯠CSV å½¢å¼ã§ãã¼ã¿ãè¿ãã¨ãã¾ããç¹å®ã®ææ¸ã® URL ã https://example.com/documents/foo ã§ããå ´åããµã¤ãã¯ãªã¯ã¨ã¹ãã® Accept ãããã¼ã«å¿ã㦠Content-Location ç¨ã«ç°ãªã URL ãè¿ããã¨ãã§ãã¾ãã
| ãªã¯ã¨ã¹ããããã¼ | ã¬ã¹ãã³ã¹ãããã¼ |
|---|---|
Accept: application/json, text/json |
Content-Location: /documents/foo.json |
Accept: application/xml, text/xml |
Content-Location: /documents/foo.xml |
Accept: text/plain, text/* |
Content-Location: /documents/foo.txt |
ãããã® URL ã¯ä¾ã§ãããµã¤ãã¯ãã¯ã¨ãªã¼æåå弿°ãä¾ãã° /documents/foo?format=jsonã/documents/foo?format=xml ãªã©ãä»»æã® URL ãã¿ã¼ã³ã§ãã¾ãã¾ãªãã¡ã¤ã«å½¢å¼ãæä¾ãããã¨ãã§ãã¾ãã
ãã®å¾ã¯ã©ã¤ã¢ã³ãã¯ãã®ç¹å®ã® URL ã§ JSON ãã¼ã¸ã§ã³ãå©ç¨å¯è½ã§ãããã¨ãè¦ãã¦ãæ¬¡ã«ææ¸ãè¦æ±ããã¨ãã«ã³ã³ãã³ãã®ãã´ã·ã¨ã¼ã·ã§ã³ãã¹ããããã¾ãã
ãµã¼ãã¼ã¯ Accept-Language ã®ãããªä»ã®ã³ã³ãã³ããã´ã·ã¨ã¼ã·ã§ã³ãããã¼ãèæ
®ãããã¨ãããã¾ãã
ãã©ã³ã¶ã¯ã·ã§ã³ã®çµæã® URL ã示ã
ãµã¤ãã®å¥ã®ã¦ã¼ã¶ã¼ã«ééããããã® <form> ãããã¨ãã¾ãã
<form action="/send-payment" method="post">
<p>
<label>
ééãããå®å
ã¯ï¼
<input type="text" name="recipient" />
</label>
</p>
<p>
<label>
éé¡ã¯ï¼
<input type="number" name="amount" />
</label>
</p>
<button type="submit">ééãã</button>
</form>
ãã©ã¼ã ãéä¿¡ãããã¨ããµã¤ãã¯åå¼ã®é 忏ãçæãã¾ãããµã¼ãã¼ã¯ Content-Location ã使ç¨ãã¦ãå°æ¥ã®ã¢ã¯ã»ã¹ã®ããã«é åæ¸ã® URL ã示ããã¨ãã§ãã¾ãã
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Location: /my-receipts/38
<!doctype html>
(Lots of HTMLâ¦)
<p>You sent $38.00 to ExampleUser.</p>
(Lots more HTMLâ¦)
仿§æ¸
| 仿§æ¸ |
|---|
| HTTP Semantics > # field.content-location > |