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 Stringstatic Stringstatic Stringprotected CssMinificationServiceprotected org.springframework.core.env.Environmentstatic Stringstatic Stringprotected JavascriptMinificationServiceprotected static final org.apache.commons.logging.Logprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether or not the system is allowed to minify bundled resources.protected StringgetFileType(org.springframework.core.io.Resource originalResource, String filename) Return a SupportedFileTypeprotected booleanisPreviouslyMinifiedFile(org.springframework.core.io.Resource originalResource) protected voidminify(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.Resourceminify(org.springframework.core.io.Resource originalResource) Delegates toResourceMinificationService.minify(Resource, String)where the filename argument is originalResource.getFilename().org.springframework.core.io.ResourceGiven 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:ResourceMinificationServiceIndicates whether or not the system is allowed to minify bundled resources.- Specified by:
getEnabledin interfaceResourceMinificationService- Returns:
- the value of the system property "minify.enabled"
-
minify
Description copied from interface:ResourceMinificationServiceGiven the source byte[], will return a byte[] that represents the minified version of the byte[]- Specified by:
minifyin interfaceResourceMinificationService- Returns:
- the minified bytes
-
minify
public org.springframework.core.io.Resource minify(org.springframework.core.io.Resource originalResource) Description copied from interface:ResourceMinificationServiceDelegates toResourceMinificationService.minify(Resource, String)where the filename argument is originalResource.getFilename().- Specified by:
minifyin interfaceResourceMinificationService- Returns:
-
minify
public org.springframework.core.io.Resource minify(org.springframework.core.io.Resource originalResource, String filename) Description copied from interface:ResourceMinificationServiceGiven aResource, will return a resource that represents the minified version.- Specified by:
minifyin 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)
-