plt-tud / r43ples

Revision Management for the Semantic Web
Other
19 stars 16 forks source link

SPARQL query via POST directly not supported #47

Open depressiveRobot opened 9 years ago

depressiveRobot commented 9 years ago

R43ples does not support query via POST directly:

Oct 27, 2015 11:19:33 AM org.glassfish.jersey.server.ServerRuntime$Responder mapException
SEVERE: An exception was not mapped due to exception mapper failure. The HTTP 500 response will be returned.
java.lang.IllegalStateException: The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded
    at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.ensureValidRequest(FormParamValueFactoryProvider.java:176)
    at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.getForm(FormParamValueFactoryProvider.java:160)
    at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.provide(FormParamValueFactoryProvider.java:116)
    at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:81)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$AbstractMethodParamInvoker.getParamValues(JavaResourceMethodDispatcherProvider.java:125)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:158)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:101)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:305)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:288)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1110)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:381)
    at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:219)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:745)
stephanhensel commented 9 years ago

R43ples supports also query via POST.

I tested it with your query and got the same error:

curl -X "POST" "http://localhost:9998/r43ples/sparql" \-H "Content-Type: application/x-www-form-urlencoded" \--data-urlencode "query=select (count(*) as ?count) from <urn:testData> where {?s ?p ?o .}"

But when I remove the backslashes from your query everything works fine:

curl -X "POST" "http://localhost:9998/r43ples/sparql" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "query=select (count(*) as ?count) from <urn:testData> where {?s ?p ?o .}"

Can you please test the second query without backslashes and give me a notice if it this also works for you?

depressiveRobot commented 9 years ago

You are not using query via POST directly but query via POST with URL-encoded parameters

Here is my curl command:

curl -X "POST" "http://localhost:9998/r43ples/sparql" \
    -H "Content-Type: application/sparql-query" \
    -d "select (count(*) as ?count) from <urn:testData> where {?s ?p ?o .}"

Same error as before...

markusgraube commented 9 years ago

Thank you for reporting this missing feature.

The issue should be fixed in the branch feature/query-post-directly

Can you confirm this?