paget http methods

3 views
Skip to first unread message

Richard Hancock

unread,
Nov 1, 2009, 2:06:57 AM11/1/09
to n2-dev
Hi,

hope this is the right place for discussion on paget (http://
code.google.com/p/paget/).

I recently set up a small test site using paget (http://
code.google.com/p/paget/) to access my Talis store.

I thought all was looking pretty good with my one page example
http://scoop.3kbo.com/articles/adopting-a-stray-cat until I tried it
with curl using the examples in Richard Cyganiak's blog on the New
York Times, http://dowhatimean.net/2009/10/linked-data-at-the-new-york-times-exciting-but-buggy.

Testing with curl

> curl -I -H "Accept: application/rdf+xml" http://scoop.3kbo.com/articles/adopting-a-stray-cat
> curl -I -H "Accept: text/html" http://scoop.3kbo.com/articles/adopting-a-stray-cat

gave "HTTP/1.0 405 Method Not Allowed" in both cases.

Also got the same 405 result for a couple of other paget sites, e.g.

> curl -I -H "Accept: text/html" http://vocab.org/whisky/terms/Whisky
> curl -I -H "Accept: application/rdf+xml" http://iandavis.com/id/me

A bit of investigation revealed that the "Method Not Allowed" was
"head". Updating PAGET_AbstractResource with the method
"head" (basically a copy of "get") works but there is probably a
better way to do it.

Any pointers on the inner workings of paget (and possible curl) and a
better fix most appreciated.

E.g. after my update

curl -I -H "Accept: application/rdf+xml" http://scoop.3kbo.com/articles/adopting-a-stray-cat

I get
HTTP/1.1 303 See Other
Location: http://scoop.3kbo.com/articles/adopting-a-stray-cat.rdf
Content-Type: text/html

I was expecting Content-Type to be "application/rdf+xml" rather than
"text/html".

Longer term I would also be interested in adding post and put to the
paget code and was wondering how best to contribute to the project.

Cheers,

Richard Hancock

Rob Styles

unread,
Nov 1, 2009, 4:01:53 AM11/1/09
to n2-...@googlegroups.com
On Sun, Nov 1, 2009 at 7:06 AM, Richard Hancock <richard...@3kbo.com> wrote:

Hi,

hope this is the right place for discussion on paget (http://
code.google.com/p/paget/).

It's a good a place as any, Ian, Keith, myself and others are on here.
 
I recently set up a small test site using paget (http://
code.google.com/p/paget/)  to access my Talis store.

I thought all was looking pretty good with my one page example
http://scoop.3kbo.com/articles/adopting-a-stray-cat until I tried it
with curl using the examples in Richard Cyganiak's blog on the New
York Times,  http://dowhatimean.net/2009/10/linked-data-at-the-new-york-times-exciting-but-buggy.

Testing with curl

> curl -I -H "Accept: application/rdf+xml" http://scoop.3kbo.com/articles/adopting-a-stray-cat
> curl -I -H "Accept: text/html" http://scoop.3kbo.com/articles/adopting-a-stray-cat

gave "HTTP/1.0 405 Method Not Allowed" in both cases.

Also got the same 405 result for a couple of other paget sites, e.g.

> curl -I -H "Accept: text/html" http://vocab.org/whisky/terms/Whisky
> curl -I -H "Accept: application/rdf+xml" http://iandavis.com/id/me

A bit of investigation revealed that the "Method Not Allowed" was
"head". Updating PAGET_AbstractResource with the method
"head" (basically a copy of "get") works but there is probably a
better way to do it.

Any pointers on the inner workings of paget (and possible curl) and a
better fix most appreciated.

As Paget simply proxies through to the platform an implementation of HEAD will look very much the same as for GET but without bothering to render or send the page content. If you wanted a fuller HEAD response to include the content-length header you might need to do eveything, but only bother to send the headers not the body.
 
E.g. after my update

curl -I -H "Accept: application/rdf+xml" http://scoop.3kbo.com/articles/adopting-a-stray-cat

I get
HTTP/1.1 303 See Other
Location: http://scoop.3kbo.com/articles/adopting-a-stray-cat.rdf
Content-Type
: text/html

I was expecting Content-Type to be "application/rdf+xml" rather than
"text/html".

The response of text/html could be correct. It's worth remembering it's the content-type of the 303 response, not the content-type of the document at the URI given in the location header. Maybe we should think about an RDF/XML response body for 303s - there's probably good reason not to though.
 
Longer term I would also be interested in adding post and put to the
paget code and was wondering how best to contribute to the project.

Ian admins the project so I'm sure he'll come back on how to contribute :-)
 

Cheers,

Richard Hancock




--
Rob Styles
http://dynamicorange.com
Reply all
Reply to author
Forward
0 new messages