[wildfly-dev] WF 8.0 HTTP Upgrade help needed
Jim McGuinness
dador92 at gmail.com
Fri Mar 28 16:31:01 EDT 2014
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 at 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,
> Przemyslaw
>
>
> On Fri, Mar 28, 2014 at 5:14 PM, Heiko Braun <hbraun at 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()
>>
>> On 28 Mar 2014, at 16:26, PB <pbielicki at gmail.com> wrote:
>>
>> while (in.isReady()) {
>>
>>
>> --
>>
>> http://about.me/hbraun
>>
>>
>>
>>
>>
>>
>>
>>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140328/1258eef2/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EchoHandler.java
Type: application/octet-stream
Size: 703 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140328/1258eef2/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EchoReadListener.java
Type: application/octet-stream
Size: 1270 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140328/1258eef2/attachment-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UpgradeServlet.java
Type: application/octet-stream
Size: 903 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140328/1258eef2/attachment-0002.obj
More information about the wildfly-dev
mailing list