You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2004/05/11 10:00:02 UTC

[WIKI-UPDATE] WritingReaders sandbox Tue May 11 10:00:02 2004

Page: http://wiki.cocoondev.org/Wiki.jsp?page=WritingReaders , version: 1 on Mon May 11 07:30:23 2004 by ChristianHaul

New page created:
+ A reader is sort of a generator and a serializer in one package. Therefore, it is not possible to modify or transform the data lateron on the way to the browser. Consequently,
+ a reader does not deal with SAX but reads or creates an arbitrary format and returns a stream of binary data.
+ 
+ The output stream is set through the SitemapOutputComponent interface's method setOutputStream(). The generate() method triggers the actual reading.
+ 
+ Other than that, a reader is a regular SitemapModelComponent and gets its parameters
+ passed through the setup() method. Like any other SitemapModelComponent, it may but does 
+ not need to implement CacheableProcessingComponent to enable caching.
+ 
+ To write your own reader, you should inherit from one of the existing readers like the ServiceableReader or the RessourceReader or even the AbstractReader.
+ 
+ All that needs to be done to write a custom reader based on the AbstractReader class, is to override the generate() method and dump whatever data this reader deals with to 
+ the OutputStream this.out.
+ 
+ Of cause, to write a good reader, the implementation should handle exceptions gracefully, like unexpected closing of the output stream when the user instructs the browser to stop loading for example and should try to work with the caching subsystem in order to provide good performance.
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=sandbox , version: 13 on Mon May 11 07:09:38 2004 by AntonioGallardo

- [网站建设 |http://www.99986.com/ ]
- [网页设计 |http://www.99986.com/ ]
- [网页制作 |http://www.99986.com/ ]
- [网站推广 |http://www.99986.com/ ]
+