Bug #1065
openWMessageBox.show problem in JWt SimpleChat example
0%
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
Updated by David Hubbard almost 13 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.
Updated by Pieter Libin almost 13 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
Updated by David Hubbard almost 13 years ago
- File 1065_JBoss_SimpleChat_Logout_Async_False_Exception.txt 1065_JBoss_SimpleChat_Logout_Async_False_Exception.txt added
- File 1065_JBoss_SimpleChat_Logout_Async_True_Exception.txt 1065_JBoss_SimpleChat_Logout_Async_True_Exception.txt added
- File 1065_Jetty_SimpleChat_Logout_Async_True_Exception.txt 1065_Jetty_SimpleChat_Logout_Async_True_Exception.txt added
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