You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bu...@apache.org on 2016/11/09 15:40:51 UTC

svn commit: r1000822 - in /websites/staging/jena/trunk/content: ./ documentation/query/http-auth.html

Author: buildbot
Date: Wed Nov  9 15:40:51 2016
New Revision: 1000822

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/query/http-auth.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Nov  9 15:40:51 2016
@@ -1 +1 @@
-1768757
+1768990

Modified: websites/staging/jena/trunk/content/documentation/query/http-auth.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/query/http-auth.html (original)
+++ websites/staging/jena/trunk/content/documentation/query/http-auth.html Wed Nov  9 15:40:51 2016
@@ -210,9 +210,17 @@ h2:hover > .headerlink, h3:hover > .head
     <span class="p">.</span><span class="n">setDefaultCookieStore</span><span class="p">(</span><span class="n">cookieStore</span><span class="p">)</span>
     <span class="p">.</span><span class="n">build</span><span class="p">();</span>
 <span class="n">HttpOp</span><span class="p">.</span><span class="n">setDefaultHttpClient</span><span class="p">(</span><span class="n">httpclient</span><span class="p">);</span>
+
+<span class="c1">// alternatively we could use the context directly</span>
+<span class="n">Query</span> <span class="n">query</span> <span class="o">=</span> <span class="p">...</span>
+<span class="n">QueryEngineHTTP</span> <span class="n">qEngine</span> <span class="o">=</span> <span class="n">QueryExecutionFactory</span><span class="p">.</span><span class="n">createServiceRequest</span><span class="p">(</span><span class="s">&quot;http:example.com/someSPARQL&quot;</span><span class="p">,</span> <span class="n">query</span><span class="p">);</span>
+<span class="n">qEngine</span><span class="p">.</span><span class="n">setHttpContext</span><span class="p">(</span><span class="n">httpContext</span><span class="p">);</span>
+<span class="n">ResultSet</span> <span class="n">results</span> <span class="o">=</span> <span class="n">qEngine</span><span class="p">.</span><span class="n">execSelect</span><span class="p">();</span>
 </pre></div>
 
 
+<h3 id="using-authentication-functionality-in-direct-query-execution">Using authentication functionality in direct query execution<a class="headerlink" href="#using-authentication-functionality-in-direct-query-execution" title="Permanent link">&para;</a></h3>
+<p>Jena offers support for <a href="sparql-remote.html#from-your-application">directly creating</a> SPARQL queries against remote services. To use <a href="https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/QueryExecutionFactory.html">QueryExecutionFactory</a> in this case, select the methods (<code>sparqlService</code>, <code>createServiceRequest</code>) that offer an <code>HttpClient</code> parameter and use an authenticating client in that slot. In the case of <a href="http://jena.apache.org/documentation/javadoc/arq/org/apache/jena/sparql/engine/http/QueryEngineHTTP.html">QueryEngineHTTP</a>, it is possible to use constructors that have a parameter slot for an <code>HttpClient</code>, but it is also possible post-construction to use <code>setClient(HttpClient client)</code> and <code>setHttpContext(HttpClientContext context)</code> (as shown above). These techniques allow control over HTTP behavior when requests are made to remote services.</p>
 <h2 id="http-authentication-from-jena-300-through-310">HTTP Authentication from Jena 3.0.0 through 3.1.0<a class="headerlink" href="#http-authentication-from-jena-300-through-310" title="Permanent link">&para;</a></h2>
 <p>APIs that support authentication typically provide two methods for providing authenticators, a <code>setAuthentication(String username, char[] password)</code> method
 which merely configures a <code>SimpleAuthenticator</code>.  There will also be a <code>setAuthenticator(HttpAuthenticator authenticator)</code> method