Package ddf.catalog.resource.impl
Class URLResourceReader
java.lang.Object
ddf.catalog.resource.impl.URLResourceReader
- All Implemented Interfaces:
ddf.catalog.resource.ResourceReader,ddf.catalog.util.Describable,org.codice.ddf.platform.services.common.Describable
-
Constructor Summary
ConstructorsConstructorDescriptionURLResourceReader(ddf.mime.MimeTypeMapper mimeTypeMapper, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory) URLResourceReader(org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory) Default URLResourceReader constructor. -
Method Summary
Modifier and TypeMethodDescriptionGets the autoRedirect propertygetId()ddf.mime.MimeTypeMappergetOptions(ddf.catalog.data.Metacard metacard) Supported schemes are HTTP, HTTPS, and filegetTitle()protected org.apache.cxf.jaxrs.client.WebClientgetWebClient(URI uri, Map<String, Serializable> properties) ddf.catalog.operation.ResourceResponseretrieveResource(URI resourceURI, Map<String, Serializable> properties) Retrieves aResourcebased on aURIand provided arguments.voidsetFollowRedirects(Boolean redirect) Specifies whether the code should follow server issued redirection (HTTP Response codes between 300 and 400)voidsetMimeTypeMapper(ddf.mime.MimeTypeMapper mimeTypeMapper) voidsetRootResourceDirectories(Set<String> rootResourceDirectoryPaths) Sets the directories that theURLResourceReaderhas permission to access when attempting to download a resource linked by a file URL.
-
Constructor Details
-
URLResourceReader
public URLResourceReader(org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory) Default URLResourceReader constructor. -
URLResourceReader
public URLResourceReader(ddf.mime.MimeTypeMapper mimeTypeMapper, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory)
-
-
Method Details
-
getURLSupportedSchemes
-
getVersion
- Specified by:
getVersionin interfaceddf.catalog.util.Describable- Specified by:
getVersionin interfaceorg.codice.ddf.platform.services.common.Describable
-
getId
- Specified by:
getIdin interfaceddf.catalog.util.Describable- Specified by:
getIdin interfaceorg.codice.ddf.platform.services.common.Describable
-
getTitle
- Specified by:
getTitlein interfaceddf.catalog.util.Describable- Specified by:
getTitlein interfaceorg.codice.ddf.platform.services.common.Describable
-
getDescription
- Specified by:
getDescriptionin interfaceddf.catalog.util.Describable- Specified by:
getDescriptionin interfaceorg.codice.ddf.platform.services.common.Describable
-
getOrganization
- Specified by:
getOrganizationin interfaceddf.catalog.util.Describable- Specified by:
getOrganizationin interfaceorg.codice.ddf.platform.services.common.Describable
-
getSupportedSchemes
Supported schemes are HTTP, HTTPS, and file- Specified by:
getSupportedSchemesin interfaceddf.catalog.resource.ResourceReader- Returns:
- set of supported schemes
-
getMimeTypeMapper
public ddf.mime.MimeTypeMapper getMimeTypeMapper() -
setMimeTypeMapper
public void setMimeTypeMapper(ddf.mime.MimeTypeMapper mimeTypeMapper) -
setRootResourceDirectories
Sets the directories that theURLResourceReaderhas permission to access when attempting to download a resource linked by a file URL.- Parameters:
rootResourceDirectoryPaths- a set of absolute paths specifying which directories theURLResourceReaderhas permission to access when attempting to download resources linked by a file URL. A null or empty input clears all root resource directory paths from theURLResourceReader(this effectively blocks all resource downloads linked by file URLs).
-
getRootResourceDirectories
-
setFollowRedirects
Specifies whether the code should follow server issued redirection (HTTP Response codes between 300 and 400)- Parameters:
redirect- true - follow redirections automatically false - do not follow server issued redirections
-
getFollowRedirects
Gets the autoRedirect property- Returns:
- true if the server issued redirections should be automatically followed
-
retrieveResource
public ddf.catalog.operation.ResourceResponse retrieveResource(URI resourceURI, Map<String, Serializable> properties) throws IOException, ddf.catalog.resource.ResourceNotFoundExceptionRetrieves aResourcebased on aURIand provided arguments. A connection is made to theURIto obtain theResource'sInputStreamand build aResourceResponsefrom that. If theURI's scheme is HTTP or HTTPS, theResource's name gets set to theURIpassed in, otherwise, if it is a file scheme, the name is set to the actual file name.- Specified by:
retrieveResourcein interfaceddf.catalog.resource.ResourceReader- Parameters:
resourceURI- AURIthat defines whatResourceto retrieve and how to do it.properties- Any additional arguments that should be passed to theResourceReader.- Returns:
- A
ResourceResponsecontaining the retrievedResource. - Throws:
IOExceptionddf.catalog.resource.ResourceNotFoundException
-
getWebClient
protected org.apache.cxf.jaxrs.client.WebClient getWebClient(URI uri, Map<String, Serializable> properties) -
getOptions
- Specified by:
getOptionsin interfaceddf.catalog.resource.ResourceReader
-