Class RDF4JHttpClients
java.lang.Object
org.eclipse.rdf4j.http.client.spi.RDF4JHttpClients
Utility class for obtaining
RDF4JHttpClientFactory instances and creating RDF4JHttpClient objects.
Factories are discovered via ServiceLoader. The system property rdf4j.http.client.factory can be used
to select a specific factory by name. If multiple factories are found and no preference is set, the "apache5"
factory is preferred.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSystem property for selecting a specific HTTP client factory by name. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<RDF4JHttpClientFactory> Returns all availableRDF4JHttpClientFactoryinstances.static RDF4JHttpClientFactoryReturns the defaultRDF4JHttpClientFactory.static RDF4JHttpClientFactoryReturns the factory with the given name.static RDF4JHttpClientCreates a newRDF4JHttpClientusing the default factory and default configuration.static RDF4JHttpClientCreates a newRDF4JHttpClientusing the default factory with the given configuration.
-
Field Details
-
FACTORY_PROPERTY
System property for selecting a specific HTTP client factory by name.- See Also:
-
-
Method Details
-
defaultFactory
Returns the defaultRDF4JHttpClientFactory.The factory is chosen as follows:
- If the system property
rdf4j.http.client.factoryis set, use the factory with that name. - If a factory named
"apache5"is available, prefer it. - Otherwise, use the first factory found.
- Returns:
- the default factory.
- Throws:
IllegalStateException- if no factory is found on the classpath.
- If the system property
-
factory
Returns the factory with the given name.- Parameters:
name- the factory name.- Returns:
- the matching factory.
- Throws:
IllegalArgumentException- if no factory with the given name is found.
-
allFactories
Returns all availableRDF4JHttpClientFactoryinstances.- Returns:
- a list of all factories, possibly empty.
-
newDefaultClient
Creates a newRDF4JHttpClientusing the default factory and default configuration.- Returns:
- a new client.
-
newDefaultClient
Creates a newRDF4JHttpClientusing the default factory with the given configuration.- Parameters:
config- the client configuration.- Returns:
- a new client.
-