You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/10/08 09:16:13 UTC
cvs commit: xml-cocoon2/src/org/apache/cocoon/generation StreamGenerator.java
cziegeler 01/10/08 00:16:13
Modified: src/org/apache/cocoon/generation Tag: cocoon_20_branch
StreamGenerator.java
Log:
Fixed (hopefully) dependency to the http environment
Revision Changes Path
No revision
No revision
1.1.2.6 +13 -5 xml-cocoon2/src/org/apache/cocoon/generation/StreamGenerator.java
Index: StreamGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/StreamGenerator.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- StreamGenerator.java 2001/08/20 14:07:31 1.1.2.5
+++ StreamGenerator.java 2001/10/08 07:16:12 1.1.2.6
@@ -13,7 +13,8 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.components.parser.Parser;
-import org.apache.cocoon.environment.http.HttpRequest;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.http.HttpEnvironment;
import org.apache.cocoon.util.PostInputStream;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -42,7 +43,7 @@
* number of bytes read is equal to the getContentLength() value.
*
* @author <a href="mailto:Kinga_Dziembowski@hp.com">Kinga Dziembowski</a>
- * @version $Revision: 1.1.2.5 $ $Date: 2001/08/20 14:07:31 $
+ * @version $Revision: 1.1.2.6 $ $Date: 2001/10/08 07:16:12 $
*/
public class StreamGenerator extends ComposerGenerator {
public static final String CLASS = StreamGenerator.class.getName();
@@ -75,7 +76,7 @@
int len = 0;
try {
- HttpRequest request = (HttpRequest)objectModel.get(Constants.REQUEST_OBJECT);
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
if (request.getContentType().equals("application/x-www-form-urlencoded")) {
String sXml = request.getParameter(parameter);
inputSource = new InputSource(new StringReader(sXml));
@@ -85,8 +86,15 @@
len = request.getContentLength();
if (len > 0) {
- PostInputStream anStream = new PostInputStream(request.getInputStream(), len);
- inputSource = new InputSource(anStream);
+ // we have hopefully an http request here
+ javax.servlet.http.HttpServletRequest httpRequest =
+ (javax.servlet.http.HttpServletRequest)objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);
+ if (httpRequest != null) {
+ PostInputStream anStream = new PostInputStream(httpRequest.getInputStream(), len);
+ inputSource = new InputSource(anStream);
+ } else {
+ throw new IOException("No http request object found");
+ }
} else {
throw new IOException("getContentLen() == 0");
}
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org