Modifier | Constructor and Description |
---|---|
protected |
AbstractFilePacker(java.lang.String extension)
Builds a new file packer using specified options.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilePack(java.lang.String[] relativeFilePaths)
Packs specified files into one and single string.
|
protected static java.util.Set<java.lang.String> |
getFilesInPack(java.lang.String urlPrefix,
java.lang.String paramName,
java.util.Collection<java.lang.String> files,
java.lang.String browserName)
Workaround the browser limitation by distributing many js/css accross several pack.
|
protected abstract org.apache.log4j.Logger |
getLogger()
Returns the logger to be used for log messages.
|
java.io.File |
getMinifiedFile(java.io.File cssOrJsFile,
java.lang.String relativeFilePath)
Retrieve the minified File associated to the specified CSS or JS file.
|
boolean |
minifyFile(java.io.File cssOrJsFile,
boolean force)
Minify the specified CSS file into a compress version if it does not already
exists in an up to date version.
|
protected abstract boolean |
perFileMinificationEnabled()
Check if minification should be performed on each file as opposed to the whole pack.
|
protected abstract java.lang.String |
processFileContent(java.lang.String relativeFilePath,
java.io.File file,
java.lang.String fileContent)
Process file content before adding it to the pack
|
protected abstract java.lang.String |
processPackContent(java.lang.String packContent)
Process the pack content before returning it the pack
|
protected static final Channel channel
protected AbstractFilePacker(java.lang.String extension) throws java.io.IOException
extension
- file extension required to pack filejava.io.IOException
public java.lang.String getFilePack(java.lang.String[] relativeFilePaths)
relativeFilePaths
- an array of path relative to the webapp directorypublic java.io.File getMinifiedFile(java.io.File cssOrJsFile, java.lang.String relativeFilePath)
Example :
If new File("/test/foobar.css");
is specified as parameter, this
method will return new File("/WEB-INF/jcmswork/min.css/test/foobar.css");
This method does not create the file, it simply retrieve the File instance.
cssOrJsFile
- a valid CSS or JS filerelativeFilePath
- the path of the CSS or JS file relative to the webapp rootpublic boolean minifyFile(java.io.File cssOrJsFile, boolean force)
For example, if new File("/test/foobar.min.css");
is specified
as parameter, this checks if new File("/test/foobar.min.css");
(as returned by getMinifiedFile(File, String)
) exists and is up to date, if
it is not it will create it.
cssOrJsFile
- the CSS File to compressforce
- set to true to force generation of minified file even if an up to date apparently existsprotected static java.util.Set<java.lang.String> getFilesInPack(java.lang.String urlPrefix, java.lang.String paramName, java.util.Collection<java.lang.String> files, java.lang.String browserName)
urlPrefix
- the JS/CSS Packer URL previx, eg "css/csspacker.jsp?version=1234", "js/jspacker.jsp?"paramName
- the param name to use eg : "css" or "js"files
- the list of files to packbrowserName
- name of the browser used to find the properties 'channel.packer.xxx' defining the limit values. If null
, use 'IE'
because it's the most constraining.protected abstract java.lang.String processFileContent(java.lang.String relativeFilePath, java.io.File file, java.lang.String fileContent)
relativeFilePath
- the relative path of the file being processedfile
- the file being processedfileContent
- the fileContent as read by the AbstractFilePackerprotected abstract java.lang.String processPackContent(java.lang.String packContent)
packContent
- the whole pack content as computed by the AbstractFilePackerprotected abstract boolean perFileMinificationEnabled()
protected abstract org.apache.log4j.Logger getLogger()
Logger
of this packer, must not return null.Copyright © 2001-2017 Jalios SA. All Rights Reserved.