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
public class UploadedDataHTMLEditionHandler extends AbstractHTMLEditionHandler
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 Constructor Description UploadedDataHTMLEditionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
endDocument()
void
endElement(String uri, String loc, String raw)
void
service(ServiceManager sManager)
void
startDocument()
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
-
-
-
-
Constructor Detail
-
UploadedDataHTMLEditionHandler
public UploadedDataHTMLEditionHandler()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Overrides:
contextualize
in classAbstractHTMLEditionHandler
- Throws:
ContextException
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractHTMLEditionHandler
- Throws:
ServiceException
-
startDocument
public void startDocument() throws SAXException
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
startElement
public void startElement(String uri, String loc, String raw, Attributes attrs) throws SAXException
- 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
protected Attributes _processLocal(Attributes attrs)
Process a local file.- Parameters:
attrs
- the img tag attributes.- Returns:
- the new img tag attributes.
-
_processResource
protected Attributes _processResource(Attributes attrs)
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
public void endElement(String uri, String loc, String raw) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
-