<div dir="ltr">So here&#39;s what I&#39;m getting (my source code is attached) ...<div><br></div><div><br></div><div>__Telnet__</div><div><p style="margin:0px;font-size:11px;font-family:Menlo">dador-iMac:~ dador$ telnet 10.0.1.14 8080</p>

<p style="margin:0px;font-size:11px;font-family:Menlo">Trying 10.0.1.14...</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Connected to 10.0.1.14.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Escape character is &#39;^]&#39;.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">GET /wildfly-debug/upgrade HTTP/1.1</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Connection: upgrade</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">HTTP/1.1 101 Switching Protocols</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Connection: Upgrade</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">X-Powered-By: Undertow 1</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Server: Wildfly 8</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Content-Length: 0</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Date: Fri, 28 Mar 2014 20:22:36 GMT</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">the quick brown fox blah, blah, blah</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">^]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">telnet&gt; quit</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Connection closed.</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">dador-iMac:~ dador$ </p></div><div><br></div><div><br></div><div>__console___</div><div><p style="margin:0px;font-size:16px;font-family:Monaco">15:22:36,825 INFO  [stdout] (default task-15) servlet doGet() received &#39;upgrade&#39;</p>

<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:46,488 INFO  [stdout] (default I/O-3) listener onDataAvailable() called</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:46,488 INFO  [stdout] (default I/O-3) listener read &#39;the quick brown fox blah, blah, blah&#39;; successfully offered to queue</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:46,489 INFO  [stdout] (default I/O-3) listener read &#39;&#39;; successfully offered to queue</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,824 INFO  [stdout] (default I/O-3) listener onDataAvailable() called</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,824 INFO  [stdout] (default I/O-3) listener onAllDataRead() called</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,824 INFO  [stdout] (default I/O-3) here is data queued ...</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,825 INFO  [stdout] (default I/O-3) the quick brown fox blah, blah, blah</p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,825 INFO  [stdout] (default I/O-3) </p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,825 INFO  [stdout] (default I/O-3) </p>
<p style="margin:0px;font-size:16px;font-family:Monaco">15:22:56,825 INFO  [stdout] (default I/O-3) now do something</p></div><div><br></div><div><br></div><div>So the queue is getting the data as it&#39;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&#39;s onAllDataRead() method gets called.</div>
<div><br></div><div>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 &quot;upgrade&quot; versus &quot;Upgrade&quot;.</div><div><br></div>
<div>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.</div><div><br></div><div>Good luck,</div><div><br></div><div>--Jim.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 3:05 PM, PB <span dir="ltr">&lt;<a href="mailto:pbielicki@gmail.com" target="_blank">pbielicki@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div>Hi,<br><br></div>I dare to say that my code is correct ;) The problem is that it is NEVER called - this condition (even if it&#39;s wrong, however it&#39;s not) is never checked. When I remove this line:<br>

<br>out.setWriteListener(new EchoWriteListener(queue, out));<br><br></div><div>it seems to work. However, I have no writer, so it should be rather called SwallowListener... It&#39;s not my goal.<br><br></div><div>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. <a href="https://java.net/projects/tyrus/sources/source-code-repository/content/trunk/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java" target="_blank">https://java.net/projects/tyrus/sources/source-code-repository/content/trunk/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java</a><br>

<br></div><div>Thanks,<br></div><div>Przemyslaw<br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 5:14 PM, Heiko Braun <span dir="ltr">&lt;<a href="mailto:hbraun@redhat.com" target="_blank">hbraun@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">At a first glance, I&#39;d say your while{} block never returns. Is ServletInputStream.isFinished() what you&#39;ve been looking for, instead of isReady()<div>

<br><div><div>On 28 Mar 2014, at 16:26, PB &lt;<a href="mailto:pbielicki@gmail.com" target="_blank">pbielicki@gmail.com</a>&gt; wrote:</div><br><blockquote type="cite"><span style="font-family:&#39;courier new&#39;,monospace;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">while (in.isReady()) {</span></blockquote>

</div><br><div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;white-space:normal;font-family:Helvetica;word-wrap:break-word;word-spacing:0px">

<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<div>--</div><div><br></div><div><a href="http://about.me/hbraun" target="_blank">http://about.me/hbraun</a></div><div><br></div></div></span><br></div></span><br></div></span><br></div><br><br>
</div>
<br></div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br></blockquote></div><br></div>