Class UploadedDataHTMLEditionHandler
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
org.ametys.cms.transformation.htmledition.UploadedDataHTMLEditionHandler
- All Implemented Interfaces:
Contextualizable,LogEnabled,Serviceable,ContentHandler,LexicalHandler
This transformer extracts uploaded files' ids from the incoming HTML for further processing.
-
Field Summary
Fields inherited from class org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
_contentHandler, _context, _lexicalHandler, _manager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_addDimensionAttributes(InputStream inputStream, AttributesImpl attrs) Add an image's width and height to the XML attributes.protected Attributes_processLocal(Attributes attrs) Process a local file.protected Attributes_processResource(Attributes attrs) Process a resource.protected String_storeFile(String initialFileName, InputStream is, String mimeType, ZonedDateTime lastModified) Store a file as rich text data.voidcontextualize(Context context) voidvoidendElement(String uri, String loc, String raw) voidservice(ServiceManager sManager) voidvoidstartElement(String uri, String loc, String raw, Attributes attrs) Methods inherited from class org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
characters, comment, endCDATA, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMappingMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
UploadedDataHTMLEditionHandler
public UploadedDataHTMLEditionHandler()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Overrides:
contextualizein classAbstractHTMLEditionHandler- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractHTMLEditionHandler- Throws:
ServiceException
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classAbstractHTMLEditionHandler- Throws:
SAXException
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classAbstractHTMLEditionHandler- Throws:
SAXException
-
_storeFile
protected String _storeFile(String initialFileName, InputStream is, String mimeType, ZonedDateTime lastModified) Store a file as rich text data.- Parameters:
initialFileName- the initial file name.is- an input stream on the file.mimeType- the file mime type.lastModified- the last modification date.- Returns:
- the final file name.
-
_processLocal
Process a local file.- Parameters:
attrs- the img tag attributes.- Returns:
- the new img tag attributes.
-
_processResource
Process a resource.- Parameters:
attrs- the img tag attributes.- Returns:
- the new img tag attributes.
-
_addDimensionAttributes
protected void _addDimensionAttributes(InputStream inputStream, AttributesImpl attrs) throws IOException Add an image's width and height to the XML attributes.- Parameters:
inputStream- an input stream on the image.attrs- the attributes to fill.- Throws:
IOException- if an error occurs during reading dimension
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classAbstractHTMLEditionHandler- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classAbstractHTMLEditionHandler- Throws:
SAXException
-