public class MessageDigestResourceVersion extends Object implements IResourceVersion
IStaticCacheableResource
and uses it as a version string
you can use any message digest algorithm that can be retrieved
by Java Cryptography Architecture (JCA) on your current platform.
Check here
for more information on possible algorithms.Constructor and Description |
---|
MessageDigestResourceVersion()
create an instance of the message digest
resource version provider using algorithm
|
MessageDigestResourceVersion(String algorithm)
create an instance of the message digest resource version provider
using the specified algorithm.
|
MessageDigestResourceVersion(String algorithm,
Bytes bufferSize)
create an instance of the message digest resource version provider
using the specified algorithm.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
computeDigest(InputStream inputStream)
compute digest for resource stream
|
protected MessageDigest |
getMessageDigest()
get instance of message digest provider from JCA
|
String |
getVersion(IStaticCacheableResource resource)
get unique string identifying the version of the resource
|
Pattern |
getVersionPattern()
a pattern that matches returned versions
|
public MessageDigestResourceVersion()
public MessageDigestResourceVersion(String algorithm)
MessageDigest.getInstance(String)
. For digest computation
an internal buffer of up to
bytes will be used.algorithm
- digest algorithmMessageDigestResourceVersion()
,
MessageDigestResourceVersion(String, org.apache.wicket.util.lang.Bytes)
public MessageDigestResourceVersion(String algorithm, Bytes bufferSize)
MessageDigest.getInstance(String)
. For digest computation
an internal buffer with a maximum size specified by parameter
bufferSize
will be used.algorithm
- digest algorithmbufferSize
- maximum size for internal bufferpublic String getVersion(IStaticCacheableResource resource)
IResourceVersion
getVersion
in interface IResourceVersion
resource
- cacheable resourcenull
if version string could not be calculatedpublic Pattern getVersionPattern()
IResourceVersion
getVersionPattern
in interface IResourceVersion
null
if no pattern
is availableprotected MessageDigest getMessageDigest()
protected byte[] computeDigest(InputStream inputStream) throws IOException
inputStream
- input stream to compute message digest forResourceStreamNotFoundException
IOException
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.