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
Modifier and TypeFieldDescriptionprotected byte[]
Temporary byte buffer to read source dataprotected int
Current depth of the serialized contentprotected ServiceManager
The component managerprotected SourceResolver
The resolver to get sourcesprotected ServiceSelector
The serializer component selectorprotected Serializer
Serializer used when in IN_CONTENT stateprotected int
The current stateprotected ZipArchiveOutputStream
The Zip stream where entries will be writtenstatic final String
The namespace for elements handled by this serializer, "http://apache.org/cocoon/zip-archive/1.0".Fields inherited from class org.apache.cocoon.serialization.AbstractSerializer
output
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addEntry
(Attributes atts) Add an entry in the archive.void
characters
(char[] buffer, int offset, int length) void
dispose()
void
void
endElement
(String namespaceURI, String localName, String qName) void
endPrefixMapping
(String prefix) Returns default mime type for zip archives,application/zip
.void
recycle()
void
service
(ServiceManager manager) void
void
startElement
(String namespaceURI, String localName, String qName, Attributes atts) void
startPrefixMapping
(String prefix, String uri) Begin the scope of a prefix-URI Namespace mapping.Methods inherited from class org.apache.cocoon.serialization.AbstractSerializer
setOutputStream, shouldSetContentLength
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
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, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
Methods 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
getMimeType
Returns default mime type for zip archives,application/zip
. Can be overridden in the sitemap.- Specified by:
getMimeType
in interfaceSitemapOutputComponent
- Overrides:
getMimeType
in classAbstractSerializer
- Returns:
- application/zip
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classAbstractXMLPipe
- Throws:
SAXException
-
startPrefixMapping
Begin the scope of a prefix-URI Namespace mapping.- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classAbstractXMLPipe
- Parameters:
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classAbstractXMLPipe
- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classAbstractXMLPipe
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in 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:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classAbstractXMLPipe
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classAbstractXMLPipe
- Throws:
SAXException
-
recycle
- Specified by:
recycle
in interfaceRecyclable
- Overrides:
recycle
in classAbstractSerializer
-
dispose
- Specified by:
dispose
in interfaceDisposable
-