Identifying the Resource Associated with a Representation?

Hi,

 From an HTTP response I need to be able to work out an identifier for a 
resource, from the Content-Location, in order to:

(a) which URI to send PUT and DELETE requests to
(b) which URI to store a cached representation against.

And also:

(c) which URI to use as @base (say it was a text/html response)
(d) which URI to use on the next GET for the same resource

Please do assume that Content-Location is different from the effective 
request URI for my use-case(s) above.

I'd initially thought this was as simple as look at the Content-Location 
header and use the value.

However, first if it's a relative-part then to what base is it resolved 
against? the target resource (effective request URI)? assuming this is 
correct.

Then I hit p2-semantics section 6.1 - "Identifying the Resource 
Associated with a Representation" [1] - and got a bit more confused. 
Here's a relevantly snipped version of the text:

    ... To determine the URI of the resource a response is
    associated with, the following rules are used (with the first
    applicable one being selected):

    1.  If the response status code is 200 or 203 and the request method
        was GET, the response payload is a representation of the target
        resource.

    2.  If the response status code is 204, 206, or 304 ...

    3.  If the response has a Content-Location header field, and that URI
        is the same as the effective request URI ...

    4.  If the response has a Content-Location header field, and that URI
        is not the same as the effective request URI ...


How can I ever get to step 3 or 4 to figure out the identifier I should 
be using for my use-cases above?

Problem: "(with the first applicable one being selected)" - the first 
applicable being 1... "is a representation of the target resource"

Thanks for any clarification,

Nathan

[1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-12#page-14

Received on Saturday, 6 November 2010 03:41:39 UTC