[annotator-dev] Problem with Storage DELETE request
Randall Leeds
tilgovi at hypothes.is
Tue May 19 20:47:53 UTC 2015
You can also specify the `emulateHTTP` option to the Store configuration.
This setting makes it so that Annotator always uses a POST request and
specifies the real method in an X-HTTP-Method-Override header.
On Tue, May 19, 2015 at 1:37 PM, Kraffmiller, Ellen <
ekraffmiller at hmdc.harvard.edu> wrote:
> I’ve done more research on the server side - and I don’t see how I can
> override the behavior of my server (Glassfish 4.1, with Java Servlets
> 3.1). So I will need to modify the Annotator code so that it sends the
> DELETE without a message body. Can I do this by implementing the
> annotationDeleted() method? Or is that just an additional callback that
> happens on delete?
>
>
> On May 19, 2015, at 12:53 PM, Ellen Kraffmiller <
> ekraffmiller at fas.harvard.edu> wrote:
>
> Yes, I think that is the problem! I can see in my javascript console
> that the DELETE request includes the entire annotation in the request
> body. When I run the DELETE curl command with a body, I’m also getting the
> 400 error. The problem seems to be that the framework I’m using to
> implement the service doesn’t allow a body in a DELETE request. So I will
> either have to override the DELETE being sent from the annotator, or
> implement the delete differently on my server.
>
> Thanks for your help!
>
> On May 18, 2015, at 7:44 PM, Randall Leeds <tilgovi at hypothes.is> wrote:
>
> Is your server rejecting the DELETE in the first case?
>
> I think Annotator will send the annotation in the request body for the
> delete. Maybe your server is not expecting that?
>
> On Mon, May 18, 2015 at 2:43 PM, Kraffmiller, Ellen <
> ekraffmiller at hmdc.harvard.edu> wrote:
>
>> When the request is made from within Annotator, I the response I get from
>> the server is 400 Bad Request. The request never gets to my method on the
>> server, so my annotation isn’t deleted. Here is what it looks like on my
>> Javascript Console:
>>
>> DELETE
>> http://localhost:8080/text/api/store/annotations/555a512f30045b989f670271
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8080_text_api_store_annotations_555a512f30045b989f670271&d=BQMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vyEs5LtWI7iWAgVfdz7UJyI8eN_xIkVsV7ez924R2rA&m=hpo03hQATZvIXcLHvDQApvT1pCO1kpQ3JNlk10n04Hk&s=ZwMaKS6OI3ty9YAuUIvTVJXaHIP6uxGUcIYB5ZCjk4o&e=>
>> 400 (Bad Request)
>>
>> When I make the request from curl the annotation is deleted and I get
>> 200 response:
>>
>> curl -i -X DELETE
>> http://localhost:8080/text/api/store/annotations/555a512f30045b989f670271
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8080_text_api_store_annotations_555a512f30045b989f670271&d=BQMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vyEs5LtWI7iWAgVfdz7UJyI8eN_xIkVsV7ez924R2rA&m=hpo03hQATZvIXcLHvDQApvT1pCO1kpQ3JNlk10n04Hk&s=ZwMaKS6OI3ty9YAuUIvTVJXaHIP6uxGUcIYB5ZCjk4o&e=>
>> HTTP/1.1 200 OK
>>
>>
>> On May 18, 2015, at 5:33 PM, Randall Leeds <tilgovi at hypothes.is> wrote:
>>
>> Is the response from the server different? Or does Annotator just have
>> trouble processing it?
>>
>> When you delete the annotation in Annotator, is it deleted on the server,
>> and then just the client sees failure? Or is the backend rejecting the
>> request?
>> On May 18, 2015 2:07 PM, "Kraffmiller, Ellen" <
>> ekraffmiller at hmdc.harvard.edu> wrote:
>>
>>> Hi,
>>> I’m running Annotator 1.2.10, with the Storage plugin, and have
>>> implemented my own REST interface for the storage commands. I have create,
>>> update and search working correctly, but I’m having a problem with the
>>> delete command. When I try to delete an annotation, I get a “Bad Request”
>>> error from the Storage plugin, but if I run try the same DELETE URL that
>>> the plugin is calling with curl, it works as expected and the annotation is
>>> deleted. I’m using jQuery 1.9.0.
>>> Any suggestiions appreciated!
>>> Thanks,
>>> Ellen
>>>
>>> Here is my javascript from my test page:
>>>
>>> jQuery(function ($) {
>>> if (typeof $.fn.annotator !== 'function') {
>>> alert("Ooops! it looks like you haven't built
>>> the Annotator concatenation file. " +
>>> "Either download a tagged release from
>>> GitHub, or modify the Cakefile to point " +
>>> "at your copy of the YUI compressor and run
>>> `cake package`.");
>>> } else {
>>> // This is the important bit: how to create the
>>> annotator and add
>>> // plugins
>>> $('#clusterDocViewText').annotator()
>>> .annotator('addPlugin', 'Permissions')
>>> .annotator('addPlugin','Store', {
>>> prefix: '/text/api/store',
>>> annotationData : {
>>> url: 'http://'+
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__-26-2339-3B-2B&d=BQMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vyEs5LtWI7iWAgVfdz7UJyI8eN_xIkVsV7ez924R2rA&m=hpo03hQATZvIXcLHvDQApvT1pCO1kpQ3JNlk10n04Hk&s=K4M135-FnMN9GnIGDjZ9w6ZuqtG5HDqQLhqjN2mBR0U&e=>
>>> window.location.host + window.location.pathname,
>>> documentId: '553e964230040cdcf4ecf4d4'
>>> },
>>> loadFromSearch: {
>>> limit: 0,
>>> all_fields: 1,
>>> documentId: '553e964230040cdcf4ecf4d4'
>>> }
>>> })
>>> .annotator('addPlugin', 'Tags');
>>>
>>> $('#clusterDocViewText').data('annotator').plugins['Permissions'].setUser({
>>> id: 9, username: 'ellen' });
>>> }
>>> });
>>> _______________________________________________
>>> annotator-dev mailing list
>>> annotator-dev at lists.okfn.org
>>> https://lists.okfn.org/mailman/listinfo/annotator-dev
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.okfn.org_mailman_listinfo_annotator-2Ddev&d=BQMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vyEs5LtWI7iWAgVfdz7UJyI8eN_xIkVsV7ez924R2rA&m=LQfZhQT6420GJkEmYrKLFKm3pplCRbShxC7W4K1-hos&s=pnZwXRH8-ibwspqAtULJpbQZUoDuZlURhG4xNKQ0eyU&e=>
>>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.okfn.org_mailman_options_annotator-2Ddev&d=BQMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vyEs5LtWI7iWAgVfdz7UJyI8eN_xIkVsV7ez924R2rA&m=LQfZhQT6420GJkEmYrKLFKm3pplCRbShxC7W4K1-hos&s=VCDXf_v_ESbHFHNbkmHU_jlqfJSg7NslVVvE9gqAzFQ&e=>
>>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150519/04c26306/attachment-0004.html>
More information about the annotator-dev
mailing list