Class AbstractCompiledResourceHandler
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.resources.DefaultResourceHandler
-
- org.ametys.plugins.core.ui.resources.AbstractCompiledResourceHandler
-
- All Implemented Interfaces:
ResourceHandler
,LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
LessResourceHandler
,SassResourceHandler
,VueJsResourceHandler
public abstract class AbstractCompiledResourceHandler extends DefaultResourceHandler implements Component
Abstract reader for resources compiled during runtime, such as SASS or LESS files compiled into CSS.
-
-
Field Summary
Fields Modifier and Type Field Description private static Map<String,Pair<List<String>,Long>>
_dependenciesCache
-
Fields inherited from class org.ametys.core.resources.DefaultResourceHandler
_objectModel, _parameters, _readForDownload, _requestedLocation, _resolver, _source
-
-
Constructor Summary
Constructors Constructor Description AbstractCompiledResourceHandler(Source source)
Constructor with an already resolvedSource
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private Long
_getCalculatedLastModified(Source inputSource, String sourceUri, long lastModified, HashMap<String,String> knowDependencies)
private List<String>
_getDependencies(Source inputSource, String sourceUri, long lastModified)
private String
_getDependenciesKeys(Source inputSource, String sourceUri, String fileURI, long lastModified, HashMap<String,String> knowDependencies)
private String
_getDependencyURI(String sourceUri, String dependency)
protected abstract 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.SourceValidity
getValidity()
Get the resource validity, for cache purpose.-
Methods inherited from class org.ametys.core.resources.DefaultResourceHandler
generate, getLastModified, getLength, getMimeType, service, setup
-
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
-
-
-
-
Constructor Detail
-
AbstractCompiledResourceHandler
public AbstractCompiledResourceHandler(Source source)
Constructor with an already resolvedSource
.- Parameters:
source
- the source
-
-
Method Detail
-
getDependenciesList
protected abstract List<String> getDependenciesList(Source inputSource)
Calculate the list of dependencies for the given source, for validity calculations.- 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 classDefaultResourceHandler
- Returns:
- The cache key.
-
getValidity
public SourceValidity getValidity()
Description copied from interface:ResourceHandler
Get the resource validity, for cache purpose.- Specified by:
getValidity
in interfaceResourceHandler
- Overrides:
getValidity
in classDefaultResourceHandler
- Returns:
- The resource validity.
-
_getCalculatedLastModified
private Long _getCalculatedLastModified(Source inputSource, String sourceUri, long lastModified, HashMap<String,String> knowDependencies)
-
_getDependenciesKeys
private String _getDependenciesKeys(Source inputSource, String sourceUri, String fileURI, long lastModified, HashMap<String,String> knowDependencies)
-
_getDependencyURI
private String _getDependencyURI(String sourceUri, String dependency) throws URISyntaxException
- Throws:
URISyntaxException
-
_getDependencies
private List<String> _getDependencies(Source inputSource, String sourceUri, long lastModified)
-
-