James M Snell wrote:
> Aleksander Slominski wrote:
>   

<snip/>
>> should Location header point to atom:entry or actual binary resource (as
>> in section 12)?  (it was already asked but i could not find a definitive
>> answer http://www.imc.org/atom-protocol/mail-archive/msg04577.html )
>>     
wow! that is more complicated than i have imagined :) but very useful to
have it so detailed when implementing media collection.

how do you distinguish between read-only and editable binary
representation of resource? it seems that both are have "/media/abc123"
in this example?

also it seems that in step O. it magically transformed <content
type="application/atom+xml" src="/media/abc123"/> into <content
type="image/png" src="/media/abc123"/> ? is it the only way to do it?

i thought that editable media resource would be identified with <link
rel="edit" type="image/png" href="/media/abc123.edit.png" /> besides
editable metadata <link rel="edit" href="/media/abc123.edit" /> ?

thanks,

alek
> If you post an entry document to a media collection, the entry document
> would be treated as if it were any other binary resource of any other type.
>
> A. Post the media resource
>
>    POST /media-collection HTTP/1.1
>    Host: example.org
>    Content-Type: application/atom+xml
>    Title: Bar
>
>    <?xml version="1.0" ?>
>    <entry>
>      <id>urn:foo</id>
>      <title>Foo</title>
>      ...
>    </entry>
>
> B. Created!
>
>    HTTP/1.1 201 Created
>    Date: ...
>    Location: /media/abc123
>
> C. Get the media collection feed
>
>    GET /media-collection HTTP/1.1
>    Host: example.org
>
> D. The posted resource shows up in the feed. Note the content element.
>    The media resource has editable metadata (the edit link)
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <feed ...>
>      ...
>      <entry>
>        <id>tag:example.org,2006:/media/abc123</id>
>        <link rel="edit" href="/media/abc123.edit" />
>        <title>Bar</title>
>        <updated>...</updated>
>        <author><name>james</name></author>
>        <content type="application/atom+xml"
>                 src="/media/abc123" />
>      </entry>
>      ...
>    </feed>
>
> E. Get the media resource
>
>    GET /media/abc123 HTTP/1.1
>    Host: example.org
>
> F. Return the resource
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <entry>
>      <id>urn:foo</id>
>      <title>Foo</title>
>      ...
>    </entry>
>
> G. Get the editable metadata for the resource
>
>    GET /media/abc123.edit HTTP/1.1
>    Host: example.org
>
> H. Note that this is the metadata from the feed, not the resource
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <entry>
>      <id>tag:example.org,2006:/media/abc123</id>
>      <link rel="edit" href="/media/abc123.edit" />
>      <title>Bar</title>
>      <updated>...</updated>
>      <author><name>james</name></author>
>      <content type="application/atom+xml"
>               src="/media/abc123" />
>    </entry>
>
> I. Update the editable metadata
>
>    POST /media/abc123.edit HTTP/1.1
>    Host: example.org
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <entry>
>      <id>tag:example.org,2006:/media/abc123</id>
>      <link rel="edit" href="/media/abc123.edit" />
>      <title>This is an atom entry media resource</title>
>      <updated>...</updated>
>      <author><name>james</name></author>
>      <content type="application/atom+xml"
>               src="/media/abc123" />
>    </entry>
>
> J. Response
>
>    HTTP/1.1 204 No Content
>    Date: nnnn
>
> K. Get the media resource
>
>    GET /media/abc123 HTTP/1.1
>    Host: example.org
>
> L. Return the resource. Notice no change, only the metadata was edited
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <entry>
>      <id>urn:foo</id>
>      <title>Foo</title>
>      ...
>    </entry>
>
> M. Check the media collection feed
>
>    GET /media-collection HTTP/1.1
>    Host: example.org
>
> N. The feed shows the edited metadata
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <feed ...>
>      ...
>      <entry>
>        <id>tag:example.org,2006:/media/abc123</id>
>        <link rel="edit" href="/media/abc123.edit" />
>        <title>This is an atom entry media resource</title>
>        <updated>...</updated>
>        <author><name>james</name></author>
>        <content type="application/atom+xml"
>                 src="/media/abc123" />
>      </entry>
>      ...
>    </feed>
>
> O. Update the media resource
>
>    POST /media/abc123 HTTP/1.1
>    Host: example.org
>    Content-Type: image/png
>    Content-Length: nnnn
>
>    {binary image}
>
> P. Success
>
>    HTTP/1.1 204 No Content
>    Date: nnnn
>
> Q. Check the media collection feed
>
>    GET /media-collection HTTP/1.1
>    Host: example.org
>
> R. Note the different type on the content element.
>
>    HTTP/1.1 200 OK
>    Date: ...
>    Content-Type: application/atom+xml
>    Content-Length: nnnn
>
>    <?xml version="1.0" ?>
>    <feed ...>
>      ...
>      <entry>
>        <id>tag:example.org,2006:/media/abc123</id>
>        <link rel="edit" href="/media/abc123.edit" />
>        <title>This is an atom entry media resource</title>
>        <updated>...</updated>
>        <author><name>james</name></author>
>        <content type="image/png"
>                 src="/media/abc123" />
>      </entry>
>      ...
>    </feed>
>
>   
>   


-- 
---         Memorable Quote from Firefly (105. Out Of Gas)
-Ship like this, be with you until you die -That's because it's a deathtrap

Reply via email to