org.broadleafcommerce.common.resource
Class GeneratedResource
java.lang.Object
org.springframework.core.io.AbstractResource
org.broadleafcommerce.common.resource.GeneratedResource
- All Implemented Interfaces:
- Serializable, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource
public class GeneratedResource
- extends org.springframework.core.io.AbstractResource
- implements Serializable
An in memory generated resource. This class also overrides some parent Spring AbstractResource methods to ensure
compatibility with the ResourceHttpRequestHandler.
Note that this class intentionally does not subclass Spring's InMemoryResource and instead has copied
the fields here because InMemoryResource does not provide a default constructor. This causes issues when
deserializing an instance from disk (such as in a caching scenario that overflows from memory to disk).
- Author:
- Andre Azzolini (apazzolini)
- See Also:
- Serialized Form
|
Constructor Summary |
GeneratedResource()
Note: This constructor should not be explicitly used
To properly allow for serialization, we must provide this no-arg constructor that will
create a "dummy" GeneratedResource. |
GeneratedResource(byte[] source,
String description)
|
| Methods inherited from class org.springframework.core.io.AbstractResource |
contentLength, createRelative, exists, getFile, getFileForLastModifiedCheck, getURI, getURL, isOpen, isReadable, toString |
timeGenerated
protected long timeGenerated
hashRepresentation
protected String hashRepresentation
source
protected final byte[] source
description
protected final String description
GeneratedResource
public GeneratedResource()
- Note: This constructor should not be explicitly used
To properly allow for serialization, we must provide this no-arg constructor that will
create a "dummy" GeneratedResource. The appropriate fields will be set during deserialization.
GeneratedResource
public GeneratedResource(byte[] source,
String description)
getFilename
public String getFilename()
- Specified by:
getFilename in interface org.springframework.core.io.Resource- Overrides:
getFilename in class org.springframework.core.io.AbstractResource
lastModified
public long lastModified()
throws IOException
- Specified by:
lastModified in interface org.springframework.core.io.Resource- Overrides:
lastModified in class org.springframework.core.io.AbstractResource
- Throws:
IOException
getHashRepresentation
public String getHashRepresentation()
setHashRepresentation
public void setHashRepresentation(String hashRepresentation)
getDescription
public String getDescription()
- Specified by:
getDescription in interface org.springframework.core.io.Resource
getInputStream
public InputStream getInputStream()
throws IOException
- Specified by:
getInputStream in interface org.springframework.core.io.InputStreamSource
- Throws:
IOException
hashCode
public int hashCode()
- Overrides:
hashCode in class org.springframework.core.io.AbstractResource
equals
public boolean equals(Object res)
- Overrides:
equals in class org.springframework.core.io.AbstractResource
Copyright © 2013. All Rights Reserved.