Is there a way to get CometProcessor to work when proxying through
Apache httpd? Here is what I have tried:
I have an HttpServlet implementing CometProcessor.
When I have a Tomcat connector like this:
<Connector port="8912" protocol="HTTP/1.1"
address="192.168.1.30" />
and I connect to it directly, everything works wonderfully - I get
CometEvent.EventType.READ events as I send data from the client.
When I have a Tomcat connector like this:
<Connector port="8911" protocol="HTTP/1.1"
address="127.0.0.1" />
and have Apache httpd proxy requests like this:
RewriteRule ^/path/to/servlet http://localhost:8911/path/to/servlet [P]
I get exactly one CometEvent.EventType.READ event with all of the data
after I finish sending data from the client.
When I have a Tomcat connector like this:
<Connector port="8909" protocol="AJP/1.3"
address="127.0.0.1" />
and have Apache httpd proxy requests like this:
RewriteRule ^/path/to/servlet ajp://localhost:8909/path/to/servlet [P]
I get zero CometEvents and the client gets an HTTP error 405 (Method Not
Allowed). I was hoping that AJP would work so I could try using
ProxyPass with flushpackets=on, but the Apache documentation says that
only works with AJP.
If I use Http11NioConnector instead of HTTP/1.1 and try to proxy with
Apache, I get the same results as if I were using the HTTP/1.1 connector.
My client code (Java) is:
// Direct to Tomcat (HTTP)
//URL url = new URL( "http://server:8912/path/to/servlet" );
// Apache proxies to Tomcat
URL url = new URL( "http://server/path/to/servlet" );
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
connection.setChunkedStreamingMode( 1 );
connection.setDoOutput( true );
connection.setDoInput( true );
connection.connect();
OutputStream os = connection.getOutputStream();
for ( int i = 0; i < 10; i++ ) {
os.write( 1 );
os.flush();
Thread.sleep( 1000 );
}
os.close();
log.debug( "response:" + connection.getResponseCode() );
log.debug( "response:" + connection.getResponseMessage() );
connection.disconnect();
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org