Class DefaultHttpLoader
java.lang.Object
no.hasmac.jsonld.loader.DefaultHttpLoader
- All Implemented Interfaces:
DocumentLoader
- Direct Known Subclasses:
HttpLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpClientprivate static final Loggerstatic final intprivate final intprivate static final Stringprivate final DocumentResolver -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpLoader(HttpClient httpClient) DefaultHttpLoader(HttpClient httpClient, int maxRedirections) -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringgetAcceptHeader(Collection<String> profiles) loadDocument(URI uri, DocumentLoaderOptions options) Retrieve a remote document.private Documentresolve(MediaType type, URI targetUri, URI contextUrl, HttpResponse response) voidsetFallbackContentType(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:DocumentLoaderRetrieve a remote document.- Specified by:
loadDocumentin interfaceDocumentLoader- Parameters:
uri- of the remote document to fetchoptions- to set the behavior of the loader- Returns:
Documentrepresenting a remote document- Throws:
JsonLdError
-
getAcceptHeader
-
getAcceptHeader
-
resolve
private Document resolve(MediaType type, URI targetUri, URI contextUrl, HttpResponse response) throws JsonLdError, IOException - Throws:
JsonLdErrorIOException
-
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
-