org.apache.cocoon.generation
Class StreamGenerator

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.apache.cocoon.generation.ServiceableGenerator
                  extended by org.apache.cocoon.generation.StreamGenerator
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, LogEnabled, Serviceable, Generator, SitemapModelComponent, XMLProducer

public class StreamGenerator
extends ServiceableGenerator

Version:
CVS $Id: StreamGenerator.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Kinga Dziembowski

Field Summary
static String FORM_NAME
          The parameter holding the name associated with the xml data
 
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
StreamGenerator()
           
 
Method Summary
protected  String extractCharset(String contentType, int idx)
           
 void generate()
          Generate XML data out of request InputStream.
 String getCharacterEncoding(Request req, String contentType)
          Content type HTTP header can contains character encodinf info for ex.
 void recycle()
          Recycle this component.
 
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose, service
 
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
setup
 
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.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

FORM_NAME

public static final String FORM_NAME
The parameter holding the name associated with the xml data

See Also:
Constant Field Values
Constructor Detail

StreamGenerator

public StreamGenerator()
Method Detail

recycle

public void recycle()
Recycle this component. All instance variables are set to null.

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractGenerator

generate

public void generate()
              throws IOException,
                     SAXException,
                     ProcessingException
Generate XML data out of request InputStream.

Throws:
IOException
SAXException
ProcessingException

getCharacterEncoding

public String getCharacterEncoding(Request req,
                                   String contentType)
Content type HTTP header can contains character encodinf info for ex. Content-Type: text/xml; charset=UTF-8 If the servlet is following spec 2.3 and higher the servlet API can be used to retrieve character encoding part of Content-Type header. Some containers can choose to not unpack charset info - the spec is not strong about it. in any case this method can be used as a latest resource to retrieve the passed charset value. null is returned. It is very common mistake to send : Content-Type: text/xml; charset="UTF-8". Some containers are not filtering this mistake and the processing results in exception.. The getCharacterEncoding() compensates for above mistake.

Parameters:
contentType - value associated with Content-Type HTTP header.

extractCharset

protected String extractCharset(String contentType,
                                int idx)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.