You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ac...@apache.org on 2006/03/04 02:32:45 UTC

svn commit: r382998 - in /incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http: HttpTransportFactory.java HttpTunnelServlet.java

Author: aco
Date: Fri Mar  3 17:32:44 2006
New Revision: 382998

URL: http://svn.apache.org/viewcvs?rev=382998&view=rev
Log:
Initial fix for http. Its still failing for some other reasons though (sync problems I think).

Modified:
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java?rev=382998&r1=382997&r2=382998&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java Fri Mar  3 17:32:44 2006
@@ -17,8 +17,6 @@
 package org.apache.activemq.transport.http;
 
 import org.activeio.command.WireFormat;
-import org.apache.activemq.transport.MutexTransport;
-import org.apache.activemq.transport.ResponseCorrelator;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
 import org.apache.activemq.transport.TransportServer;
@@ -45,7 +43,7 @@
         if (wireFormat instanceof TextWireFormat) {
             return (TextWireFormat) wireFormat;
         }
-        log.trace("Not created with a TextWireFromat: " + wireFormat);
+        log.trace("Not created with a TextWireFormat: " + wireFormat);
         return new XStreamWireFormat();
     }
 
@@ -57,8 +55,8 @@
         TextWireFormat textWireFormat = asTextWireFormat(wf);
         Transport transport = new HttpClientTransport(textWireFormat, location);
         //Transport transport = new HttpTransport(textWireFormat, location);
-        transport = new MutexTransport(transport);
-        transport = new ResponseCorrelator(transport);
+        //transport = new MutexTransport(transport);
+        //transport = new ResponseCorrelator(transport);
         return transport;
     }
 

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java?rev=382998&r1=382997&r2=382998&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java Fri Mar  3 17:32:44 2006
@@ -101,14 +101,21 @@
 
         // String body = readRequestBody(request);
         // Command command = wireFormat.readCommand(body);
-        
-        Command command = wireFormat.readCommand(request.getReader());
 
-        if (command instanceof ConnectionInfo) {
-            ConnectionInfo info = (ConnectionInfo) command;
-            request.getSession(true).setAttribute("clientID", info.getClientId());
+        // Read the command directly from the reader
+        //Command command = wireFormat.readCommand(request.getReader());
+
+        // Build the command xml before passing it to the reader
+        BufferedReader buffRead = request.getReader();
+        String commandXml = "";
+        String line;
+        while ((line = buffRead.readLine()) != null) {
+            commandXml += line;
         }
-        else if (command instanceof WireFormatInfo) {
+
+        Command command = wireFormat.readCommand(commandXml);
+
+        if (command instanceof WireFormatInfo) {
             WireFormatInfo info = (WireFormatInfo) command;
             if (!canProcessWireFormatVersion(info.getVersion())) {
                 response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: " + info.getVersion());
@@ -116,6 +123,11 @@
 
         }
         else {
+            if (command instanceof ConnectionInfo) {
+                ConnectionInfo info = (ConnectionInfo) command;
+                request.getSession(true).setAttribute("clientID", info.getClientId());
+            }
+
             BlockingQueueTransport transport = getTransportChannel(request);
             if (transport == null) {
                 response.setStatus(HttpServletResponse.SC_NOT_FOUND);