cedadev / djcharme

CHARMe project node
0 stars 2 forks source link

Calling the the ‘resource’ service results in a circular redirect #1

Closed ahenrycgi closed 10 years ago

ahenrycgi commented 10 years ago

After listing the submitted annotations on the Node, I attempt to retrieve the 'body' content for a given text annotation. The response from the server gives a circular redirect.

Eg.

GET http://charme-dev.cems.rl.ac.uk/resource/96af8f78c2a6 HTTP/1.1
Host: charme-dev.cems.rl.ac.uk
Proxy-Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
Accept: application/ld+json, */*; q=0.01
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Referer: http://localhost:8080/CHARMe_Plugin/plugin.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6

Yields a response of:

HTTP/1.0 303 See Other
Date: Fri, 30 Aug 2013 09:10:58 GMT
Server: Apache/2.2.15 (Red Hat)
Location: http://charme-dev.cems.rl.ac.uk/resource/96af8f78c2a6
Content-Length: 0
Content-Type: text/html; charset=utf-8
X-Cache: MISS from cache1.uk.logica.com
X-Cache-Lookup: MISS from cache1.uk.logica.com:3128
Via: 1.0 cache1.uk.logica.com (squid/3.1.19)
Connection: keep-alive

As some background, this annotation was created with the following json-ld:

[
     {
           "@id":"http://localhost/96af8f78c2a6",
           "@type":"http://www.w3.org/ns/oa#Annotation",
           "http://www.w3.org/ns/oa#hasBody":
           {
                "@id":"http://localhost/3cc0dd13ca30"
           },
           "http://www.w3.org/ns/oa#hasTarget":
           {
                "@id":"http://api.jquery.com/val/"
           }
     },
     {
           "@id":"http://localhost/3cc0dd13ca30",
           "@type":[
                "http://www.w3.org/2011/content#ContentAsText",
                "http://purl.org/dc/dcmitype/Text"
                ],
           "http://purl.org/dc/elements/1.1/format":"text/plain",
           "http://www.w3.org/2011/content#chars":"Some test text"
     }
]

I am aware that the id's for the annotation and body are not correct, as they should start with http://localhost/resource/* instead of http://localhost/* however I have since modified my code to generate correct id's and the same issue still occurs.

kusamau commented 10 years ago

I can confirm the bug. The actual implementation was incorrectly redirecting "/resource" to "/resource".

kusamau commented 10 years ago

The fix for this issue has been committed