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.cache.CachingHttpClient |
defaultHttpClient |
Constructor and Description |
---|
DocumentLoader() |
Modifier and Type | Method and Description |
---|---|
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.client.HttpClient |
getDefaultHttpClient() |
org.apache.http.client.HttpClient |
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.client.HttpClient nextHttpClient) |
public static final String ACCEPT_HEADER
protected static volatile org.apache.http.impl.client.cache.CachingHttpClient 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.client.HttpClient getDefaultHttpClient()
public org.apache.http.client.HttpClient getHttpClient()
public void setHttpClient(org.apache.http.client.HttpClient nextHttpClient)
Copyright © 2015. All rights reserved.