Rest 如何将http头添加到Apache Jena QueryEngineHTTP查询?

Rest 如何将http头添加到Apache Jena QueryEngineHTTP查询?,rest,http-headers,jena,Rest,Http Headers,Jena,我正在尝试使用HTTP头,以便对我的应用程序进行身份验证,以查询ORCID()公共API。我创建如下标题: HttpOptions httpOptions = new HttpOptions(); Header contentTypeHeader = new BasicHeader("Content-Type", "application/orcid+json"); Header authorizationHeader = new BasicHeader("Authorization", "Be

我正在尝试使用HTTP头,以便对我的应用程序进行身份验证,以查询ORCID()公共API。我创建如下标题:

HttpOptions httpOptions = new HttpOptions();
Header contentTypeHeader = new BasicHeader("Content-Type", "application/orcid+json");
Header authorizationHeader = new BasicHeader("Authorization", "Bearer 5266384f-0567-43f0-9cd4-bc6f6a5dc3ea");
Header[] headers = new Header[2];
headers[1] = contentTypeHeader;
headers[2] = authorizationHeader;
httpOptions.setHeaders(headers);
QueryExecution execution = new QueryEngineHTTP(endpoint, query);
但我不知道如何将这些标题放到我的查询中。我这样写我的查询:

HttpOptions httpOptions = new HttpOptions();
Header contentTypeHeader = new BasicHeader("Content-Type", "application/orcid+json");
Header authorizationHeader = new BasicHeader("Authorization", "Bearer 5266384f-0567-43f0-9cd4-bc6f6a5dc3ea");
Header[] headers = new Header[2];
headers[1] = contentTypeHeader;
headers[2] = authorizationHeader;
httpOptions.setHeaders(headers);
QueryExecution execution = new QueryEngineHTTP(endpoint, query);
通过使用org.apache.jena.sparql.engine.http.QueryEngineHTTP

ApacheJena now(v3.1.1及更高版本)提供了通过必要的安全设置传入HttpClient的方法