Hello Melanie, The changes in the [1] should have added the CORS support for deletion of content items. I suspect that you may have been using some old revisions, since there was a bug in the maven-clean-plugin configurations of the full launcher. Also, I can delete content items from a remote server successfully. I just fixed the bug in the full launcher. Could you please update and rebuilt it?
Best, Suat [1] http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/StoreResource.java?view=diff&r1=1362396&r2=1362397&pathrev=1362397 On 07/30/2012 01:06 PM, Melanie Reiplinger wrote: > Hello Suat, > > thanks for your help. I updated and rebuilt the contenthub today, but > it seems I still can't get through with the DELETE. When trying to > delete a content item, the preflight keeps returning only GET, POST > and OPTIONS to me as the allowed methods. > > 1. > Request URL: > > http://lnv-89012.dfki.uni-sb.de:9001/contenthub/contenthub/store/urn:melaniesitem > 2. > Request Method: > OPTIONS > 3. > Status Code: > 200 OK(from cache) > 4. Request Headersview source > 1. > Accept: > */* > 2. > Accept-Charset: > ISO-8859-1,utf-8;q=0.7,*;q=0.3 > 3. > Accept-Encoding: > gzip,deflate,sdch > 4. > Accept-Language: > de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 > 5. > Access-Control-Request-Headers: > origin, accept > 6. > Access-Control-Request-Method: > DELETE > 7. > Connection: > keep-alive > 8. > Host: > lnv-89012.dfki.uni-sb.de:9001 > 9. > Origin: > http://localhost > 10. > Referer: > http://localhost/VIE/test/?testNumber=56 > 11. > User-Agent: > Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, > like Gecko) Chrome/20.0.1132.57 Safari/536.11 > 5. Response Headersview source > 1. > Access-Control-Allow-Headers: > origin, accept > 2. > Access-Control-Allow-Methods: > GET, POST, OPTIONS > 3. > Access-Control-Allow-Origin: > * > 4. > Access-Control-Expose-Headers: > Location > 5. > Content-Length: > 0 > 6. > Server: > Jetty(6.1.x) > > > and when trying to delete an Index, I get '204 Not Content' and the > response header looks pretty strange: > > 1. > Allow: > OPTIONS,DELETE > 2. > Server: > Jetty(6.1.x) > 3. > > Do I need to update something else apart from the contenthub? > > As to submitting new indices, I'm a bit confused now. When submitting > an ldpath program via the web interface, a Form Data object seems to > be used to carry the data: > > 1. > > > 1. Form Dataview URL encoded > 1. > name: > melaniesIndex > 2. > program: > @prefix rdf : <http://www.w3.org/1999/02/22-rdf-syntax-ns#>; > @prefix rdfs : <http://www.w3.org/2000/01/rdf-schema#>; @prefix > db-ont : <http://dbpedia.org/ontology/>; title = rdfs:label :: > xsd:string; dbpediatype = rdf:type :: xsd:anyURI; population = > db-ont:populationTotal :: xsd:int; > > > But anyway, the curl -d works as you say and I could also implement it > for the XmlHttpRequest. > > Best, > melanie > > > Am 17.07.2012 10:14, schrieb Suat Gonul: >> Hi Alessandro, Melanie, >> >> @Alessandro, thanks for the answer. >> >> @Melanie, to be able to submit an LDPath program, the correct usage with >> curl are is follows. Currently, this endpoint does not support sending >> requests with (form-multipart) objects. >> >> curl -i -X POST -d "name=melaniesIndex&program=@prefix rdf : >> <http://www.w3.org/1999/02/22-rdf-syntax-ns# >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>>; @prefix rdfs : >> <http://www.w3.org/2000/01/rdf-schema# >> <http://www.w3.org/2000/01/rdf-schema#>>; @prefix db-ont : >> <http://dbpedia.org/ontology/>; title = rdfs:label :: xsd:string; >> dbpediatype = rdf:type :: xsd:anyURI; population = >> db-ont:populationTotal :: xsd:int;" >> http://<stanbol>/contenthub/ldpath/program >> >> Also, I fixed the CORS support issues you mentioned. Please let me know >> if you have any other problems. >> >> Best, >> Suat >> >> >> On 07/16/2012 12:36 PM, Alessandro Adamou wrote: >>> Hi Melanie, >>> >>> I can see that path has a preflight handling function, so it should >>> support CORS. >>> >>> However it doesn't specify the allowed methods. Perhaps the line >>> >>> enableCORS(servletContext, res, headers); >>> >>> should be >>> >>> enableCORS(servletContext, res, headers, GET, POST, DELETE, OPTIONS); >>> >>> like I had to do for the ontologymanager endpoint to work? >>> >>> --Alessandro >>> >>> >>> On 7/15/12 7:55 PM, Melanie Reiplinger wrote: >>>> Hi Rupert, Alessandro. >>>> >>>> Is it possible that we still do not have CRUD access on the >>>> contenthub? >>>> >>>> When doing a DELETE on >>>> >>>> <stanbol>/contenthub/contenthub/store/<itemID>, >>>> >>>> I'm getting >>>> >>>> Access-Control-Allow-Methods: GET, POST, OPTIONS >>>> >>>> as response to the preflight request (so DELETE would be missing >>>> then). >>>> >>>> The same problem for >>>> <stanbol>/contenthub/ldpath/program/<indexID>. >>>> >>>> When trying to create an index by sending a FormData object >>>> (form-multipart) to contenthub/ldpath/program, my request gets stuck. >>>> I can't even get through with curl: >>>> >>>> curl -i -X POST -F 'name=melaniesIndex' -F "program='@prefix rdf : >>>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>; @prefix rdfs : >>>> <http://www.w3.org/2000/01/rdf-schema#>; @prefix db-ont : >>>> <http://dbpedia.org/ontology/>; title = rdfs:label :: xsd:string; >>>> dbpediatype = rdf:type :: xsd:anyURI; population = >>>> db-ont:populationTotal :: xsd:int;'" >>>> http://<stanbol>/contenthub/ldpath/program >>>> >>>> I get Unsupported Media Type error. I guess there's some issue with >>>> the @ symbols in the program (normally they are used to reference >>>> files), but escaping them was of no use. >>>> >>>> >>>> And one more minor thing: >>>> >>>> For >>>> curl -i -X DELETE <stanbol>/contenthub/ldpath/program/melaniesIndex >>>> >>>> I get >>>> HTTP/1.1 200 OK >>>> Content-Length: 0 >>>> Server: Jetty(6.1.x) >>>> >>>> even if the index does not exist any more (i.e., if it has been >>>> deleted before). >>>> >>>> g >>>> melanie >>>> >>>> >>> >> > >
