You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Rob Vesse (JIRA)" <ji...@apache.org> on 2013/03/29 21:53:15 UTC
[jira] [Updated] (JENA-405) srv:serviceContext in QueryEngineHTTP
[ https://issues.apache.org/jira/browse/JENA-405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rob Vesse updated JENA-405:
---------------------------
Fix Version/s: Jena 2.10.1
> srv:serviceContext in QueryEngineHTTP
> -------------------------------------
>
> Key: JENA-405
> URL: https://issues.apache.org/jira/browse/JENA-405
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Affects Versions: ARQ 2.9.2
> Reporter: Martynas Jusevičius
> Assignee: Rob Vesse
> Priority: Minor
> Labels: newdev, patch
> Fix For: Jena 2.10.1
>
> Attachments: QueryEngineHTTP.java
>
> Original Estimate: 20m
> Remaining Estimate: 20m
>
> I'm running SPARQL queries on endpoints with HTTP Basic
> authentication, and am looking for a convenient way to manage and
> configure the credentials.
> Currently I've implemented a simple registry that checks endpoint URIs
> against a map and sets the credentials using
> QueryEngineHTTP.setBasicAuthentication().
> Recently however I came across query Context configuration:
> http://jena.apache.org/documentation/query/service.html
> That seemed exactly what I needed, but there is a problem: it doesn't
> seem to work with basic QueryEngineHTTP? Am I right to assume that
> srv:serviceContext only works with explicit SERVICE endpoints?
> Any reason why the approaches cannot be unified and
> QueryEngineHTTP.setBasicAuthentication() would use the Context? It is
> executing the query against some service after all (even if it's not
> explicit SERVICE). What class(es) would I need to extend to achieve
> this?
> The code I tried on ARQ 2.9.2 (endpoint and credentials are bogus):
> Context sparqlContext = new Context();
> sparqlContext.put(ARQConstants.allocSymbol("http://jena.hpl.hp.com/Service#",
> "queryAuthUser"), "xxxxx");
> sparqlContext.put(ARQConstants.allocSymbol("http://jena.hpl.hp.com/Service#",
> "queryAuthPwd"), "yyyy");
> Map<String,Context> serviceContext = new HashMap<String,Context>();
> serviceContext.put("http://dydra.com/graphity/repository/sparql",
> sparqlContext);
> ARQ.getContext().put(ARQConstants.allocSymbol("http://jena.hpl.hp.com/Service#",
> "serviceContext"), serviceContext);
> ...
> QueryEngineHTTP request =
> QueryExecutionFactory.createServiceRequest(endpointURI, query);
> if (log.isDebugEnabled()) log.debug("SPARQL Context: {} ",
> request.getContext());
> request.execConstruct();
> I see the credentials in the debug output:
> symbol:http://jena.hpl.hp.com/Service#serviceContext =
> {http://dydra.com/graphity/repository/sparql=symbol:http://jena.hpl.hp.com/Service#queryAuthPwd
> = yyyy
> symbol:http://jena.hpl.hp.com/Service#queryAuthUser = xxxxx}
> but the serviceContext doesn't seem to have effect since I'm getting
> 13:21:54,149 TRACE HttpQuery:242 - Exception in exec
> HttpException: 401 Unauthorized
> You need to sign in or sign up before continuing.
> at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:431)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira