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 protectedExternalContentHandler(String linkHeader)Construct an ExternalContentHandler (helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamfetchExternalContent()Fetch the external contentlonggetContentSize()Returns the size of the content located at the link headerStringgetContentType()Returns the content type located in the link header.StringgetHandling()Retrieve handling informationURIgetURI()Retrieve URI in link headerStringgetURL()Retrieve url in link headerbooleanisCopy()Returns whether or not the handling parameter is "copy"booleanisProxy()Returns whether or not the handling parameter is "proxy"booleanisRedirect()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:ExternalContentReturns the content type located in the link header.- Specified by:
getContentTypein interfaceExternalContent- Returns:
- content type if in Link header, else null
-
getContentSize
public long getContentSize()
Description copied from interface:ExternalContentReturns the size of the content located at the link header- Specified by:
getContentSizein interfaceExternalContent- Returns:
- content size
-
getHandling
public String getHandling()
Description copied from interface:ExternalContentRetrieve handling information- Specified by:
getHandlingin interfaceExternalContent- Returns:
- a String containing the type of handling requested ["proxy", "copy" or "redirect"]
-
getURL
public String getURL()
Description copied from interface:ExternalContentRetrieve url in link header- Specified by:
getURLin interfaceExternalContent- Returns:
- a String of the URL that was in the Link header
-
getURI
public URI getURI()
Description copied from interface:ExternalContentRetrieve URI in link header- Specified by:
getURIin interfaceExternalContent- Returns:
- a URI to the external content
-
isCopy
public boolean isCopy()
Description copied from interface:ExternalContentReturns whether or not the handling parameter is "copy"- Specified by:
isCopyin interfaceExternalContent- Returns:
- boolean value representing whether or not the content handling is "copy"
-
isRedirect
public boolean isRedirect()
Description copied from interface:ExternalContentReturns whether or not the handling parameter is "redirect"- Specified by:
isRedirectin interfaceExternalContent- Returns:
- boolean value representing whether or not the content handling is "redirect"
-
isProxy
public boolean isProxy()
Description copied from interface:ExternalContentReturns whether or not the handling parameter is "proxy"- Specified by:
isProxyin interfaceExternalContent- Returns:
- boolean value representing whether or not the content handling is "proxy"
-
fetchExternalContent
public InputStream fetchExternalContent()
Description copied from interface:ExternalContentFetch the external content- Specified by:
fetchExternalContentin interfaceExternalContent- Returns:
- InputStream containing the external content
-
-