Package org.ametys.web.editor
Class UploadedLinksHTMLEditionHandler
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
org.ametys.web.editor.UploadedLinksHTMLEditionHandler
- All Implemented Interfaces:
Initializable
,Contextualizable
,LogEnabled
,Serviceable
,ContentHandler
,LexicalHandler
public class UploadedLinksHTMLEditionHandler
extends AbstractHTMLEditionHandler
implements Initializable
This transformer stores linked files as attachment from the incoming HTML.
-
Field Summary
Fields inherited from class org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
_contentHandler, _context, _lexicalHandler, _manager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) void
endElement
(String uri, String loc, String raw) void
protected boolean
processLink
(String uri, String loc, String raw, Attributes attrs) Process a link tag.void
service
(ServiceManager serviceManager) void
void
startElement
(String uri, String loc, String raw, Attributes attrs) protected Resource
storeAttachment
(String initialFileName, InputStream is, String mimeType, Date lastModified) Store a file as attachment.protected boolean
storeExternalFile
(String fileName) Test if the external file is to be stored as a local resource.Methods inherited from class org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler
characters, comment, endCDATA, endDocument, 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
-
UploadedLinksHTMLEditionHandler
public UploadedLinksHTMLEditionHandler()
-
-
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
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
startElement
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classAbstractHTMLEditionHandler
- Throws:
SAXException
-
processLink
Process a link tag.- Parameters:
uri
- the namespace URI.loc
- the local name (without prefix).raw
- the qualified name (with prefix).attrs
- the element attributes.- Returns:
- true to process the link, false otherwise.
-
storeExternalFile
Test if the external file is to be stored as a local resource.- Parameters:
fileName
- the file name.- Returns:
- true if the external file is to be stored, false otherwise.
-
storeAttachment
protected Resource storeAttachment(String initialFileName, InputStream is, String mimeType, Date lastModified) Store a file as attachment.- 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.
-