public class MinimizeTransformer extends ServiceableTransformer implements Contextualizable, Configurable
Modifier and Type | Field and Description |
---|---|
protected Context |
_context
The avalon context
|
protected String |
_currentContextPath
The current context
|
protected Boolean |
_debugMode
Is developper mode?
|
private Map<String,Map<String,String>> |
_filesQueue |
private HashCache |
_hashCache |
protected Boolean |
_inlineCssMedias
Should css medias be taken in account?
|
private boolean |
_isCurrentTagQueued |
protected String |
_locale
The current local
|
protected List<Pattern> |
_patterns
The list of patterns available for minimization
|
private Set<String> |
_queueMedia |
private String |
_queueTag |
private static String |
DEFAULT_URI_PATTERN |
manager, objectModel, parameters, resolver, source
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
ROLE
Constructor and Description |
---|
MinimizeTransformer() |
Modifier and Type | Method and Description |
---|---|
private void |
_addToQueue(String tagName,
Attributes attrs)
Add a new tag to the current queue.
|
private Set<String> |
_filterMediaValue(String mediaValue) |
protected String |
_getMinimizeUrl()
Get the url of the minimizer
|
private boolean |
_isMinimizable(String tagName,
Attributes attrs)
Check if the current tag can be minimized by this transformer
|
private void |
_processQueue()
Process the current files queue by saxing it as one file, which name is the hash of the sum of files.
|
protected String |
_removeContextPath(String uri)
Remove the context path from the uri to be able to analyse correctly the patterns
|
void |
configure(Configuration configuration) |
void |
contextualize(Context context) |
void |
endElement(String uri,
String loc,
String raw) |
protected String |
getHashSalt()
Return the salt used by the hash cache
|
void |
service(ServiceManager smanager) |
void |
setup(SourceResolver res,
Map obj,
String src,
Parameters par) |
void |
startDocument() |
void |
startElement(String uri,
String loc,
String raw,
Attributes a) |
dispose, recycle
characters, comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMapping
setConsumer, setContentHandler, setLexicalHandler
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
characters, endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
setConsumer
private static final String DEFAULT_URI_PATTERN
protected Boolean _debugMode
protected Boolean _inlineCssMedias
protected String _currentContextPath
private Set<String> _queueMedia
private boolean _isCurrentTagQueued
private HashCache _hashCache
public MinimizeTransformer()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableTransformer
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
protected String _getMinimizeUrl()
public void setup(SourceResolver res, Map obj, String src, Parameters par) throws ProcessingException, SAXException, IOException
setup
in interface SitemapModelComponent
setup
in class ServiceableTransformer
ProcessingException
SAXException
IOException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class AbstractXMLPipe
SAXException
public void startElement(String uri, String loc, String raw, Attributes a) throws SAXException
startElement
in interface ContentHandler
startElement
in class AbstractXMLPipe
SAXException
public void endElement(String uri, String loc, String raw) throws SAXException
endElement
in interface ContentHandler
endElement
in class AbstractXMLPipe
SAXException
private boolean _isMinimizable(String tagName, Attributes attrs)
tagName
- The tag nameattrs
- The attributeprotected String _removeContextPath(String uri)
uri
- The incomming uriprivate void _addToQueue(String tagName, Attributes attrs) throws SAXException
tagName
- The tag nameattrs
- The tag attributeSAXException
- If an error occurredprivate void _processQueue() throws SAXException
SAXException
- If an error occurredprotected String getHashSalt()
private Set<String> _filterMediaValue(String mediaValue)