WLW+AtomPub, Part 3: Picking Collections
My post on autodiscovery covered how Windows Live Writer decides which protocol to use, and how it finds the service document. Service documents can contain multiple collections; I didn’t mention how Writer decides which collection to use.
Blog Post Collections
Here’s how Writer decides what collection to use for blog posts.
First, Writer filters down the list of collections to the ones which can accept entries. At least one of the following criteria must be met:
- No <accept> entries are present (this is a special case that is called out in RFC5023 section 8.3.4)
- <accept>*/*</accept> is present
- <accept>application/atom+xml;type=entry</accept> is present
- <accept>entry</accept> is present. (This is from obsolete versions of the spec; don’t do it!)
- <accept>application/*</accept> is present. (This is weird; don’t do it!)
If, according to these criteria, one and only one collection supports entries, we will automatically use it. If more than one collection matches, then we’ll prompt the user during configuration, using a list of names formed by [workspace title + ” – ” ] + collection title.
Image Upload Collections
If there are collections that accept images, we can use them for uploading pictures. Again, if one and only one collection accepts images, we’ll use it automatically. If there are two or more, we’ll prompt the user during configuration. A collection accepts images if one of the following is present:
- <accept>image/png</accept> AND <accept>image/jpeg</accept> AND <accept>image/gif</accept>. We won’t use collections that (for example) only accept JPEG or don’t accept PNG, etc.
Notice that if there is only a single collection that accepts both entries and images according to the definitions above, we’ll happily use it for both purposes.
Filed under: Atom, Windows Live Writer | 4 Comments