[ 
https://issues.apache.org/jira/browse/MARMOTTA-618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dietmar Glachs updated MARMOTTA-618:
------------------------------------
    Description: 
CONSTRUCT-Sparql-Request fails with "no result format specified or unsupported 
format". 

In SparqlWebService.select an extensive request header parsing is done to 
determine the best content type to use for the response. 

Reason: in the above environment - the method 
{code:java}
 List<String> acceptHeaders = 
EnumerationUtils.toList(request.getHeaders(ACCEPT));
{code}
does not produce a list with each requested accept header, instead a list with 
a single entry containing all accept headers is created - example below:
{code:java}
"application/n-triples;q=0.7, text/plain;q=0.7, application/rdf+xml;q=0.8, 
application/xml;q=0.8, text/turtle, application/x-turtle, 
application/trig;q=0.8, application/x-trig;q=0.8"
{code}
This string is then further parsed with 
{code:java}
List<ContentType> acceptedTypes = 
HttpMarmottaUtils.parseAcceptHeaders(List<String>) 
{code}
where the string is split into tokens. Problem: the leading space after each 
comma (",") is not stripped!!

Solution: in MarmottaHttpUtils.java, method "parseContentType", each token 
should be trimmed - line 132.
{code:java}
String mt[] = c.trim().split(";");
{code}

Just provided the patch to "develop" branch 

  was:
CONSTRUCT-Sparql-Request fails with "no result format specified or unsupported 
format". 

In SparqlWebService.select an extensive request header parsing is done to 
determine the best content type to use for the response. 

Reason: in the above environment - the method 
{code:java}
 List<String> acceptHeaders = 
EnumerationUtils.toList(request.getHeaders(ACCEPT));
{code}
does not produce a list with each requested accept header, instead a list with 
a single entry containing all accept headers created - example below:
{code:none}
application/n-triples;q=0.7, text/plain;q=0.7, application/rdf+xml;q=0.8, 
application/xml;q=0.8, text/turtle, application/x-turtle, 
application/trig;q=0.8, application/x-trig;q=0.8
{code}
This string is then further parsed with 
{code:java}
List<ContentType> acceptedTypes = 
HttpMarmottaUtils.parseAcceptHeaders(List<String>) 
{code}
where the string is split into tokens. Problem: the leading space after each 
comma (",") is not stripped!!

Solution: in MarmottaHttpUtils.java, method "parseContentType", each token 
should be trimmed - line 132.
{code:java}
String mt[] = c.trim().split(";");
{code}

Just provided the patch to "develop" branch 


> CONSTRUCT Sparql Command fails with "no result format specified ..."
> --------------------------------------------------------------------
>
>                 Key: MARMOTTA-618
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-618
>             Project: Marmotta
>          Issue Type: Bug
>          Components: KiWi Triple Store
>    Affects Versions: 3.4.0
>         Environment: marmotta-3.4.0-SNAPSHOT; Tomcat7 - executed with: mvn 
> tomcat7:run
> Operating System: Linux
>            Reporter: Dietmar Glachs
>            Priority: Trivial
>             Fix For: 3.4.0
>
>
> CONSTRUCT-Sparql-Request fails with "no result format specified or 
> unsupported format". 
> In SparqlWebService.select an extensive request header parsing is done to 
> determine the best content type to use for the response. 
> Reason: in the above environment - the method 
> {code:java}
>  List<String> acceptHeaders = 
> EnumerationUtils.toList(request.getHeaders(ACCEPT));
> {code}
> does not produce a list with each requested accept header, instead a list 
> with a single entry containing all accept headers is created - example below:
> {code:java}
> "application/n-triples;q=0.7, text/plain;q=0.7, application/rdf+xml;q=0.8, 
> application/xml;q=0.8, text/turtle, application/x-turtle, 
> application/trig;q=0.8, application/x-trig;q=0.8"
> {code}
> This string is then further parsed with 
> {code:java}
> List<ContentType> acceptedTypes = 
> HttpMarmottaUtils.parseAcceptHeaders(List<String>) 
> {code}
> where the string is split into tokens. Problem: the leading space after each 
> comma (",") is not stripped!!
> Solution: in MarmottaHttpUtils.java, method "parseContentType", each token 
> should be trimmed - line 132.
> {code:java}
> String mt[] = c.trim().split(";");
> {code}
> Just provided the patch to "develop" branch 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to