public class DocumentLoader extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACCEPT_HEADER
An HTTP Accept header that prefers JSONLD.
|
protected static org.apache.http.impl.client.CloseableHttpClient |
defaultHttpClient |
static String |
DISALLOW_REMOTE_CONTEXT_LOADING
Identifies a system property that can be set to "true" in order to
disallow remote context loading.
|
Constructor and Description |
---|
DocumentLoader() |
Modifier and Type | Method and Description |
---|---|
protected static org.apache.http.impl.client.CloseableHttpClient |
createDefaultHttpClient() |
Object |
fromURL(URL url)
Returns a Map, List, or String containing the contents of the JSON
resource resolved from the JsonLdUrl.
|
protected static org.apache.http.impl.client.CloseableHttpClient |
getDefaultHttpClient() |
org.apache.http.impl.client.CloseableHttpClient |
getHttpClient() |
RemoteDocument |
loadDocument(String url) |
InputStream |
openStreamFromURL(URL url)
Opens an
InputStream for the given URL ,
including support for http and https URLs that are requested using
Content Negotiation with application/ld+json as the preferred content
type. |
void |
setHttpClient(org.apache.http.impl.client.CloseableHttpClient nextHttpClient) |
public static final String DISALLOW_REMOTE_CONTEXT_LOADING
public static final String ACCEPT_HEADER
protected static volatile org.apache.http.impl.client.CloseableHttpClient defaultHttpClient
public RemoteDocument loadDocument(String url) throws JsonLdError
JsonLdError
public Object fromURL(URL url) throws com.fasterxml.jackson.core.JsonParseException, IOException
url
- The JsonLdUrl to resolvecom.fasterxml.jackson.core.JsonParseException
- If the JSON was not valid.IOException
- If there was an error resolving the resource.public InputStream openStreamFromURL(URL url) throws IOException
InputStream
for the given URL
,
including support for http and https URLs that are requested using
Content Negotiation with application/ld+json as the preferred content
type.url
- The URL
identifying the source.IOException
- If there was an error resolving the URL
.protected static org.apache.http.impl.client.CloseableHttpClient getDefaultHttpClient()
protected static org.apache.http.impl.client.CloseableHttpClient createDefaultHttpClient()
public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
public void setHttpClient(org.apache.http.impl.client.CloseableHttpClient nextHttpClient)
Copyright © 2019. All rights reserved.