Package org.apache.jena.http.sys
Class ExecHTTPBuilder<X,Y>
- java.lang.Object
-
- org.apache.jena.http.sys.ExecHTTPBuilder<X,Y>
-
- Direct Known Subclasses:
QueryExecHTTPBuilder
,QueryExecutionHTTPBuilder
public abstract class ExecHTTPBuilder<X,Y> extends java.lang.Object
Execution builder for remote queries.
-
-
Constructor Summary
Constructors Constructor Description ExecHTTPBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Y
acceptHeader(java.lang.String acceptHeader)
Y
addDefaultGraphURI(java.lang.String uri)
Y
addNamedGraphURI(java.lang.String uri)
X
build()
Y
context(Context context)
Set theContext
.Y
endpoint(java.lang.String serviceURL)
Set the URL of the query endpoint.Y
httpClient(java.net.http.HttpClient httpClient)
Y
httpHeader(java.lang.String headerName, java.lang.String headerValue)
Y
httpHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Y
param(java.lang.String name)
Y
param(java.lang.String name, java.lang.String value)
Y
params(Params other)
Merge inParams
from another object.Y
postQuery()
Send the query request using POST with a Content-Type of as a "application/sparql-query"Y
query(java.lang.String queryStr)
Set the query - the the string must be valid syntax.Y
query(java.lang.String queryStr, Syntax syntax)
Y
query(Query query)
Set the query - this also sets the query string to agree with the query argument.Y
queryString(java.lang.String queryString)
Set the query string - this also clears any Query already set.Y
sendMode(QuerySendMode mode)
Choose how to send the query string over HTTP.Y
set(Symbol symbol, boolean value)
Y
set(Symbol symbol, java.lang.Object value)
Y
substitution(java.lang.String var, Node value)
Y
substitution(Var var, Node value)
Y
substitution(Binding binding)
Y
timeout(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
Set a timeout to the overall overall operation.Y
urlGetLimit(int urlLimit)
Maximum length for a GET request URL, this includes the length of the service endpoint URL - longer than this and the request will use POST/Form.Y
useGet()
Send the query using HTTP GET and the HTTP URL query string regardless of length.Y
useGetWithLimit()
Send the query using HTTP GET and the HTTP URL query string, unless the request exceeds theurlGetLimit(int)
(system defaultHttpEnv.urlLimit
).
-
-
-
Method Detail
-
endpoint
public Y endpoint(java.lang.String serviceURL)
Set the URL of the query endpoint.
-
query
public Y query(Query query)
Set the query - this also sets the query string to agree with the query argument.
-
query
public Y query(java.lang.String queryStr)
Set the query - the the string must be valid syntax. UsequeryString
to pass in a query with other syntax (e.g. the remote end has SPARQL syntax extensions).
-
queryString
public Y queryString(java.lang.String queryString)
Set the query string - this also clears any Query already set. The queryString is not interpreted and it may contain SPARQL syntax extensions supported by the target triple store.
-
addDefaultGraphURI
public Y addDefaultGraphURI(java.lang.String uri)
-
addNamedGraphURI
public Y addNamedGraphURI(java.lang.String uri)
-
httpClient
public Y httpClient(java.net.http.HttpClient httpClient)
-
sendMode
public Y sendMode(QuerySendMode mode)
Choose how to send the query string over HTTP.The default is
QuerySendMode.systemDefault
which isQuerySendMode.asGetWithLimitBody
– send by HTTP GET and a query string unless too long (seeurlLimit
), when it switch to POST and application/sparql-query".- See Also:
QuerySendMode
-
useGetWithLimit
public Y useGetWithLimit()
Send the query using HTTP GET and the HTTP URL query string, unless the request exceeds theurlGetLimit(int)
(system defaultHttpEnv.urlLimit
).If it exceeds the limit, switch to using a HTML form and POST request. By default, queries with a log URL are sent in an HTTP form with POST.
This is the default setting.
- See Also:
urlGetLimit(int)
,useGet()
,postQuery()
-
useGet
public Y useGet()
Send the query using HTTP GET and the HTTP URL query string regardless of length. By default, queries with a long URL are sent in an HTTP POST.
-
postQuery
public Y postQuery()
Send the query request using POST with a Content-Type of as a "application/sparql-query"
-
urlGetLimit
public Y urlGetLimit(int urlLimit)
Maximum length for a GET request URL, this includes the length of the service endpoint URL - longer than this and the request will use POST/Form.Long URLs can be silently truncated by intermediate systems and proxies. Use of the URL query string means that request are not cached.
See also
postQuery()
to send the request using HTTP POST with the query in the POST body usingContent-Type
"application/sparql-query"See also
sendMode
to choose a specific "send" policy.
-
param
public Y param(java.lang.String name)
-
param
public Y param(java.lang.String name, java.lang.String value)
-
acceptHeader
public Y acceptHeader(java.lang.String acceptHeader)
-
httpHeader
public Y httpHeader(java.lang.String headerName, java.lang.String headerValue)
-
httpHeaders
public Y httpHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
-
context
public Y context(Context context)
Set theContext
. This defaults to the global settings ofARQ.getContext()
. If there was a previous call ofcontext
the multiple contexts are merged.
-
timeout
public Y timeout(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
Set a timeout to the overall overall operation. Time-to-connect can be set with a customHttpClient
- seeHttpClient.Builder.connectTimeout(java.time.Duration)
.
-
build
public final X build()
-
-