Problem with Chrome, regarding chapter 9

6 views
Skip to first unread message

XqSun

unread,
Oct 28, 2009, 8:46:23 AM10/28/09
to Google Web Toolkit Applications
Hi Ryan,

Thank you for your excellent book.

I have a problem when developing a new program, based on your example
of Chapter 9.

My program is very simple, client side sends a RPC request to server
to get a string to display a count number. Server delays 1 second
before sending back the count string. Thus the web screen displays a
count number increasing each second.

The program works well with hosted browser and IE. However, when I
test it on Chrome I see problems as following:
- Chrome always displays waiting mouse pointer (glass hour) and
loading icon on the tab. However the counter still works correctly
- If I press Escape keyboard button, Chrome stops that loading status
but the counter stops working too.

I have tried your example but did not see that problem.

Can you help me to find what I missed?
Thank you a lot in advance.

The code is bellow (I am using Eclipse):

-------------------------------------------
File TestMsg .java

package com.mysite.testmsg.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

public class TestMsg implements EntryPoint {
private final MyServiceAsync eventService = GWT.create
(MyService.class);
Label label = new Label("Count: 0");
private class GetEventsCallback implements AsyncCallback{
public void onFailure(Throwable throwable){ GWT.log("Client
GetEventsCallback: error get events", throwable); }
public void onSuccess(Object obj){
String str = (String)obj;
label.setText(str);
eventService.getEvent( this );
}
}

public void onModuleLoad() {
RootPanel.get().add(label);
eventService.getEvent( new GetEventsCallback() );
}
}

-------------------------------------------
File MyService .java
package com.mysite.testmsg.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("myservice")
public interface MyService extends RemoteService {
String getEvent();
}

-------------------------------------------
File MyServiceAsync.java
package com.mysite.testmsg.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface MyServiceAsync {
void getEvent(AsyncCallback<String> callback);
}


-------------------------------------------
File MyServiceImpl .java
package com.mysite.testmsg.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.mysite.testmsg.client.MyService;

@SuppressWarnings("serial")
public class MyServiceImpl extends RemoteServiceServlet implements
MyService {
static int count = 0;
public String getEvent() {
count++;
try{
synchronized( this ){
this.wait( 1*1000 );
}
}
catch (InterruptedException ignored){}
return "Count: "+count;
}
}


-------------------------------------------
File web.xml
<?xml version="1.0" encoding="UTF-8"?>

<web-app>
<servlet>
<servlet-name>myServlet</servlet-name>
<servlet-class>com.mysite.testmsg.server.MyServiceImpl</servlet-
class>
</servlet>

<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/testmsg/myservice</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>TestMsg.html</welcome-file>
</welcome-file-list>
</web-app>

-------------------------------------------
File TestMsg.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='testmsg'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<entry-point class='com.mysite.testmsg.client.TestMsg'/>
</module>

XqSun

unread,
Oct 29, 2009, 9:14:34 PM10/29/09
to Google Web Toolkit Applications
Anyone has any idea?

I have uploaded my program to http://gwtman.appspot.com/ so you can
check easily.
I see it runs well with my IE 8 but gets trouble with Chrome
3.0.195.27

Thank a lot in advance for any help.
Reply all
Reply to author
Forward
0 new messages