users@jsr311.java.net

base-uri for MessageBodyReader

From: Reto Bachmann-Gmür <reto_at_gmuer.ch>
Date: Mon, 08 Sep 2008 08:31:30 +0200

Hello

I was writing a MessageBodyReader accepting RDF/XML and returning an
RDF-Graph instance when I noticed that my client uses relative URI
references:


PUT /editor/dynamic/page1 HTTP/1.1
Host: localhost:8282
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/rdf+xml
Referer: http://localhost:8282/editor/static/disco.xhtml
Content-Length: 311

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about="page1">
   <infoBit xmlns="http://discobits.org/ontology#"
rdf:parseType="Literal">bla bla bla bla </infoBit>
   <rdf:type
rdf:resource="http://discobits.org/ontology#XHTMLInfoDiscoBit"/>
  </rdf:Description>
</rdf:RDF>

In the MessageBodyReader I cannot reconstruct the full URI of the
subject of the two triples in the graph as I cannot access the fist line
of the http-request.

I think the problem may occur with any formats supporting relative URIs,
for RDF things are particularly difficult as relative-uris are permitted
only in the serialization format, a valid RDF-Graph never contains
relative URI references.

For MessageBodyWriter the situation is similar if the applications wants
to deliver relative URIs in the serilaized form. The issues with writers
is however less urgent, as it's usually acceptable to deliver absolute URIs.

Should MessageBodyReader have access to a context-URI? Or to the full
Request instead of just the entity headers?

Reto