Class SassResourceHandler
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.resources.DefaultResourceHandler
-
- org.ametys.plugins.core.ui.resources.AbstractCompiledResourceHandler
-
- org.ametys.plugins.core.ui.resources.css.sass.SassResourceHandler
-
- All Implemented Interfaces:
ResourceHandler
,LogEnabled
,Component
,Serviceable
public class SassResourceHandler extends AbstractCompiledResourceHandler
Reader for SASS files, compile them on the fly into CSS files, and minimize them if location in .min.css
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_minimize
protected ProxiedContextPathProvider
_proxiedContextPathProvider
Proxied context path providerprotected ResourceDependenciesListExtensionPoint
_resourceDependenciesListEP
ResourceDependenciesListExtensionPointprotected SassImportHelper
_sassImportHelper
Sass import helperprivate String
_sassLocation
protected MinimizeSassManager
_sassMinimizeManager
CSS minimize manager-
Fields inherited from class org.ametys.core.resources.DefaultResourceHandler
_objectModel, _parameters, _readForDownload, _requestedLocation, _resolver, _source
-
-
Constructor Summary
Constructors Constructor Description SassResourceHandler(Source source, String sassLocation)
Constructor with an already resolvedSource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generate(OutputStream out)
Generate the resource configured during setup, and output itprotected List<String>
getDependenciesList(Source inputSource)
Calculate the list of dependencies for the given source, for validity calculations.Serializable
getKey()
Get the unique key for this resource, for cache purpose.String
getMimeType()
Return the mime type of the configured resource.void
service(ServiceManager manager)
Source
setup(String location, Map objectModel, Parameters par, boolean readForDownload)
Initialize the resource handler with a resource.-
Methods inherited from class org.ametys.plugins.core.ui.resources.AbstractCompiledResourceHandler
getValidity
-
Methods inherited from class org.ametys.core.resources.DefaultResourceHandler
getLastModified, getLength
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.resources.ResourceHandler
shouldUseSourceContentLength
-
-
-
-
Field Detail
-
_resourceDependenciesListEP
protected ResourceDependenciesListExtensionPoint _resourceDependenciesListEP
ResourceDependenciesListExtensionPoint
-
_sassMinimizeManager
protected MinimizeSassManager _sassMinimizeManager
CSS minimize manager
-
_sassImportHelper
protected SassImportHelper _sassImportHelper
Sass import helper
-
_proxiedContextPathProvider
protected ProxiedContextPathProvider _proxiedContextPathProvider
Proxied context path provider
-
_minimize
private boolean _minimize
-
_sassLocation
private String _sassLocation
-
-
Constructor Detail
-
SassResourceHandler
public SassResourceHandler(Source source, String sassLocation)
Constructor with an already resolvedSource
.- Parameters:
source
- the sourcesassLocation
- the uri of the sass source
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classDefaultResourceHandler
- Throws:
ServiceException
-
setup
public Source setup(String location, Map objectModel, Parameters par, boolean readForDownload) throws ProcessingException, IOException
Description copied from interface:ResourceHandler
Initialize the resource handler with a resource.- Specified by:
setup
in interfaceResourceHandler
- Overrides:
setup
in classDefaultResourceHandler
- Parameters:
location
- The source uriobjectModel
- The object modelpar
- The parametersreadForDownload
- if the resource is to be downloaded and not rendered.- Returns:
- the resolved source
- Throws:
ProcessingException
- If an error occursIOException
- If an error occurs
-
generate
public void generate(OutputStream out) throws IOException, ProcessingException
Description copied from interface:ResourceHandler
Generate the resource configured during setup, and output it- Specified by:
generate
in interfaceResourceHandler
- Overrides:
generate
in classDefaultResourceHandler
- Parameters:
out
- The output stream to write to- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
getDependenciesList
protected List<String> getDependenciesList(Source inputSource)
Description copied from class:AbstractCompiledResourceHandler
Calculate the list of dependencies for the given source, for validity calculations.- Specified by:
getDependenciesList
in classAbstractCompiledResourceHandler
- Parameters:
inputSource
- The source- Returns:
- The list of uri
-
getKey
public Serializable getKey()
Description copied from interface:ResourceHandler
Get the unique key for this resource, for cache purpose.- Specified by:
getKey
in interfaceResourceHandler
- Overrides:
getKey
in classAbstractCompiledResourceHandler
- Returns:
- The cache key.
-
getMimeType
public String getMimeType()
Description copied from interface:ResourceHandler
Return the mime type of the configured resource.- Specified by:
getMimeType
in interfaceResourceHandler
- Overrides:
getMimeType
in classDefaultResourceHandler
- Returns:
- The mime type.
-
-