Using writer.flush() is absolutely ok, it's just not enough. Taking a
quick look at the code you posted, it looks ok, because after calling
writer.flush(), it always calls event.close(). So, no problem here.
But: I don't see any timeout in the code. The server must also call
event.close() after some timeout - which must be shorter than your
proxy's and your browser's timeout. (Some people say, it should in any
case be less than a minute.)

So either you can configure the timeout somewhere in tomcat (please
refer to the tomcat documentation), or you'll have to send something
back manually after some time.
When the client receives such a dummy response, it must open a new
request (that's the long polling principle).


On Feb 21, 3:28 pm, Fran <fra...@gmail.com> wrote:
> Yes Chris, I use writer.flush()
> I cant use it at mod_proxy? What can I do?
>
> Thanks
>
> On 21 feb, 14:39, Chris Lercher <cl_for_mail...@gmx.net> wrote:
>
>
>
> > Here are some things you can check - maybe one of these helps (?)
>
> > - In your servlet: Do you expect that anything gets flushed
> > (reliably), before you call the close() method on CometEvent? If yes,
> > then what you're actually trying to do is _streaming_ (which doesn't
> > work). Calling writer.flush() is certainly not enough, since mod_proxy
> > has no way to know that writer.flush() has been called.
>
> > - Did you try to set "no-cache" headers etc.?
>
> > On Feb 21, 1:11 pm, Fran <fra...@gmail.com> wrote:
>
> > > I tested the mod_proxy_http, in the last post you can see the config
> > > that I used.
> > > But in Comet HTTP streaming, I found mod_proxy blocked the response
> > > until server close the
> > > stream (after timeout), then send the whole response to client at
> > > once.
>
> > > In the first time I was wrong because I thought that if I put
> > > timeout=1 I found the solution but Its not real because the server
> > > close the conection after timeout
>
> > > In the five post of mine is an example of the problem.
>
> > > This dude has a similar 
> > > problem:http://forums.java.net/jive/thread.jspa?threadID=41377
>
> > > I am hopeless :(
>
> > > On 21 feb, 03:21, dablack <david.blackwell...@gmail.com> wrote:
>
> > > > Sorry to lead you on a wild goose chase. I guess you will have to use
> > > > the Apache mod_proxy_http module with the Tomcat NIO connector using
> > > > the http protocol after all. I don't have any experience with the
> > > > mod_proxy_http module at all so not really anything I can help you
> > > > with.
>
> > > > Good luck.
>
> > > > On Feb 20, 7:21 pm, Fran <fra...@gmail.com> wrote:
>
> > > > > The problem persist with the news changes.
> > > > > Seems that apache cant connect to tomcat :(
> > > > > The error log of apache and mod_jk dont show nothing. Not ever nio 
> > > > > conection
> > > > > stablished
>
> > > > > 2010/2/21 dablack <david.blackwell...@gmail.com>
>
> > > > > > I borrowed that connector configuration from a website I came 
> > > > > > across.
> > > > > > I'm not sure why port=0 either. If I put more research into the NIO
> > > > > > connector I could probably find out. Why don't you try adding the
> > > > > > lines,
>
> > > > > > enableLookups="false"
> > > > > > scheme="http"
>
> > > > > > to the NIO connector configuration in the server.xml file that I 
> > > > > > gave
> > > > > > you earlier.
>
> > > > > > As far as accessing the ajp service 
> > > > > > usinghttp://localhost:8009/servlet,
> > > > > > that will not work. Your browser uses the http protocol and the 8009
> > > > > > port is being serviced by the ajp protocol. You should still have 
> > > > > > your
> > > > > > connector using the http protocol configured to listen on port 8081.
>
> > > > > > Hopefully the scheme line above will help the NIO connector
> > > > > > communicate back to Apache.
>
> > > > > > On Feb 20, 4:45 pm, Fran <fra...@gmail.com> wrote:
> > > > > > > I test your config, dablack, but I cant connect to the servlet.
> > > > > > > With this config I cant access not even 
> > > > > > > to:http://localhost:8009/servlet
> > > > > > > that is tomcat directly without apache
>
> > > > > > > On 20 feb, 23:36, Fran <fra...@gmail.com> wrote:
>
> > > > > > > > I cant undestand why this config:
>
> > > > > > > > <Connector protocol="AJP/1.3" port="0" 
> > > > > > > > channelNioSocket.port="8009"
> > > > > > > > channelNioSocket.maxThreads="
> > > > > > > > 150"
> > > > > > > >   channelNioSocket.maxSpareThreads="50"
> > > > > > > > channelNioSocket.minSpareThreads="25"
> > > > > > > >   channelNioSocket.bufferSize="16384" />
>
> > > > > > > > Why port 0 ?
>
> > > > > > > > 2010/2/20 dablack <david.blackwell...@gmail.com>
>
> > > > > > > > > Fran,
>
> > > > > > > > > I'm really not an expert on setting up the connection between 
> > > > > > > > > Apache
> > > > > > > > > and Tomcat but I believe that the connections only operate in 
> > > > > > > > > two
> > > > > > > > > protocols: http or ajp. NIO is a Tomcat connector that can
> > > > > > communicate
> > > > > > > > > in either http or ajp. Because of that, I don't see any 
> > > > > > > > > reason that
> > > > > > > > > the Apache mod_jk connector module couldn't communicate with 
> > > > > > > > > the NIO
> > > > > > > > > connector. Since I don't use an NIO connector I could be 
> > > > > > > > > wrong, but
> > > > > > > > > that is the way I see it. As a starting point, try these
> > > > > > > > > configurations:
>
> > > > > > > > > server.xml
>
> > > > > > > > > <Connector protocol="AJP/1.3" port="0" 
> > > > > > > > > channelNioSocket.port="8009"
> > > > > > > > > channelNioSocket.maxThreads="150"
> > > > > > > > >   channelNioSocket.maxSpareThreads="50"
> > > > > > > > > channelNioSocket.minSpareThreads="25"
> > > > > > > > >   channelNioSocket.bufferSize="16384" />
>
> > > > > > > > > (You seem to want to use port 8081 which should be fine, but 
> > > > > > > > > the
> > > > > > > > > standard ajp port is 8009. However, I wouldn't put it on port 
> > > > > > > > > 8081 if
> > > > > > > > > you are already using that port for another protocol such as 
> > > > > > > > > http.)
>
> > > > > > > > > httpd.conf
>
> > > > > > > > > LoadModule jk_module modules/mod_jk.so
> > > > > > > > > JkWorkersFile conf/workers.properties
> > > > > > > > > JkLogFile /var/log/httpd/mod_jk.log
> > > > > > > > > JkLogLevel info
> > > > > > > > > JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
> > > > > > > > > JkOptions +ForwardKeySize +ForwardURICompat 
> > > > > > > > > -ForwardDirectories
> > > > > > > > > JkRequestLogFormat "%w %V %T"
> > > > > > > > > JkMount /*.svc ajp13
>
> > > > > > > > > (For the JkMount I use *.svc because I use the svc extension 
> > > > > > > > > for my
> > > > > > > > > GWT service target to differentiate service points from other 
> > > > > > > > > files.)
>
> > > > > > > > > (For example, in my web.xml file I will map my service 
> > > > > > > > > something like
> > > > > > > > > this to use the svc extension:
> > > > > > > > > <servlet>
> > > > > > > > >   <servlet-name>MyService</servlet-name>
> > > > > > > > >   
> > > > > > > > > <servlet-class>com.mysite.server.MyServiceImpl</servlet-class>
> > > > > > > > > </servlet>
> > > > > > > > > <servlet-mapping>
> > > > > > > > >   <servlet-name>MyService</servlet-name>
> > > > > > > > >   <url-pattern>/MyService.svc</usr-pattern>
> > > > > > > > > </servlet-mapping>
>
> > > > > > > > > And in my GWT code I create my service target like this:
>
> > > > > > > > > target.setServiceEntryPoint( GWT.getModuleBaseURL() +
> > > > > > > > > "MyService.svc" );
>
> > > > > > > > > I did this because I had troubles with the 'JkMount /* ajp13' 
> > > > > > > > > entry,
> > > > > > > > > but when I used /*.svc the problems cleared up.)
>
> > > > > > > > > workers.properties
>
> > > > > > > > > workers.tomcat_home=/usr/tomcat/apache-tomcat-6.0.16
> > > > > > > > > workers.java_home=/usr/java/jdk1.6.0_06
> > > > > > > > > worker.list=ajp13
> > > > > > > > > worker.ajp13.port=8009
> > > > > > > > > worker.ajp13.host=localhost
> > > > > > > > > worker.ajp13.type=ajp13
> > > > > > > > > worker.ajp13.lbfactor=1
> > > > > > > > > worker.loadbalancer.type=lb
> > > > > > > > > worker.loadbalancer.balance_workers=ajp13
>
> > > > > > > > > (Of course, match the ajp port in the workers.property file 
> > > > > > > > > to the
> > > > > > > > > port you define in the server.xml file. Also, if your Tomcat 
> > > > > > > > > is not
> > > > > > on
> > > > > > > > > the same server as your Apache you will need to change the 
> > > > > > > > > localhost
> > > > > > > > > host entry to the correct host URL.)
>
> > > > > > > > > I hope this helps.
>
> > > > > > > > > On Feb 20, 12:51 pm, Fran <fra...@gmail.com> wrote:
> > > > > > > > > > Bad notices.
>
> > > > > > > > > > This dude has same problem that me and he was answered that 
> > > > > > > > > > mod_jk
> > > > > > > > > > dont support NIO
>
> > > > > > > > > > http://www.mail-archive.com/us...@tomcat.apache.org/msg67701.html
>
> > > > > > > > > > :(
>
> > > > > > > > > > On 20 feb, 19:13, Fran <fra...@gmail.com> wrote:
>
> > > > > > > > > > > Here the error when I change the protocol of
> > > > > > > > > > > protocol="org.apache.coyote.http11.Http11NioProtocol" to
> > > > > > protocol="AJP/
> > > > > > > > > > > 1.3"
>
> > > > > > > > > > > [error] jk_ajp_common.c (1962): (worker1) Tomcat is down 
> > > > > > > > > > > or
> > > > > > refused
> > > > > > > > > > > connection. No response has been sent to the client (yet)
> > > > > > > > > > > [error] jk_ajp_common.c (2466): (worker1) connecting to 
> > > > > > > > > > > tomcat
> > > > > > failed.
>
> > > > > > > > > > > On 20 feb, 19:04, Fran <fra...@gmail.com> wrote:
>
> > > > > > > > > > > > Should be due to protocol.
> > > > > > > > > > > > My messenger seems that need NIO protocol but if I put 
> > > > > > > > > > > > the NIO
> > > > > > > > > > > > protocol MOD_JK cant conect apache with tomcat
>
> > > > > > > > > > > > If I use this tomcat config, mod_jk cant conect apache 
> > > > > > > > > > > > with
> > > > > > tomcat.
>
> > > > > > > > > > > > <Connector
> > > > > > > > > > > > connectionTimeout="20000"
> > > > > > > > > > > > port="8081"
> > > > > > > > > > > > protocol="org.apache.coyote.http11.Http11NioProtocol"
> > > > > > > > > > > > maxThreads="5"
> > > > > > > > > > > > acceptorThreadCount="2"
> > > > > > > > > > > > redirectPort="8443"
> > > > > > > > > > > > socket.directBuffer="false" />
>
> > > > > > > > > > > > If I use the last tomcat config, tomcat cant execute the
> > > > > > servlet.
> > > > > > > > > > > > This is the error log:
>
> > > > > > > > > > > > GRAVE: Error, processing connection
> > > > > > > > > > > > java.lang.IndexOutOfBoundsException
> > > > > > > > > > > >         at java.io.BufferedInputStream.read(Unknown 
> > > > > > > > > > > > Source)
> > > > > > > > > > > >         at
> > > > > > > > > org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:620)
> > > > > > > > > > > >         at
> > > > > > > > > org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:577)
> > > > > > > > > > > >         at
>
> > > > > > org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
> > > > > > > > > > > > 685)
> > > > > > > > > > > >         at org.apache.jk.common.ChannelSocket
> > > > > > > > > > > > $SocketConnection.runIt(ChannelSocket.java:889)
> > > > > > > > > > > >         at org.apache.tomcat.util.threads.ThreadPool
> > > > > > > > > > > > $ControlRunnable.run(ThreadPool.java:690)
> > > > > > > > > > > >         at java.lang.Thread.run(Unknown Source)
>
> > > > > > > > > > > > On 20 feb, 18:49, Fran <fra...@gmail.com> wrote:
>
> > > > > > > > > > > > > I am
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to