Class ResourceMinificationServiceImpl
java.lang.Object
org.broadleafcommerce.common.resource.service.ResourceMinificationServiceImpl
- All Implemented Interfaces:
ResourceMinificationService
@Service("blResourceMinificationService")
public class ResourceMinificationServiceImpl
extends Object
implements ResourceMinificationService
- Author:
- Andre Azzolini (apazzolini)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
static String
static String
protected CssMinificationService
protected org.springframework.core.env.Environment
static String
static String
protected JavascriptMinificationService
protected static final org.apache.commons.logging.Log
protected static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether or not the system is allowed to minify bundled resources.protected String
getFileType
(org.springframework.core.io.Resource originalResource, String filename) Return a SupportedFileTypeprotected boolean
isPreviouslyMinifiedFile
(org.springframework.core.io.Resource originalResource) protected void
minify
(BufferedReader in, BufferedWriter out, String filename, String type) byte[]
Given the source byte[], will return a byte[] that represents the minified version of the byte[]org.springframework.core.io.Resource
minify
(org.springframework.core.io.Resource originalResource) Delegates toResourceMinificationService.minify(Resource, String)
where the filename argument is originalResource.getFilename().org.springframework.core.io.Resource
Given aResource
, will return a resource that represents the minified version.
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOG -
MINIFICATION_IS_DISABLED_RETURNING_ORIGINAL_RESOURCE
- See Also:
-
COULD_NOT_MINIFY_RESOURCES_RETURNED_UNMINIFIED_BYTES
- See Also:
-
CSS_TYPE
-
JS_TYPE
-
JS_MIN
-
CSS_MIN
-
environment
@Autowired protected org.springframework.core.env.Environment environment -
jsMinificationService
-
cssMinificationService
-
-
Constructor Details
-
ResourceMinificationServiceImpl
public ResourceMinificationServiceImpl()
-
-
Method Details
-
getEnabled
public boolean getEnabled()Description copied from interface:ResourceMinificationService
Indicates whether or not the system is allowed to minify bundled resources.- Specified by:
getEnabled
in interfaceResourceMinificationService
- Returns:
- the value of the system property "minify.enabled"
-
minify
Description copied from interface:ResourceMinificationService
Given the source byte[], will return a byte[] that represents the minified version of the byte[]- Specified by:
minify
in interfaceResourceMinificationService
- Returns:
- the minified bytes
-
minify
public org.springframework.core.io.Resource minify(org.springframework.core.io.Resource originalResource) Description copied from interface:ResourceMinificationService
Delegates toResourceMinificationService.minify(Resource, String)
where the filename argument is originalResource.getFilename().- Specified by:
minify
in interfaceResourceMinificationService
- Returns:
-
minify
public org.springframework.core.io.Resource minify(org.springframework.core.io.Resource originalResource, String filename) Description copied from interface:ResourceMinificationService
Given aResource
, will return a resource that represents the minified version.- Specified by:
minify
in interfaceResourceMinificationService
- Returns:
- The minified resource
-
minify
protected void minify(BufferedReader in, BufferedWriter out, String filename, String type) throws IOException - Throws:
IOException
-
getFileType
protected String getFileType(org.springframework.core.io.Resource originalResource, String filename) Return a SupportedFileType- Parameters:
originalResource
-filename
-- Returns:
-
isPreviouslyMinifiedFile
protected boolean isPreviouslyMinifiedFile(org.springframework.core.io.Resource originalResource)
-