ro.isdc.wro.model.resource.support.naming
Class DefaultHashEncoderNamingStrategy

java.lang.Object
  extended by ro.isdc.wro.model.resource.support.naming.DefaultHashEncoderNamingStrategy
All Implemented Interfaces:
NamingStrategy

public class DefaultHashEncoderNamingStrategy
extends Object
implements NamingStrategy

Encodes the hash into the folder where the resources is located. Example: original name: group.js renamed: group-a912810be321.js

Since:
1.4.9
Author:
Alex Objelean

Field Summary
static String ALIAS
           
 
Constructor Summary
DefaultHashEncoderNamingStrategy()
           
 
Method Summary
protected  HashStrategy getHashStrategy()
           
 String rename(String originalName, InputStream inputStream)
          Creates a new name of the resource which encodes a version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIAS

public static final String ALIAS
See Also:
Constant Field Values
Constructor Detail

DefaultHashEncoderNamingStrategy

public DefaultHashEncoderNamingStrategy()
Method Detail

getHashStrategy

protected HashStrategy getHashStrategy()
Returns:
the HashStrategy to use for renaming. By default the used strategy is the same as the one configured by wro4j. Override this method to provide a custom HashStrategy.

rename

public String rename(String originalName,
                     InputStream inputStream)
              throws IOException
Creates a new name of the resource which encodes a version.

Specified by:
rename in interface NamingStrategy
Parameters:
originalName - original name of the resource.
inputStream - the stream of the content to rename.
Returns:
new name of the resource with version encoded.
Throws:
IOException - if there are stream reading problem.


Copyright © 2008-2013. All Rights Reserved.