You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Mohamed BEN ELLEFI (Jira)" <ji...@apache.org> on 2022/01/17 14:29:00 UTC

[jira] [Updated] (JENA-2255) Setting content type in Jena RDFConnection Header ?

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

Mohamed BEN ELLEFI updated JENA-2255:
-------------------------------------
    Description: 
Hello,
I need to modify the header (specifically the Content-Type) of a request (eg: update) of an RDFConnection object in a Jena transaction. More precisely, I need to add the following Header Content_Type {{Content-Type = [application/sparql-query; charset=UTF-8]}}

in the following code
{code:java}
try (RDFConnection conn = connectionFactory.create()) { 
Txn.executeWrite(conn, () -> { 

conn.update(updateRequest);// HERE we want to setup the Content-Type in the header 

}); 
}catch (Exception e) {... }{code}
 
I have setup the connectionFactory as follow
{code:java}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
HttpClient httpClient = httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
.build();
return
RDFConnectionRemote.create()
.destination(endpointURL)
.queryEndpoint("query")
.updateEndpoint("update")
.httpClient(httpClient)
.parseCheckSPARQL(true)
.build();
}{code}
So, I still need to specify the charset of the request body in the the request header content-Type . How can I do that with JENA ?

Note: the default JENA RDFConnection setting is not sufficient because the remote endpoint still needs the explicit specification of the charset to parse my SPARQL requests containing French accents in the URIs.

Thanks in advance

stackoverflow : [https://stackoverflow.com/questions/70742161/setting-content-type-in-jena-rdfconnection-header|http://example.com/]

  was:
Hello,
I need to modify the header (specifically the Content-Type) of a request (eg: update) of an RDFConnection object in a Jena transaction. More precisely, I need to add the following Header Content_Type {{Content-Type = [application/sparql-query; charset=UTF-8]}}

in the following code
{code:java}
try (RDFConnection conn = connectionFactory.create()) { 
Txn.executeWrite(conn, () -> { 

conn.update(updateRequest);// HERE we want to setup the Content-Type in the header 

}); 
}catch (Exception e) {... }{code}
 
I have setup the connectionFactory as follow
    HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
    HttpClient httpClient = httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
        .build();
    return
        RDFConnectionRemote.create()
        .destination(endpointURL)
        .queryEndpoint("query")
        .updateEndpoint("update")
        .httpClient(httpClient)
        .parseCheckSPARQL(true)
        .build();
  }

So, I still need to specify the charset of the request body in the the request header content-Type . How can I do that with JENA ?

Note: the default JENA RDFConnection setting is not sufficient because the remote endpoint still needs the explicit specification of the charset to parse my SPARQL requests containing French accents in the URIs.

Thanks in advance

stackoverflow : [https://stackoverflow.com/questions/70742161/setting-content-type-in-jena-rdfconnection-header|http://example.com]


> Setting content type in Jena RDFConnection Header ?
> ---------------------------------------------------
>
>                 Key: JENA-2255
>                 URL: https://issues.apache.org/jira/browse/JENA-2255
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Jena
>            Reporter: Mohamed BEN ELLEFI
>            Priority: Major
>
> Hello,
> I need to modify the header (specifically the Content-Type) of a request (eg: update) of an RDFConnection object in a Jena transaction. More precisely, I need to add the following Header Content_Type {{Content-Type = [application/sparql-query; charset=UTF-8]}}
> in the following code
> {code:java}
> try (RDFConnection conn = connectionFactory.create()) { 
> Txn.executeWrite(conn, () -> { 
> conn.update(updateRequest);// HERE we want to setup the Content-Type in the header 
> }); 
> }catch (Exception e) {... }{code}
>  
> I have setup the connectionFactory as follow
> {code:java}
> HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
> HttpClient httpClient = httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
> .build();
> return
> RDFConnectionRemote.create()
> .destination(endpointURL)
> .queryEndpoint("query")
> .updateEndpoint("update")
> .httpClient(httpClient)
> .parseCheckSPARQL(true)
> .build();
> }{code}
> So, I still need to specify the charset of the request body in the the request header content-Type . How can I do that with JENA ?
> Note: the default JENA RDFConnection setting is not sufficient because the remote endpoint still needs the explicit specification of the charset to parse my SPARQL requests containing French accents in the URIs.
> Thanks in advance
> stackoverflow : [https://stackoverflow.com/questions/70742161/setting-content-type-in-jena-rdfconnection-header|http://example.com/]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)