Package org.ametys.core.cocoon
Class ZipArchiveNGSerializer
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.apache.cocoon.serialization.AbstractSerializer
org.ametys.core.cocoon.ZipArchiveNGSerializer
- All Implemented Interfaces:
Poolable,Recyclable,Disposable,Component,LogEnabled,Serviceable,Serializer,SitemapOutputComponent,XMLConsumer,XMLPipe,XMLProducer,XMLConsumer,ContentHandler,LexicalHandler
ZIP archive serializer that makes use of apache commons compress ZipArchiveOutputStream instead of JavaSE's ZipOutputStream.
It's based on cocoon's ZipArchiveSerializer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]Temporary byte buffer to read source dataprotected intCurrent depth of the serialized contentprotected ServiceManagerThe component managerprotected SourceResolverThe resolver to get sourcesprotected ServiceSelectorThe serializer component selectorprotected SerializerSerializer used when in IN_CONTENT stateprotected intThe current stateprotected ZipArchiveOutputStreamThe Zip stream where entries will be writtenstatic final StringThe namespace for elements handled by this serializer, "http://apache.org/cocoon/zip-archive/1.0".Fields inherited from class org.apache.cocoon.serialization.AbstractSerializer
outputFields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumerFields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEntry(Attributes atts) Add an entry in the archive.voidcharacters(char[] buffer, int offset, int length) voiddispose()voidvoidendElement(String namespaceURI, String localName, String qName) voidendPrefixMapping(String prefix) Returns default mime type for zip archives,application/zip.voidrecycle()voidservice(ServiceManager manager) voidvoidstartElement(String namespaceURI, String localName, String qName, Attributes atts) voidstartPrefixMapping(String prefix, String uri) Begin the scope of a prefix-URI Namespace mapping.Methods inherited from class org.apache.cocoon.serialization.AbstractSerializer
setOutputStream, shouldSetContentLengthMethods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntityMethods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandlerMethods 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, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntityMethods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntityMethods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
Field Details
-
ZIP_NAMESPACE
The namespace for elements handled by this serializer, "http://apache.org/cocoon/zip-archive/1.0".- See Also:
-
_manager
The component manager -
_selector
The serializer component selector -
_zipOutput
The Zip stream where entries will be written -
_state
The current state -
_resolver
The resolver to get sources -
_buffer
Temporary byte buffer to read source data -
_serializer
Serializer used when in IN_CONTENT state -
_contentDepth
Current depth of the serialized content
-
-
Constructor Details
-
ZipArchiveNGSerializer
public ZipArchiveNGSerializer()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getMimeType
Returns default mime type for zip archives,application/zip. Can be overridden in the sitemap.- Specified by:
getMimeTypein interfaceSitemapOutputComponent- Overrides:
getMimeTypein classAbstractSerializer- Returns:
- application/zip
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classAbstractXMLPipe- Throws:
SAXException
-
startPrefixMapping
Begin the scope of a prefix-URI Namespace mapping.- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classAbstractXMLPipe- Parameters:
prefix- The Namespace prefix being declared.uri- The Namespace URI the prefix is mapped to.- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classAbstractXMLPipe- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classAbstractXMLPipe- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classAbstractXMLPipe- Throws:
SAXException
-
addEntry
Add an entry in the archive.- Parameters:
atts- the attributes that describe the entry- Throws:
SAXException- if an error occurred
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classAbstractXMLPipe- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classAbstractXMLPipe- Throws:
SAXException
-
recycle
- Specified by:
recyclein interfaceRecyclable- Overrides:
recyclein classAbstractSerializer
-
dispose
- Specified by:
disposein interfaceDisposable
-