I like to solve application problems using the Web (statelessness, hypermedia, self-descriptive representations, and uniform interfaces) to produce an asymptotically tight bound solution!

Thursday, May 28, 2009

Creating a hierarchy of documents and folders using hierarchy-ID

You wouldn't be able to create images and HTML content in a local file system, and, say, store them in a CMIS system, and have all the hyperlinks work just fine. This appears to be a major problem to me as described in my previous post.

On the other hand, this would work just fine in AtomPub, provided the server did the right thing and followed the hierarchy-ID. Here's an example:

> GET /store;contents/


< 200 OK

< Content-Type: application/atom+xml;type=feed

< Content-Length: nnn

<

< <feed>

<   <id>4b01ffb2-91da-4f80-a908-79b66d35db42</id>

<   <title>Folder named "store"</title>

<   <link rel="self" href="/store;contents/"/>

<   <link rel="up" href="/store;metadata"/>

<   <app:collection href="/store;contents/">

<     <title>Folder named "store"</title>

<     <app:accept ah:role="master">application/atom+xml;type=entry</app:accept>

<     <app:accept ah:role="detail" alternate="multipart-related">image/*</app:accept>

<   </app:collection>

<   <updated>2009-01-01T10:00:00-07:00</updated>

< </feed>


> POST /store;contents/

> Content-Type: application/atom+xml;type=entry

> Content-Length: nnn

> Slug: images

>

> <entry>

>   <title>Image collection for Web site</title>

>   <content/>

>   <updated>2009-05-26T14:48:31.859-07:00</updated>

> </entry>


< 201 Created

< Location: /store/images;metadata

< Content-Location: /store/images;metadata

< Content-Type: application/atom+xml;type=entry

< Content-Length: nnn

<

< <entry>

<   <id>4b01ffb2-91da-4f80-a908-79b66d343b42</id>

<   <title>Image collection for Web site</title>

<   <link rel="edit" href="/store/images;metadata"/>

<   <link rel="up" href="/store;metadata"/>

<   <link rel="down" href="/store/images;contents/"/>

<   <summary>Folder named "images"</summary>

<   <updated>2009-05-26T14:48:31.859-07:00</updated>

<   <published>2009-05-26T14:50:31.859-07:00</published>

<   <app:edited>2009-05-26T14:50:31.859-07:00</app:edited>

< </entry>


> GET /store;contents/


< 200 OK

< Content-Type: application/atom+xml;type=feed

< Content-Length: nnn

<

< <feed>

<   <id>4b01ffb2-91da-4f80-a908-79b66d35db42</id>

<   <title>Folder named "store"</title>

<   <link rel="self" href="/store;contents/"/>

<   <link rel="up" href="/store;metadata"/>

<   <app:collection href="/store;contents/">

<     <title>Folder named "store"</title>

<     <app:accept ah:role="master">application/atom+xml;type=entry</app:accept>

<     <app:accept ah:role="detail" alternate="multipart-related">image/*</app:accept>

<   </app:collection>

<   <updated>2009-05-26T14:50:31.859-07:00</updated>

<   <entry>

<     <id>4b01ffb2-91da-4f80-a908-79b66d343b42</id>

<     <title>Image collection for Web site</title>

<     <link rel="edit" href="/store/images;metadata"/>

<     <link rel="up" href="/store;metadata"/>

<     <link rel="down" href="/store/images;contents/"/>

<     <summary>Folder named "images"</summary>

<     <updated>2009-05-26T14:48:31.859-07:00</updated>

<     <published>2009-05-26T14:50:31.859-07:00</published>

<     <app:edited>2009-05-26T14:50:31.859-07:00</app:edited>

<   </entry>

< </feed>


> GET /store/images;contents/


< 200 OK

< Content-Type: application/atom+xml;type=feed

< Content-Length: nnn

<

< <feed>

<   <id>4b01ffb2-91da-4f80-a908-79b66d35db42</id>

<   <title>Folder named "images"</title>

<   <link rel="self" href="/store/images;contents/"/>

<   <link rel="up" href="/store/images;metadata"/>

<   <app:collection href="/store/images;contents/">

<     <title>Folder named "images"</title>

<     <app:accept ah:role="master">application/atom+xml;type=entry</app:accept>

<     <app:accept ah:role="detail" alternate="multipart-related">image/*</app:accept>

<   </app:collection>

<   <updated>2009-05-26T14:48:31.859-07:00</updated>

< </feed>


> POST /store/images;contents/

> Content-Type: multipart/related;

>          boundary="===============1605871705==";

>          type="application/atom+xml"

>   Slug: logo.gif

>   MIME-Version: 1.0

>

>   Media Post

>   --===============1605871705==

>   Content-Type: application/atom+xml; charset="utf-8"

>   MIME-Version: 1.0

>

>   <?xml version="1.0"?>

>   <entry xmlns="http://www.w3.org/2005/Atom">

>     <title>Logo image</title>

>     <updated>2005-10-07T17:17:08Z</updated>

>     <author><name>Daffy</name></author>

>     <summary type="text">

>         A company logo

>     </summary>

>     <content src="cid:99334422@example.com"

>              type="image/gif" />

>   </entry>

>   --===============1605871705==

>   Content-Type: image/gif

>   MIME-Version: 1.0

>   Content-ID: <99334422@example.com>

>

>   GIF89a...binary image data...

>   --===============1605871705==--


< 201 Created

< Location: /store/images/logo.gif;metadata

< Content-Location: /store/images/logo.gif;metadata

< Content-Type: application/atom+xml;type=entry

< Content-Length: nnn

<

< <entry>

<   <id>4b01ffb2-91da-4f80-a908-79c56d343b42</id>

<   <title>Logo image</title> 

<   <link rel="edit" href="/store/images/logo.gif;metadata"/>

<   <link rel="up" href="/store/images;metadata"/>

<     <updated>2005-10-07T17:17:08Z</updated>

<     <author><name>Daffy</name></author>

<     <summary type="text">

<         A company logo

<     </summary>

<     <content src="/store/images/logo.gif"

              type="image/gif" />

<   <updated>2009-05-26T14:58:31.859-07:00</updated>

<   <published>2009-05-26T14:59:31.859-07:00</published>

<   <app:edited>2009-05-26T14:59:31.859-07:00</app:edited>

< </entry>


0 comments:

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License. All materials on this blog are either the original work of its owner or used with acknowledgement of the copyright owner. 

About Me

My Photo
I have been an avid student of the evolution of the Web and its application to business problems.

Blog Archive

Label Cloud