Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
how to let the browser know the data change in server?
I met a problem.In a tabSheet, I create a table and let it hold the data which get from the server. and Then, a new a Thread to get the data from server 3 second per and update the table's data. But the data still hold the old data and never change any more. But if I click the Item in the table, the data can be updata.I see the data packages, find that when I click the Item, browser comunicate with the server and get the newly data.
At last, I guess the data change in server but the browser don't know it. When click, it's sync.
I used ICEpush add-on to let the broser know the changes, but also met some problem.The browser tips that:
Widgetset does not contain implementation for org.vaadin.artur.icepush.ICEPush. Check its @ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:
-Unrendered UIDL
-org.vaadin.artur.icepush.ICEPush(NO CLIENT IMPLEMENTATION FOUND) id=PID2 pushGroup=ICEPush-1 codeLocation=/EM_testing/code.icepush
can you help me? Thanks.
I put some codes below:
web.xml:
<servlet>
<servlet-name>Emasp Application</servlet-name>
<!--
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
-->
<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
<init-param>
<description>Emasp application class to start</description>
<param-name>application</param-name>
<param-value>com.siemens.emasp.action.MainApplication</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>com.siemens.emasp.ui.widgetset</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Emasp Application</servlet-name>
<url-pattern>/admin/*</url-pattern>
</servlet-mapping>
The class for MainApplication:
public class MainApplication extends Application {
private TabSheet right = new TabSheet();
public static boolean start = false;
public MainFrameApplistTab mt = null;
private ICEPush pusher = new ICEPush();
@Override
public void init() {
// TODO Auto-generated method stub
buildMainFrameWork();
}
class Test extends Thread{
@Override
public void run() {
// TODO Auto-generated method stub
while(start && mt != null){
try {
Thread.sleep(3000);
System.out.println("run:---->" + Thread.currentThread().getName());
mt.refreshTable();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//push the changes
pusher.push();
}
}
}
private void buildMainFrameWork(){
setTheme("mainApptheme");
System.out.println("buildMainFrameWork:---->" + Thread.currentThread().getName());
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
Window main = new Window("Browser title...", root);
setMainWindow(main);
main.addComponent(pusher);
Label title = new Label("EM Testing");
title.addStyleName(Runo.LABEL_H1);
title.setSizeUndefined();
root.addComponent(title);
root.setComponentAlignment(title, Alignment.TOP_CENTER);
right.setSizeFull();
root.addComponent(right);
root.setExpandRatio(title, 0);
root.setExpandRatio(right, 1);
right.addTab(new Label("Testing"), "Testing", null);
right.addTab(new Button("Testing"), "Buttoning", null);
right.addTab(new MainFrameApplistTab(), "ApplistInfo", null);
right.addListener(new TabSheet.SelectedTabChangeListener() {
@Override
public void selectedTabChange(SelectedTabChangeEvent event) {
// TODO Auto-generated method stub
mt = null;
if(right.getSelectedTab() instanceof AbstractFrameTab){
if(right.getSelectedTab() instanceof MainFrameApplistTab){
start = true;
mt = (MainFrameApplistTab)right.getSelectedTab();
new Test().start();
}else{
start = false;
AbstractFrameTab tab = (AbstractFrameTab) right.getSelectedTab();
tab.refreshTable();
}
}else{
start = false;
}
System.out.println(start + "------------------------");
}
});
}
}
To use ICEPush, you will have to recompile your widgetset. You could also use a non-visible ProgressBar as that (Core-)Component would also query the server periodically.
Tobias Demuth: To use ICEPush, you will have to recompile your widgetset. You could also use a non-visible ProgressBar as that (Core-)Component would also query the server periodically.
Sorry, I am a newly to Vaadin. If I recompile, it will work? Does any other process I should do? In ICEPush.zip package which I download,there are three jars and no widgets,and put jar files in lib of the WEB-INFO, why recompile again?
Can you give me a simple demo for ICEPush, thanks! My Email is gengchenzhong@163.com.
Henri Sara: See the demo project source links on the right of the ICEPush add-on directory page.
I run that simple, but there's nothing to hanpen. Do I need also to recompile it? there's no widgets file in zip package.
Henri Sara: See the demo project source links on the right of the ICEPush add-on directory page.
In web.xml, my code below
<servlet>
<servlet-name>Emasp Application</servlet-name>
<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
<init-param>
<description>Emasp application class to start</description>
<param-name>application</param-name>
<param-value>com.siemens.emasp.action.ICEPushDemmo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Emasp Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Is there any problems?
You also need to refer to the widgetset in your web.xml, e.g.
<init-param>
<description>Application widgetset</description>
<param-name>widgetset</param-name>
<param-value>my.package.MyWidgetset</param-value>
</init-param>
and your widgetset should inherit the default widgetset and the IcePush widgetset.
See this help page for general instructions on how to use add-ons with custom widgets - it even has a video showing how to do this in Eclipse.
For corresponding files in one of the IcePush demo projects, see e.g. MultiusercalendarWidgetset.gwt.xml and web.xml of one of the demos, then recompile the widgetset (using the Vaadin add-on for Eclipse "Compile widgetset" button in the toolbar or a build script.
Tobias Demuth: To use ICEPush, you will have to recompile your widgetset. You could also use a non-visible ProgressBar as that (Core-)Component would also query the server periodically.
Tobias Demuth: To use ICEPush, you will have to recompile your widgetset. You could also use a non-visible ProgressBar as that (Core-)Component would also query the server periodically.
I write another sample referenced from demo project of the ICEPush. This time the browser tips that:
"Fail to load the widgetset:
/ICEPushDemo/VAADIN/widgetsets/com.vaadin.terminia.gwt.DefaultWidgetSet
/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1336723778359".
In my sample,there are two file total. the all code below:(How can I get the "ICEPushDemo/VAADIN/widgetsets/....."? Do I recompile, it will produce or else)
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<servlet>
<servlet-name>Emasp Application</servlet-name>
<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
<init-param>
<description>Emasp application class to start</description>
<param-name>application</param-name>
<param-value>com.siemens.emasp.action.ICEPushDemo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Emasp Application</servlet-name>
<url-pattern>/admin/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
the ICEPushDemo.java below:
public class ICEPushDemo extends Application {
private ICEPush pusher = new ICEPush();
@Override
public void init() {
System.out.println("Enter the init==============================");
Window mainWindow = new Window("Icepushaddon Application");
setMainWindow(mainWindow);
// Add the push component
mainWindow.addComponent(pusher);
System.out.println("begin to addComponent to window===================");
// Add a button for starting background work
getMainWindow().addComponent(
new Button("Do stuff in the background", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getMainWindow()
.addComponent(
new Label(
"Waiting for background process to complete..."));
new BackgroundThread().start();
}
}));
}
public class BackgroundThread extends Thread {
@Override
public void run() {
// Simulate background work
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
// Update UI
synchronized (ICEPushDemo.this) {
getMainWindow().addComponent(new Label("All done"));
}
// Push the changes
pusher.push();
}
}
}
In case still unresolved, check my previous post (posted around the same time you posted this).
Your project should have its own widgetset (referring to DefaultWidgetSet and the ICEPush add-on widgetset) and you need to compile it. Then add a parameter in your web.xml to use it. See the links in my post for more information.
Henri Sara: In case still unresolved, check my previous post (posted around the same time you posted this).
Your project should have its own widgetset (referring to DefaultWidgetSet and the ICEPush add-on widgetset) and you need to compile it. Then add a parameter in your web.xml to use it. See the links in my post for more information.
Henri Sara: In case still unresolved, check my previous post (posted around the same time you posted this).
Your project should have its own widgetset (referring to DefaultWidgetSet and the ICEPush add-on widgetset) and you need to compile it. Then add a parameter in your web.xml to use it. See the links in my post for more information.
I'm sorry to reply you so late. I had solve this problem. At last, I found that I configure the wrong path for ICEPush. Because ICEPush related URL should match with org.vaadin.artur.icepush.ICEPushServlet.so the url-pattern should /*, I had configued it "/admin/*", now It's ok, thank you very much.
Hello Henri Sara!
I am testing Vaadin 7 rc2 with Spring integration - how to add the ICEPush servlet to web.xml? My the primary servlet is a SpringIntegrationServlet... i tryed create a second servlet ICEPushServlet in web.xml, but in application push method do not work.
This is a very different topic and should be in a separate thread, but: you need to combine the code of the two servlets - probably inherit one and add the relevant code from the other to your servlet subclass. When we get built-in push support (currently targeted for 7.1 in the roadmap) this should get easier.