org.apache.cocoon.generation
Class StreamGenerator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.generation.AbstractGenerator
org.apache.cocoon.generation.ServiceableGenerator
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 interface org.apache.cocoon.generation.Generator |
ROLE |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FORM_NAME
public static final String FORM_NAME
- The parameter holding the name associated with the xml data
- See Also:
- Constant Field Values
StreamGenerator
public StreamGenerator()
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.