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
-
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.void
contextualize
(Context context) void
void
endElement
(String uri, String loc, String raw) void
service
(ServiceManager sManager) void
void
startElement
(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, startPrefixMapping
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
UploadedDataHTMLEditionHandler
public UploadedDataHTMLEditionHandler()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Overrides:
contextualize
in classAbstractHTMLEditionHandler
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractHTMLEditionHandler
- Throws:
ServiceException
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
startElement
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in 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:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-