public class BinaryPage extends Object implements Serializable
Serializable
representation of a resource from the repository as a html page.
The binary page uses the absolute resource path as identifier. The binary data
is optionally stored in a byte array. When done so the binary must be able to fit in memory.Modifier and Type | Class and Description |
---|---|
static class |
BinaryPage.CacheKey |
Constructor and Description |
---|
BinaryPage(String resourcePath)
Create a new binary page.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsData()
Check if the BinaryPage also contains the data next to the meta data.
|
boolean |
equals(Object o) |
BinaryPage.CacheKey |
getCacheKey() |
long |
getCreationTime()
Get the time the binary page cache object was create in milliseconds since epoch.
|
String |
getETag()
Get the ETag
|
String |
getFileName()
Get the unencoded file name to be used for Content-Disposition header
|
long |
getLastModified()
Get the last modified date in milliseconds since epoch.
|
long |
getLength()
Get the data length which can be used for the Content-Length header or cache checks.
|
String |
getMimeType()
Get the mime type for the resource.
|
long |
getNextValidityCheckTimeStamp()
Get the next Validity Check TimeStamp (millis since epoch)
|
String |
getRepositoryPath()
Gets the absolute path of the repository.
|
String |
getResourcePath() |
int |
getStatus()
Get the HTTP status for the resource.
|
InputStream |
getStream()
Get the
InputStream to the byte buffer of the data. |
int |
hashCode() |
boolean |
isCacheable() |
void |
loadDataFromStream(InputStream input)
Read the data from the input stream and close the stream when done.
|
void |
setCacheable(boolean cacheable) |
void |
setCacheKey(BinaryPage.CacheKey cacheKey) |
void |
setFileName(String fileName)
Set the (un-encoded) file name for the Content-Disposition header.
|
void |
setLastModified(long lastModified)
Set the last modification time in milliseconds since epoch.
|
void |
setLength(long length)
Set the size of the binary data.
|
void |
setMimeType(String mimeType)
Set the mime type.
|
void |
setNextValidityCheckTime(long nextValidityCheckTimeStamp)
Set the next validity check timestamp since epoch.
|
void |
setRepositoryPath(String repositoryPath)
Sets the absolute path of the repository.
|
void |
setStatus(int status)
Set the HTTP status.
|
String |
toString() |
public BinaryPage(String resourcePath)
resourcePath
- the absolute path of the resource in the repository.public String getResourcePath()
public String getRepositoryPath()
getResourcePath()
in case
when there are resourceContainers that modify the resourcePath to a different repository pathpublic void setRepositoryPath(String repositoryPath)
getResourcePath()
in case
when there are resourceContainers that modify the resourcePath to a different repository pathpublic int getStatus()
public String getMimeType()
public String getFileName()
public String getETag()
public long getLastModified()
public long getCreationTime()
public long getNextValidityCheckTimeStamp()
public long getLength()
public boolean containsData()
public InputStream getStream()
InputStream
to the byte buffer of the data.public void loadDataFromStream(InputStream input) throws IOException
input
- the input stream to read the data from.IOException
- when an error occurs while copying. The stream will be closed.public boolean isCacheable()
public BinaryPage.CacheKey getCacheKey()
public void setStatus(int status)
status
- public void setMimeType(String mimeType)
mimeType
- public void setFileName(String fileName)
fileName
- public void setNextValidityCheckTime(long nextValidityCheckTimeStamp)
nextValidityCheckTimeStamp
- public void setLastModified(long lastModified)
lastModified
- public void setLength(long length)
length
- the length of the data.public void setCacheable(boolean cacheable)
public void setCacheKey(BinaryPage.CacheKey cacheKey)
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.