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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNote: 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) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbyte[]getBytes()inthashCode()longvoidsetHashRepresentation(String hashRepresentation) Methods inherited from class org.springframework.core.io.AbstractResource
contentLength, createRelative, exists, getFile, getFileForLastModifiedCheck, getURI, getURL, isFile, isOpen, isReadable, readableChannel, toString
-
Field Details
-
timeGenerated
protected long timeGenerated -
hashRepresentation
-
source
protected final byte[] source -
description
-
-
Constructor Details
-
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
-
-
Method Details
-
getFilename
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource- Overrides:
getFilenamein classorg.springframework.core.io.AbstractResource
-
lastModified
- Specified by:
lastModifiedin interfaceorg.springframework.core.io.Resource- Overrides:
lastModifiedin classorg.springframework.core.io.AbstractResource- Throws:
IOException
-
getHashRepresentation
-
setHashRepresentation
-
getDescription
- Specified by:
getDescriptionin interfaceorg.springframework.core.io.Resource
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Throws:
IOException
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.springframework.core.io.AbstractResource
-
getBytes
public byte[] getBytes() -
equals
- Overrides:
equalsin classorg.springframework.core.io.AbstractResource
-