public abstract class AbstractMinimizeManager extends AbstractLogEnabled implements Serviceable
| Modifier and Type | Field and Description |
|---|---|
private static Pattern |
__SOURCEMAP_SOURCE_NAME |
protected ProxiedContextPathProvider |
_proxiedContextPathProvider
The proxied context path provider
|
protected SourceResolver |
_resolver
Ametys source resolver
|
protected SourceMapCache |
_sourceMapCache
The source map cache component
|
private static Pattern |
SOURCE_MAP_SOURCE |
| Constructor and Description |
|---|
AbstractMinimizeManager() |
| Modifier and Type | Method and Description |
|---|---|
private void |
_generateSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator,
StringBuffer sb,
String fileName,
String sourceMapName,
boolean generateSourceMap) |
protected abstract void |
addSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator,
int lineCount,
String fileContent,
String fileUri,
String sourceMapUri)
Aggregate the source map of the single file with the others
|
protected String |
applyMediaToContent(String content,
String media)
Defaut implementation to apply a media to a content.
|
protected String |
convertSourceMapURIs(String content,
String uri)
Convert the source map "sources" attribute by correcting the path of those values
|
protected abstract String |
formatSourceMappingURL(String sourceMapName)
Format a source mapping URL to be added at the end of a minimized file
|
protected abstract String |
getMinimizedContent(String uri,
String nestedParentFilesName)
Get the minimized content at the specified URI
|
protected abstract String |
getSourceMappingURL(String line)
Get the source mapping URL value from the line
|
protected abstract boolean |
isSourceMappingURLLine(String line)
Test if the line contains a source mapping URL
|
String |
minimizeAndAggregateURIs(List<HashCache.UriData> uris,
String fileName,
boolean generateSourceMap)
Compile a list of css URI, store the generated source map and returns the minimized concatenated result
|
protected abstract String |
removeSourceMappingURLLine(String content)
Remove the source mapping url from the content
|
void |
service(ServiceManager smanager) |
void |
validateAndOutputMinimizedFile(Source source,
OutputStream out,
String sourceUri)
Validate a source, fix it if required, and output the result to the output stream.
|
getLogger, setLoggerprivate static final Pattern __SOURCEMAP_SOURCE_NAME
private static final Pattern SOURCE_MAP_SOURCE
protected SourceMapCache _sourceMapCache
protected ProxiedContextPathProvider _proxiedContextPathProvider
protected SourceResolver _resolver
public AbstractMinimizeManager()
public void service(ServiceManager smanager) throws ServiceException
service in interface ServiceableServiceExceptionpublic String minimizeAndAggregateURIs(List<HashCache.UriData> uris, String fileName, boolean generateSourceMap)
uris - The URIs to compile, e.g a list of mixed .min.css and .css URIsfileName - The name of the result without extension, e.g. HASHgenerateSourceMap - True to generate the source mapprotected String applyMediaToContent(String content, String media)
content - The contentmedia - The mediaprivate void _generateSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator, StringBuffer sb, String fileName, String sourceMapName, boolean generateSourceMap)
protected String convertSourceMapURIs(String content, String uri) throws URISyntaxException
content - The source map contenturi - The URI (without context path)URISyntaxException - If an error occurredpublic void validateAndOutputMinimizedFile(Source source, OutputStream out, String sourceUri) throws IOException
source - The sourceout - The outputsourceUri - The source uriIOException - If an error occurred while reading the sourceprotected abstract boolean isSourceMappingURLLine(String line)
line - The lineprotected abstract String getSourceMappingURL(String line)
line - The lineprotected abstract String removeSourceMappingURLLine(String content)
content - The contentprotected abstract String formatSourceMappingURL(String sourceMapName)
sourceMapName - The map nameprotected abstract String getMinimizedContent(String uri, String nestedParentFilesName)
uri - The urinestedParentFilesName - The parents file name, can be an empty string if there are no parentsprotected abstract void addSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator, int lineCount, String fileContent, String fileUri, String sourceMapUri)
sourceMapGenerator - The aggregator helperlineCount - The current line countfileContent - The content of the filefileUri - The uri of the filesourceMapUri - The sourceMappingURL found at the end of the file content