Author: rmannibucau
Date: Sat Jan  5 20:12:13 2013
New Revision: 1429372

URL: http://svn.apache.org/viewvc?rev=1429372&view=rev
Log:
OPENEJB-1980 all request have an inputstream

Modified:
    
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
    
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/ServletByteArrayIntputStream.java

Modified: 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java?rev=1429372&r1=1429371&r2=1429372&view=diff
==============================================================================
--- 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
 (original)
+++ 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
 Sat Jan  5 20:12:13 2013
@@ -307,11 +307,11 @@ public class HttpRequestImpl implements 
      * @throws java.io.IOException if an exception is thrown
      */
     protected void readMessage(InputStream input) throws IOException {
-        DataInput in = new DataInputStream(input);
+        final DataInput di = new DataInputStream(input);
 
-        readRequestLine(in);
-        readHeaders(in);
-        readBody(in);
+        readRequestLine(di);
+        readHeaders(di);
+        readBody(di);
 
         parameters.putAll(this.getFormParameters());
         parameters.putAll(this.getQueryParameters());
@@ -553,6 +553,7 @@ public class HttpRequestImpl implements 
 
             try {
                 body = readContent(in);
+                this.in = new ServletByteArrayIntputStream(body);
                 rawParams = new String(body);
             } catch (Exception e) {
                 throw (IOException)new IOException("Could not read the HTTP 
Request Body: " + e.getMessage()).initCause(e);

Modified: 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/ServletByteArrayIntputStream.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/ServletByteArrayIntputStream.java?rev=1429372&r1=1429371&r2=1429372&view=diff
==============================================================================
--- 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/ServletByteArrayIntputStream.java
 (original)
+++ 
openejb/trunk/openejb/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/ServletByteArrayIntputStream.java
 Sat Jan  5 20:12:13 2013
@@ -24,10 +24,12 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 public class ServletByteArrayIntputStream extends ServletInputStream {
-    private ByteArrayInputStream intputStream;
+    private final ByteArrayInputStream intputStream;
+    private final byte[] raw;
 
     public ServletByteArrayIntputStream(byte[] body) {
         intputStream = new ByteArrayInputStream(body);
+        raw = body;
     }
 
     @Override
@@ -38,4 +40,8 @@ public class ServletByteArrayIntputStrea
     public ByteArrayInputStream getIntputStream() {
         return intputStream;
     }
+
+    public byte[] getRaw() {
+        return raw;
+    }
 }


Reply via email to