[annotator-dev] Annotator store delete fails every other time

Michael Emery michael.emery at sri.com
Fri Nov 22 17:46:26 UTC 2013


I've updated my return type from the default (unsure what that is, xml?) to json and provided an empty json element. Without the "{}" response, I get 'no element found' errors after both requests.

@DELETE
@Path("{name}/{id}")
@Consumes("application/json")
@Produces("application/json")
public String destroy(@PathParam("name") String name, @PathParam("id") String id) {
...
return "{}"
}

The second request still fails, but now the first request no longer produces the 'no element found' error in the JS console:

[09:31:15.992] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-496cfcf2-d119-4189-8688-95a2bc7f4586 [HTTP/1.1 200 OK 24ms]
[09:31:28.935] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-c4732b4f-be35-495d-9bc8-3ce9fa377521 [HTTP/1.1 505 HTTP Version Not Supported 5ms]
[09:31:28.879] no element found @ http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-c4732b4f-be35-495d-9bc8-3ce9fa377521:1
[09:31:28.881] API request failed: '505'

I've just noticed that if I wait awhile to make the next request, everything works:
[10:33:02.521] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-705fbafc-6985-444d-95c3-1f7e07bc1a47 [HTTP/1.1 200 OK 33ms]
[10:36:39.238] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-44acf3a2-147a-4966-9669-3f79213424a1 [HTTP/1.1 200 OK 25ms]

A back-to-back delete followed by a create also causes this error:

[10:38:05.714] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-5ee91b36-7657-4f40-9a51-a2721e47a941 [HTTP/1.1 200 OK 17ms]
[10:38:08.726] POST http://localhost:8080/test/rest/annotations/ap.txt [HTTP/1.1 505 HTTP Version Not Supported 1ms]
[10:38:08.674] no element found @ http://localhost:8080/test/rest/annotations/ap.txt:1
[10:38:08.675] API request failed: '505'

That makes me think something isn't getting read or closed correctly after the delete- which is messing up the next call.


-          Mike

From: Randall Leeds [mailto:tilgovi at hypothes.is]
Sent: Thursday, November 21, 2013 6:40 PM
To: Michael Emery
Cc: annotator-dev at lists.okfn.org
Subject: Re: [annotator-dev] Annotator store delete fails every other time


Check the content type and other headers to be sure your response is interpreted as JSON. The "no element found"message makes it sound like the response is being parsed as HTML.
On Nov 21, 2013 2:51 PM, "Michael Emery" <michael.emery at sri.com<mailto:michael.emery at sri.com>> wrote:
My annotator store delete calls are failing every other time.

The store is implemented in Java (Jersey/jax-rs) over Glassfish.
Using: Annotator 1.2.7, jquery 1.8.3, jquery-ui-1.9.2
The other store calls work great, but every other delete call fails with code 505.
I'm seeing this behavior in both firefox and chrome.

Here's the log from firefox:
[15:41:06.447] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-17acdf69-dc03-4847-a2fa-060865bf8f36 [HTTP/1.1 200 OK 20ms]
[15:41:06.399] no element found @ http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-17acdf69-dc03-4847-a2fa-060865bf8f36:1
[15:41:09.247] DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-081015b0-1f00-425f-a768-5646305d0b24 [HTTP/1.1 505 HTTP Version Not Supported 5ms]
[15:41:09.194] no element found @ http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-081015b0-1f00-425f-a768-5646305d0b24:1
[15:41:09.195] API request failed: '505'

When I send the delete calls via curl, I get a 204 every time:
curl -i -X DELETE http://localhost:8080/test/rest/annotations/ap.txt/id-ap.txt-d9dbeee7-d93b-4a76-a706-76860a585cea
HTTP/1.1 204 No Content
X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition  4.0  Java/Oracle Corporation/1.7)
Server: GlassFish Server Open Source Edition  4.0
Date: Thu, 21 Nov 2013 22:11:05 GMT

WTB a clue!

-          Mike

_______________________________________________
annotator-dev mailing list
annotator-dev at lists.okfn.org<mailto:annotator-dev at lists.okfn.org>
http://lists.okfn.org/mailman/listinfo/annotator-dev
Unsubscribe: http://lists.okfn.org/mailman/options/annotator-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20131122/f70c9a82/attachment-0004.html>


More information about the annotator-dev mailing list