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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontextualize(Context context) voidendElement(String uri, String loc, String raw) voidprotected booleanprocessLink(String uri, String loc, String raw, Attributes attrs) Process a link tag.voidservice(ServiceManager serviceManager) voidvoidstartElement(String uri, String loc, String raw, Attributes attrs) protected ResourcestoreAttachment(String initialFileName, InputStream is, String mimeType, Date lastModified) Store a file as attachment.protected booleanstoreExternalFile(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, 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
-
UploadedLinksHTMLEditionHandler
public UploadedLinksHTMLEditionHandler()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Overrides:
contextualizein classAbstractHTMLEditionHandler- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractHTMLEditionHandler- Throws:
ServiceException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classAbstractHTMLEditionHandler- Throws:
SAXException
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classAbstractHTMLEditionHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin 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.
-