W3C home > Mailing lists > Public > public-lod@w3.org > July 2009

Re: another content negotiation question

From: Richard Cyganiak <richard@cyganiak.de>
Date: Wed, 15 Jul 2009 16:20:36 +0200
Cc: public-lod <public-lod@w3.org>
Message-Id: <778BBE08-2973-479E-9D95-3F3979534118@cyganiak.de>
To: Juan Sequeda <juanfederico@gmail.com>
Hi Juan,

On 15 Jul 2009, at 15:43, Juan Sequeda wrote:
> and the objective is not to start another long philosophical  
> thread :P and
> it may be a very dumb question
>
> What are the drawbacks of this simple solution.
>
> in PHP for example:
>
> if($_SERVER['HTTP_ACCEPT'] == "application/rdf+xml" ){
>    header('Content-type: application/rdf+xml');
>    echo "......."
> }
> else{
>    echo "...."
> }

A typical Accept header sent by an RDF client can look like this:

text/html;q=0.3, application/xhtml+xml;q=0.3, text/plain;q=0.1, text/ 
rdf+n3, text/n3, application/n3, application/x-turtle, application/ 
turtle, text/turtle, application/rdf+xml, text/rdf, text/rdf+xml,  
application/rdf, application/xml;q=0.2, text/xml;q=0.2

A typical Accept header sent by a Web browser can look like this:

application/xml,application/xhtml+xml,text/html;q=0.9,text/ 
plain;q=0.8,image/png,*/*;q=0.5

As you can see, your code above will not work. You really need a  
proper implementation of content negotiation rather than such  
simplistic hacks.

Vapour just checks some very simple cases. A green light from Vapour  
does not necessarily mean that your content negotiation works with any  
real client. (Unfortunately! I wish it was better at validating conneg.)

(The former header is from the any23 library in default configuration.  
The latter is from Safari. Note that modern RDF clients can consume  
several RDF syntaxes, including RDFa.)

About the "/id/" vs. "/id" thing. This behaviour is more or less  
hardcoded in Apache and similar web servers. After you follow the 301  
redirect at "/id", you get the same 200 at "/id/". Essentially this  
means that "/id/" and "/id" identify the same resource, and that  
resource is a document.

Best,
Richard


>
> I did this at http://www.juansequeda.com/id/
>
> However, there is a difference when it is /id and /id/. When I  
> dereference
> http://www.juansequeda.com/id I get a 301 (Moved Permanently) but with
> http://www.juansequeda.com/id/ I get 200 (and everything validated by
> Vapour!).
>
> As this ever been discussed? I can obviously see the drawback of  
> having /id/
> vs /id .
>
> Comments?
>
> Juan Sequeda, Ph.D Student
> Dept. of Computer Sciences
> The University of Texas at Austin
> www.juansequeda.com
> www.semanticwebaustin.org
Received on Wednesday, 15 July 2009 14:21:28 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:29:44 UTC