Package no.hasmac.jsonld.loader
Class DefaultHttpLoader
java.lang.Object
no.hasmac.jsonld.loader.DefaultHttpLoader
- All Implemented Interfaces:
DocumentLoader
- Direct Known Subclasses:
HttpLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpClient
private static final Logger
static final int
private final int
private static final String
private final DocumentResolver
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpLoader
(HttpClient httpClient) DefaultHttpLoader
(HttpClient httpClient, int maxRedirections) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
getAcceptHeader
(Collection<String> profiles) loadDocument
(URI uri, DocumentLoaderOptions options) Retrieve a remote document.private Document
resolve
(MediaType type, URI targetUri, URI contextUrl, HttpResponse response) void
setFallbackContentType
(MediaType fallbackContentType) Set fallback content-type used when received content-type is not supported.
-
Field Details
-
LOGGER
-
MAX_REDIRECTIONS
public static final int MAX_REDIRECTIONS- See Also:
-
PLUS_JSON
- See Also:
-
maxRedirections
private final int maxRedirections -
httpClient
-
resolver
-
-
Constructor Details
-
DefaultHttpLoader
-
DefaultHttpLoader
-
-
Method Details
-
loadDocument
Description copied from interface:DocumentLoader
Retrieve a remote document.- Specified by:
loadDocument
in interfaceDocumentLoader
- Parameters:
uri
- of the remote document to fetchoptions
- to set the behavior of the loader- Returns:
Document
representing a remote document- Throws:
JsonLdError
-
getAcceptHeader
-
getAcceptHeader
-
resolve
private Document resolve(MediaType type, URI targetUri, URI contextUrl, HttpResponse response) throws JsonLdError, IOException - Throws:
JsonLdError
IOException
-
setFallbackContentType
Set fallback content-type used when received content-type is not supported. e.g.setFallbackContentType(MediaType.JSON_LD)
- Parameters:
fallbackContentType
- a content type that overrides unsupported received content-type
-