Package com.flowlogix.ui
Class MinimizedHandler
java.lang.Object
javax.faces.application.ResourceHandler
javax.faces.application.ResourceHandlerWrapper
org.omnifaces.resourcehandler.DefaultResourceHandler
com.flowlogix.ui.MinimizedHandler
- All Implemented Interfaces:
javax.faces.FacesWrapper<javax.faces.application.ResourceHandler>
public class MinimizedHandler
extends org.omnifaces.resourcehandler.DefaultResourceHandler
Automatically transforms CSS / JS, etc. resource URLs to there minimized versions in non-development mode.
In it's default form, it will transform my.js into my.min.js or my.css into my.min.css
This works for JSF resource references only, as this is a JSF handler
Works together with Maven minimize plugin, or other build tools what will generate minimized versions of resources. Requires that all resources have their minimized versions generated in production mode, otherwise links will point to files that do not exist.
Example:
faces-config.xml:<application> <resource-handler>com.flowlogix.ui.MinimizedHandler</resource-handler> </application>web.xml:<!-- Optional, default is "min" --> <context-param> <param-name>com.flowlogix.MINIMIZED_PREFIX</param-name> <param-value>minimized</param-value> </context-param> <!-- Optional, default is "css,js" --> <context-param> <param-name>com.flowlogix.MINIMIZED_FILE_TYPES</param-name> <param-value>css,js,tsx, sass, less</param-value> </context-param>
- Author:
- lprimak
-
Field Summary
Fields inherited from class org.omnifaces.resourcehandler.DefaultResourceHandler
RES_NOT_FOUNDFields inherited from class javax.faces.application.ResourceHandler
JSF_SCRIPT_LIBRARY_NAME, JSF_SCRIPT_RESOURCE_NAME, LOCALE_PREFIX, RESOURCE_CONTRACT_XML, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER, WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.faces.application.ResourcedecorateResource(javax.faces.application.Resource resource) Methods inherited from class org.omnifaces.resourcehandler.DefaultResourceHandler
createResource, createResource, createResource, createResourceFromLibrary, decorateResource, getLibraryNameMethods inherited from class javax.faces.application.ResourceHandlerWrapper
createResourceFromId, createViewResource, getRendererTypeForResourceName, getViewResources, getViewResources, getWrapped, handleResourceRequest, isResourceRendered, isResourceRequest, isResourceURL, libraryExists, markResourceRendered
-
Constructor Details
-
MinimizedHandler
public MinimizedHandler(javax.faces.application.ResourceHandler wrapped)
-
-
Method Details
-
decorateResource
public javax.faces.application.Resource decorateResource(javax.faces.application.Resource resource) - Overrides:
decorateResourcein classorg.omnifaces.resourcehandler.DefaultResourceHandler
-