Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2255

Setting content type in Jena RDFConnection Header ?

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • Jena
    • None

    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

      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) {... }

       
      I have setup the connectionFactory as follow

      public RDFConnection create() {
      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            benellefi Mohamed BEN ELLEFI
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: