public class URLResourceReader extends Object implements ResourceReader
Constructor and Description |
---|
URLResourceReader()
Default URLResourceReader constructor.
|
URLResourceReader(MimeTypeMapper mimeTypeMapper) |
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Returns a description of the describable item.
|
Boolean |
getFollowRedirects()
Gets the autoRedirect property
|
String |
getId()
Returns the name, aka ID, of the describable item.
|
MimeTypeMapper |
getMimeTypeMapper() |
Set<String> |
getOptions(Metacard metacard)
Obtain a set of all options supported by this ResourceReader.
|
String |
getOrganization()
Returns the organization associated with the describable item.
|
Set<String> |
getRootResourceDirectories() |
Set<String> |
getSupportedSchemes()
Supported schemes are HTTP, HTTPS, and file
|
String |
getTitle()
Returns the title of the describable item.
|
Set<String> |
getURLSupportedSchemes() |
String |
getVersion()
Retrieve the version.
|
protected org.apache.cxf.jaxrs.client.WebClient |
getWebClient(String uri,
Map<String,Serializable> properties) |
ResourceResponse |
retrieveResource(URI resourceURI,
Map<String,Serializable> properties)
|
void |
setFollowRedirects(Boolean redirect)
Specifies whether the code should follow server issued redirection (HTTP Response codes between
300 and 400)
|
void |
setMimeTypeMapper(MimeTypeMapper mimeTypeMapper) |
void |
setRootResourceDirectories(Set<String> rootResourceDirectoryPaths)
Sets the directories that the
URLResourceReader has permission to access when
attempting to download a resource linked by a file URL. |
public URLResourceReader()
public URLResourceReader(MimeTypeMapper mimeTypeMapper)
public String getVersion()
Describable
getVersion
in interface Describable
public String getId()
Describable
html for a MetacardTransformer
that transforms Metacard
s to HTML
getId
in interface Describable
public String getTitle()
Describable
getTitle
in interface Describable
public String getDescription()
Describable
getDescription
in interface Describable
public String getOrganization()
Describable
getOrganization
in interface Describable
public Set<String> getSupportedSchemes()
getSupportedSchemes
in interface ResourceReader
public MimeTypeMapper getMimeTypeMapper()
public void setMimeTypeMapper(MimeTypeMapper mimeTypeMapper)
public void setRootResourceDirectories(Set<String> rootResourceDirectoryPaths)
URLResourceReader
has permission to access when
attempting to download a resource linked by a file URL.rootResourceDirectoryPaths
- a set of absolute paths specifying which directories the
URLResourceReader
has 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
the URLResourceReader
(this effectively blocks all resource downloads linked by
file URLs).public void setFollowRedirects(Boolean redirect)
redirect
- true - follow redirections automatically false - do not follow server issued
redirectionspublic Boolean getFollowRedirects()
public ResourceResponse retrieveResource(URI resourceURI, Map<String,Serializable> properties) throws IOException, ResourceNotFoundException
Resource
based on a URI
and provided
arguments. A connection is made to the URI
to obtain the Resource
's InputStream
and build a ResourceResponse
from
that. If the URI
's scheme is HTTP or HTTPS, the Resource
's
name gets set to the URI
passed in, otherwise, if it is a file scheme, the name is set
to the actual file name.retrieveResource
in interface ResourceReader
resourceURI
- A URI
that defines what Resource
to
retrieve and how to do it.properties
- Any additional arguments that should be passed to the ResourceReader
.ResourceResponse
containing the retrieved Resource
.IOException
ResourceNotFoundException
protected org.apache.cxf.jaxrs.client.WebClient getWebClient(String uri, Map<String,Serializable> properties)
public Set<String> getOptions(Metacard metacard)
ResourceReader
Resource
in a unique way.getOptions
in interface ResourceReader
Set
of all options that this ResourceReader supports. This will be an empty set
if no options are supported.This work is licensed under a Creative Commons Attribution 4.0 International License.