Project

General

Profile

Bug #1065

WMessageBox.show problem in JWt SimpleChat example

Added by David Hubbard about 10 years ago. Updated about 10 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
Pieter Libin
Category:
-
Target version:
-
Start date:
11/21/2011
Due date:
% Done:

0%

Estimated time:

Description

Running the latest git (cloned 21/11) in Eclipse with Jetty.

After running guest chat sessions, when hitting "Logout" the MessageBox doesn't display, Browser session sticks on "loading" for a bit and then refreshes the browser, but original users are still flagged as "in use" i.e. logout() code isn't getting activated.

I've traced this (I think) to the use of the "StandardButton result = WMessageBox.show" statement - if I comment it out the logout gets performed.

So, I think there is a problem with the WMessageBox.show function, as it works when I patch code to use separate creation, show and event handling (as per Dialog example) as:

final WMessageBox box = new WMessageBox("Please Confirm", "Do you really want to logout?",

Icon.NoIcon, EnumSet.of(StandardButton.Yes, StandardButton.No));

box.show();

box.buttonClicked().addListener(this,

new Signal1.Listener() {

public void trigger(StandardButton result) {

box.remove();

if (result == StandardButton.No)

return;

if (listener_ != null) {

server*.chatEvent().removeListener(listener*); // do not listen for more events

listener_ = null;

server*.logout(user*);

letLogin();

}

}

Regards

Dave


Files

1065_JBoss_SimpleChat_Logout_Async_False_Exception.txt (4.79 KB) 1065_JBoss_SimpleChat_Logout_Async_False_Exception.txt Logout on JBoss with Async False David Hubbard, 11/23/2011 08:56 PM
1065_JBoss_SimpleChat_Logout_Async_True_Exception.txt (265 Bytes) 1065_JBoss_SimpleChat_Logout_Async_True_Exception.txt Logout on JBoss with Async True David Hubbard, 11/23/2011 08:56 PM
1065_Jetty_SimpleChat_Logout_Async_True_Exception.txt (2.77 KB) 1065_Jetty_SimpleChat_Logout_Async_True_Exception.txt Logout on Jetty with Async True David Hubbard, 11/23/2011 08:56 PM
#1

Updated by David Hubbard about 10 years ago

To be clear the reason I posted was really about the behaviour of the WMessageBox.show() function rather than the example app. Clearly I worked round that - although I wasn't clear that setting a listener within a listener function was correct.

#2

Updated by Pieter Libin about 10 years ago

  • Status changed from New to Feedback
  • Assignee set to Pieter Libin

Hey David,

The WMessageBox.show() function can only be used with a Servlet 3.0 compatible servlet containers, I just added this WMessageBox's documentation.

However, you should have received an exception reporting that you need a Servlet 3 container to invoke WDialog#exec(),

did this not happen in your environment?

The simplechat example was intended to be used only in a Servlet 3.0 containers, since it uses server push, which was until recently only supported on Servlet 3.0 containers.

Since this example now also works on Servlet 2.5 containers, I changed the example to create a WMessageBox object rather than use the static show method.

kind regards,

Pieter

#3

Updated by David Hubbard about 10 years ago

Pieter

Just a bit of feedback on this. JBoss is declaring it is "Using servlet API 3" and as below (with Async = true) fails and doesn't report an exception.

So, as per feedback on #1066 I think my safest option at present is to turn Async off AND use the new WMessageBox approach.

Can I check, are you indicating you will be patching latest git source for this? I notice there are Servlet 2.5 and 3 changes in latest updates, but didn't see anything on this. I'll have a quick retest with these changes.

So for info on my test cases:

A) With WMessageBox.show()

1) Jetty (2.5) with Async = "false": result = works

2) Jetty (2.5) with Async = "true": result = fails with exception raised (see attachment)

3) JBoss (3) with Async = "false": result = fails with exception raised (see attachment)

4) JBoss (3) with Async = "true": result = fails no exception, but session exits (see attachment)

B) With new WMessageBox() - all with results and caveat on IE as in #1066

1) Jetty with Async = "false", result = works

2) Jetty with Async = "true", result = works

3) JBoss with Async = "false", result = works

4) JBoss with Async = "true", result = fails

Regards

Dave

Also available in: Atom PDF