Package org.fcrepo.http.api
Class ExternalContentHandler
- java.lang.Object
-
- org.fcrepo.http.api.ExternalContentHandler
-
- All Implemented Interfaces:
ExternalContent
public class ExternalContentHandler extends Object implements ExternalContent
This class is a helper for dealing with the External Content Link header and External Content itself, in the case of handling="copy". This class will verify that an External Content Link header is formatted correctly and help parse it, delivering parts of it when asked.- Since:
- 5/7/2018
- Author:
- bseeger
-
-
Field Summary
-
Fields inherited from interface org.fcrepo.kernel.api.models.ExternalContent
COPY, PROXY, REDIRECT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExternalContentHandler(String linkHeader)
Construct an ExternalContentHandler (helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
fetchExternalContent()
Fetch the external contentlong
getContentSize()
Returns the size of the content located at the link headerString
getContentType()
Returns the content type located in the link header.String
getHandling()
Retrieve handling informationURI
getURI()
Retrieve URI in link headerString
getURL()
Retrieve url in link headerboolean
isCopy()
Returns whether or not the handling parameter is "copy"boolean
isProxy()
Returns whether or not the handling parameter is "proxy"boolean
isRedirect()
Returns whether or not the handling parameter is "redirect"
-
-
-
Constructor Detail
-
ExternalContentHandler
protected ExternalContentHandler(String linkHeader)
Construct an ExternalContentHandler (helper)- Parameters:
linkHeader
- actual link header from request
-
-
Method Detail
-
getContentType
public String getContentType()
Description copied from interface:ExternalContent
Returns the content type located in the link header.- Specified by:
getContentType
in interfaceExternalContent
- Returns:
- content type if in Link header, else null
-
getContentSize
public long getContentSize()
Description copied from interface:ExternalContent
Returns the size of the content located at the link header- Specified by:
getContentSize
in interfaceExternalContent
- Returns:
- content size
-
getHandling
public String getHandling()
Description copied from interface:ExternalContent
Retrieve handling information- Specified by:
getHandling
in interfaceExternalContent
- Returns:
- a String containing the type of handling requested ["proxy", "copy" or "redirect"]
-
getURL
public String getURL()
Description copied from interface:ExternalContent
Retrieve url in link header- Specified by:
getURL
in interfaceExternalContent
- Returns:
- a String of the URL that was in the Link header
-
getURI
public URI getURI()
Description copied from interface:ExternalContent
Retrieve URI in link header- Specified by:
getURI
in interfaceExternalContent
- Returns:
- a URI to the external content
-
isCopy
public boolean isCopy()
Description copied from interface:ExternalContent
Returns whether or not the handling parameter is "copy"- Specified by:
isCopy
in interfaceExternalContent
- Returns:
- boolean value representing whether or not the content handling is "copy"
-
isRedirect
public boolean isRedirect()
Description copied from interface:ExternalContent
Returns whether or not the handling parameter is "redirect"- Specified by:
isRedirect
in interfaceExternalContent
- Returns:
- boolean value representing whether or not the content handling is "redirect"
-
isProxy
public boolean isProxy()
Description copied from interface:ExternalContent
Returns whether or not the handling parameter is "proxy"- Specified by:
isProxy
in interfaceExternalContent
- Returns:
- boolean value representing whether or not the content handling is "proxy"
-
fetchExternalContent
public InputStream fetchExternalContent()
Description copied from interface:ExternalContent
Fetch the external content- Specified by:
fetchExternalContent
in interfaceExternalContent
- Returns:
- InputStream containing the external content
-
-