Aklakan opened a new issue, #3448:
URL: https://github.com/apache/jena/issues/3448

   ### Version
   
   5.6.0-SNAPSHOT
   
   ### What happened?
   
   When sending queries without parser (`parseCheck(false)`) to a remote 
endpoint, then the configured headers are not considered. Instead, default 
headers are used instead.
   The reason is `QueryExecHTTPBuilder` chooses one header based on the parsed 
query type and passes it as an override to `QueryExecHTTP`. Because for 
non-parsed queries the override cannot be determined, a fallback to `*/*` is 
made.
   
   As a proposed solution, `QueryExecHTTP` should choose the header based on 
the API usage - calling `select()` should use the header configured for 
`select`.
   
   The following example should fail with `406 Not Acceptable` but unexpectedly 
works:
    
   ```java
        public static void main(String[] args) {
                // Note that the query string uses the prefix 'rdfs:' without 
declaring it.
                // The DBpedia server can parse such a query against its 
configured prefixes.
                String queryString = "SELECT * { 
<http://dbpedia.org/resource/Apache_Jena> rdfs:label ?l } ORDER BY ?l LIMIT 1";
   
                try (RDFConnection conn = 
RDFConnectionRemote.service("http://dbpedia.org/sparql";)
                   // This header is not supported by DBpedia:
                                
.acceptHeaderSelectQuery(WebContent.contentTypeResultsThrift)
                                .parseCheckSPARQL(false).build()) {
                        try (QueryExecution qe = conn.query(queryString)) {
                                ResultSet rs = qe.execSelect();
                                ResultSetFormatter.output(System.out, rs, 
ResultsFormat.FMT_TEXT);
                        }
                }
        }
   
   ```
   
   ### Relevant output and stacktrace
   
   ```shell
   
   ```
   
   ### Are you interested in making a pull request?
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to