mirror of https://github.com/apache/activemq.git
Initial fix for http. Its still failing for some other reasons though (sync problems I think).
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@382998 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da26ccbd32
commit
7027fe66d7
|
@ -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 @@ public class HttpTransportFactory extends TransportFactory {
|
|||
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 @@ public class HttpTransportFactory extends TransportFactory {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,14 +101,21 @@ public class HttpTunnelServlet extends HttpServlet {
|
|||
|
||||
// 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 @@ public class HttpTunnelServlet extends HttpServlet {
|
|||
|
||||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue