freme-project / basic-services

Apache License 2.0
0 stars 1 forks source link

Problem in SPARQL converter #120

Open jnehring opened 7 years ago

jnehring commented 7 years ago
curl -X OPTIONS -H "Cache-Control: no-cache" -H "Postman-Token: 4c7fecdb-4ee7-743c-2d96-cea6c8fb0c90" -d 'Show me the source of knowledge' "http://rv1443.1blu.de/current/e-translation/tilde?input=Hello%2C%20world!&informat=text&outformat=csv&source-lang=en&target-lang=de&filter=extract-entities-only"

produces

{
  "exception": "eu.freme.common.exception.FREMEHttpException",
  "path": "/toolbox/convert/documents/extract-entities-only",
  "error": "Internal Server Error",
  "status": 500,
  "timestamp": 1485174312968
}

and log file

ERROR   2017-01-23 13:25:12,966 [http-nio-8089-exec-10] eu.freme.common.exception.ExceptionHandlerService  - Request: http://rv1443.1blu.de:8089/toolbox/convert/documents/extract-entities-only raised
eu.freme.common.exception.FREMEHttpException
        at eu.freme.bservices.controllers.sparqlconverters.SparqlConverterController.filter(SparqlConverterController.java:187)
...

happens in all api endpoints that use the sparql converter. This leads to https://github.com/freme-project/freme-project.github.io/issues/332

jnehring commented 7 years ago

The problem happens only when executing the OPTIONS http method, it works fine when I use POST, GET, ...

So the CORS pre-flight request fails when using this filter. Possible solution:

When the request is a pre-flight request, then it should not execute the filter because the request has no body anyways. This should be handled by the CORS filter which needs to move up in the filter hierarchy.

I wonder why this bug was not mentioned earlier because I think it exists for a long time, maybe 6 month or longer.

jnehring commented 7 years ago

The bug is fixed on rv1443.1blu.de . I switched off the postprocessing filter for HTTP OPTIONS requests. We should include this bugfix in the ADAPT installation.

jnehring commented 7 years ago

this bugfix introduced problems. i will roll it back.