[Catalyst] How are you handling multiformat URL

Jonathan Rockway jon at jrock.us
Tue Nov 28 23:09:37 GMT 2006


John Napiorkowski wrote:
> According to suggestions for URI best practices, such
> as "http://www.w3.org/Provider/Style/URI.html" you
> should make your URI for the resource without a file
> extension, since you want to make enduring URI's and
> who knows if HTML will still be popular in 10 years,
> right?
> 
> Following this thought I might do something like:
> 
> FORMAT   URI
> xhtml    myapp.com/table
> atom     myapp.com/table?format=atom
> csv      myapp.com/table?format=csv
> 
> Then I can create three different template toolkit
> views and decide between them when serializing a URL
> based on the format parameter, while making html the
> default.  They all come from the same data, just a
> different way of seeing it, so they are all
> 'alternatives' to the one.

You could do that.  Or you could just provide one XML document that
contains all of your data.  In a web browser, the browser would pick up
whatever's in the xhtml namespace and display that as a web page (while
ignoring what it doesn't understand).  An RSS reader would pick up
everything in the atom (and dc, etc.) namespace as metadata, but still
display the HTML as HTML.  (This takes some careful structuring of your
document, of course, but nothing too drastic.)  You can of course use
other XML namespaces and provide whatever additional metadata you need.
 (And instead of csv, you can export your tabular data into the
opendocument XML format and open it in the OO.org spreadsheet.)

This is especially convenient for users, since they can just use one URI
to refer to one piece of information ("the slashdot homepage") instead
of several URIs to refer to several formats, each containing different
information.

XML++

I'm planning on converting Angerwhale's output format to this Real Soon
Now (tm), negating the need for a separate RSS section, but I haven't
had time to do that recently.

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst mailing list