|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.apache.cocoon.serialization.ZipArchiveSerializer
public class ZipArchiveSerializer
A serializer that builds Zip archives by aggregating several sources.
The input document should describe entries of the archive by means of their name (which can be a path) and their content either as URLs or inline data :
Example :
<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0"> <zip:entry name="foo.html" src="cocoon://dynFoo.html"/> <zip:entry name="images/bar.jpeg" src="bar.jpeg"/> <zip:entry name="index.html" serializer="html"> <html> <head> <title>Index page</title> </head> <body> Please go <a href="foo.html">there</a> </body< </html> </zip:entry> </zip:archive:zip>
Field Summary | |
---|---|
protected byte[] |
buffer
Temporary byte buffer to read source data |
protected int |
contentDepth
Current depth of the serialized content |
protected ServiceManager |
manager
The component manager |
protected SourceResolver |
resolver
The resolver to get sources |
protected ServiceSelector |
selector
The serializer component selector |
protected Serializer |
serializer
Serializer used when in IN_CONTENT state |
protected int |
state
The current state |
static String |
ZIP_NAMESPACE
The namespace for elements handled by this serializer, "http://apache.org/cocoon/zip-archive/1.0". |
protected ZipOutputStream |
zipOutput
The Zip stream where entries will be written |
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 | |
---|---|
ZipArchiveSerializer()
|
Method Summary | |
---|---|
protected void |
addEntry(Attributes atts)
Add an entry in the archive. |
void |
characters(char[] buffer,
int offset,
int length)
Receive notification of character data. |
void |
dispose()
|
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(String namespaceURI,
String localName,
String qName)
Receive notification of the end of an element. |
void |
endPrefixMapping(String prefix)
End the scope of a prefix-URI mapping. |
String |
getMimeType()
Returns default mime type for zip archives, application/zip . |
void |
recycle()
Recycle serializer by removing references |
void |
service(ServiceManager manager)
|
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Receive notification of the beginning of an element. |
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 |
---|
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 Detail |
---|
public static final String ZIP_NAMESPACE
protected ServiceManager manager
protected ServiceSelector selector
protected ZipOutputStream zipOutput
protected int state
protected SourceResolver resolver
protected byte[] buffer
protected Serializer serializer
protected int contentDepth
Constructor Detail |
---|
public ZipArchiveSerializer()
Method Detail |
---|
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
Serviceable.service(ServiceManager)
public String getMimeType()
application/zip
.
Can be overridden in the sitemap.
getMimeType
in interface SitemapOutputComponent
getMimeType
in class AbstractSerializer
AbstractProcessingPipeline.setMimeTypeForSerializer(org.apache.cocoon.environment.Environment)
,
AbstractProcessingPipeline.setMimeTypeForReader(org.apache.cocoon.environment.Environment)
public void startDocument() throws SAXException
AbstractXMLPipe
startDocument
in interface ContentHandler
startDocument
in class AbstractXMLPipe
SAXException
ContentHandler.startDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class AbstractXMLPipe
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
SAXException
public void endPrefixMapping(String prefix) throws SAXException
AbstractXMLPipe
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class AbstractXMLPipe
prefix
- The prefix that was being mapping.
SAXException
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
AbstractXMLPipe
startElement
in interface ContentHandler
startElement
in class AbstractXMLPipe
namespaceURI
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.qName
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.atts
- The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
SAXException
ContentHandler.startElement(String, String, String, Attributes)
public void characters(char[] buffer, int offset, int length) throws SAXException
AbstractXMLPipe
characters
in interface ContentHandler
characters
in class AbstractXMLPipe
buffer
- The characters from the XML document.offset
- The start position in the array.length
- The number of characters to read from the array.
SAXException
ContentHandler.characters(char[], int, int)
protected void addEntry(Attributes atts) throws SAXException
atts
- the attributes that describe the entry
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
AbstractXMLPipe
endElement
in interface ContentHandler
endElement
in class AbstractXMLPipe
namespaceURI
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.qName
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.
SAXException
ContentHandler.endElement(String, String, String)
public void endDocument() throws SAXException
AbstractXMLPipe
endDocument
in interface ContentHandler
endDocument
in class AbstractXMLPipe
SAXException
ContentHandler.endDocument()
public void recycle()
AbstractSerializer
recycle
in interface Recyclable
recycle
in class AbstractSerializer
Recyclable.recycle()
public void dispose()
dispose
in interface Disposable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |