public class UploadedDataHTMLEditionHandler extends AbstractHTMLEditionHandler
Modifier and Type | Field and Description |
---|---|
private static Pattern |
__INLINE_IMAGE_MARKER |
private AmetysObjectResolver |
_ametysResolver |
private Context |
_cocoonContext |
private Map |
_objectModel |
private SourceResolver |
_resolver |
private ModifiableRichText |
_richText |
private boolean |
_tagToIgnore |
private UploadManager |
_uploadManager |
private Set<String> |
_usedLocalFiles |
private CurrentUserProvider |
_userProvider |
_contentHandler, _context, _lexicalHandler, _manager
Constructor and Description |
---|
UploadedDataHTMLEditionHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
_addDimensionAttributes(InputStream inputStream,
AttributesImpl attrs)
Add an image's width and height to the XML attributes.
|
private void |
_copyAttributes(Attributes attrs,
AttributesImpl newAttrs)
Copy the attributes.
|
private Attributes |
_getAttributesForTemp(Attributes attrs) |
private String |
_getInitialFileName(String src) |
protected RichText |
_getMeta(CompositeMetadata meta,
String metadataName)
Get the rich text meta
|
private StringBuilder |
_getRequestURI(Request request)
Get the cms uri
|
private String |
_handleInternalFile(String src,
AttributesImpl newAttrs,
String initialFileName) |
private String |
_handleRemoteFile(String src,
AttributesImpl newAttrs,
String initialFileName) |
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,
Date 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) |
characters, comment, endCDATA, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMapping
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final Pattern __INLINE_IMAGE_MARKER
private UploadManager _uploadManager
private CurrentUserProvider _userProvider
private SourceResolver _resolver
private AmetysObjectResolver _ametysResolver
private Context _cocoonContext
private boolean _tagToIgnore
private Set<String> _usedLocalFiles
private ModifiableRichText _richText
private Map _objectModel
public UploadedDataHTMLEditionHandler()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
contextualize
in class AbstractHTMLEditionHandler
ContextException
public void service(ServiceManager sManager) throws ServiceException
service
in interface Serviceable
service
in class AbstractHTMLEditionHandler
ServiceException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class AbstractHTMLEditionHandler
SAXException
public void startElement(String uri, String loc, String raw, Attributes attrs) throws SAXException
startElement
in interface ContentHandler
startElement
in class AbstractHTMLEditionHandler
SAXException
private String _getInitialFileName(String src)
private String _handleInternalFile(String src, AttributesImpl newAttrs, String initialFileName) throws MalformedURLException, IOException, URISyntaxException
private String _handleRemoteFile(String src, AttributesImpl newAttrs, String initialFileName) throws MalformedURLException, IOException
MalformedURLException
IOException
private void _copyAttributes(Attributes attrs, AttributesImpl newAttrs)
attrs
- the attributes to copy.newAttrs
- the attributes to copy to.private StringBuilder _getRequestURI(Request request)
request
- The requestprivate Attributes _getAttributesForTemp(Attributes attrs)
protected String _storeFile(String initialFileName, InputStream is, String mimeType, Date lastModified)
initialFileName
- the initial file name.is
- an input stream on the file.mimeType
- the file mime type.lastModified
- the last modification date.protected Attributes _processLocal(Attributes attrs)
attrs
- the img tag attributes.protected Attributes _processResource(Attributes attrs)
attrs
- the img tag attributes.protected void _addDimensionAttributes(InputStream inputStream, AttributesImpl attrs) throws IOException
inputStream
- an input stream on the image.attrs
- the attributes to fill.IOException
- if an error occurs during reading dimensionpublic void endElement(String uri, String loc, String raw) throws SAXException
endElement
in interface ContentHandler
endElement
in class AbstractHTMLEditionHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class AbstractHTMLEditionHandler
SAXException
protected RichText _getMeta(CompositeMetadata meta, String metadataName)
meta
- The composite metametadataName
- The metadata name (with /)