So here's what I'm getting (my source code is attached) ...__Telnet__dador-iMac:~ dador$ telnet 10.0.1.14 8080
Trying 10.0.1.14...
Connected to 10.0.1.14.
Escape character is '^]'.
GET /wildfly-debug/upgrade HTTP/1.1
Connection: upgrade
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
X-Powered-By: Undertow 1
Server: Wildfly 8
Content-Length: 0
Date: Fri, 28 Mar 2014 20:22:36 GMT
the quick brown fox blah, blah, blah
^]
telnet> quit
Connection closed.
dador-iMac:~ dador$
__console___15:22:36,825 INFO [stdout] (default task-15) servlet doGet() received 'upgrade'
15:22:46,488 INFO [stdout] (default I/O-3) listener onDataAvailable() called
15:22:46,488 INFO [stdout] (default I/O-3) listener read 'the quick brown fox blah, blah, blah'; successfully offered to queue
15:22:46,489 INFO [stdout] (default I/O-3) listener read ''; successfully offered to queue
15:22:56,824 INFO [stdout] (default I/O-3) listener onDataAvailable() called
15:22:56,824 INFO [stdout] (default I/O-3) listener onAllDataRead() called
15:22:56,824 INFO [stdout] (default I/O-3) here is data queued ...
15:22:56,825 INFO [stdout] (default I/O-3) the quick brown fox blah, blah, blah
15:22:56,825 INFO [stdout] (default I/O-3)
15:22:56,825 INFO [stdout] (default I/O-3)
15:22:56,825 INFO [stdout] (default I/O-3) now do something
So the queue is getting the data as it's being piped in (the blanks in the queued data are telnet line feeds). But I have to send a signal to the servlet that all of the data has been sent (I simply close the telnet connection). Then the listener's onAllDataRead() method gets called.So maybe this is a configuration issue. By the way, it made a difference for me in the telnet session when I specified the Connection as "upgrade" versus "Upgrade".Just a suggestion, but you may also want to take a look at the non-blocking I/O if you input stream is a long one.Good luck,--Jim.On Fri, Mar 28, 2014 at 3:05 PM, PB <pbielicki@gmail.com> wrote:_______________________________________________Hi,I dare to say that my code is correct ;) The problem is that it is NEVER called - this condition (even if it's wrong, however it's not) is never checked. When I remove this line:
out.setWriteListener(new EchoWriteListener(queue, out));it seems to work. However, I have no writer, so it should be rather called SwallowListener... It's not my goal.Maybe I should initialize WriteListener from the ReadListener after the first read? Or maybe, when I want to send back the response I should do this directly from the read listener? e.g. https://java.net/projects/tyrus/sources/source-code-repository/content/trunk/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java
Thanks,PrzemyslawOn Fri, Mar 28, 2014 at 5:14 PM, Heiko Braun <hbraun@redhat.com> wrote:
At a first glance, I'd say your while{} block never returns. Is ServletInputStream.isFinished() what you've been looking for, instead of isReady()
wildfly-dev mailing list
wildfly-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/wildfly-dev