Hi all
Perhap we use icepush in 2 portlet in different pages ,in different browser
i have a sceno 2 portlet communicate(send portlet,receiver portlet) ,i use IPC (jsr286), it send and receive data sucess ,and compile widgetset sucess,but reiceiver portlet not auto refresh
[b]
this is portlet send
[/b]
public class SenderEventApplication extends Application implements PortletListener{
Window window = new Window();
public void init() {
setMainWindow(window);
Label label = new Label("Hello Formbean!");
window.addComponent(label);
window.addComponent(label);
Button button = new Button("Say Hi");
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
// create an action URL and activate it to be able to create and
// send an event
if (getContext() instanceof PortletApplicationContext2) {
PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext();
// set HelloState shared render parameter before sending the
// event
// note that this is inefficient as each call creates an
// action
[b]
ctx.sendPortletEvent(getMainWindow(), new QName(
“http://www.test.com/test”, “hello”),
“hellow world”);
[/b]
}
}
});
window.addComponent(button);
if(getContext() instanceof PortletApplicationContext2){
PortletApplicationContext2 ctx=(PortletApplicationContext2) getContext();
ctx.addPortletListener(this, this);
}
}
public void handleRenderRequest(RenderRequest request,
RenderResponse response, Window window) {
if (getContext() instanceof PortletApplicationContext2) {
PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext();
}
}
public void handleActionRequest(ActionRequest request,
ActionResponse response, Window window) {
}
public void handleEventRequest(EventRequest request,
EventResponse response, Window window) {
}
}
public void handleResourceRequest(ResourceRequest request,
ResourceResponse response, Window window) {
}
}
this is portlet receiver
public class ReceiverEvent extends Application implements PortletListener,PortletRequestListener{
Window window = new Window(“Vaadin Portlet Application”);
ICEPush icepush=new ICEPush();
PortletApplicationContext2 ctx ;
HorizontalLayout hr=new HorizontalLayout();
public void init() {
setMainWindow(window);
if (getContext() instanceof PortletApplicationContext2) {
ctx = (PortletApplicationContext2) getContext();
ctx.addPortletListener(this, this);}
else {
throw new RuntimeException("Only servlet deployment is supported");
}
hr.addComponent(icepush);
window.addComponent(hr);
}
public void handleRenderRequest(RenderRequest request,
RenderResponse response, Window window) {
System.out.println("--------------"+request.getPublicParameterMap().size());
}
public void handleActionRequest(ActionRequest request,
ActionResponse response, Window window) {
}
public void handleEventRequest(EventRequest request,
EventResponse response, Window window) {
System.out.println("--------------"+request.getPublicParameterMap().size());
System.out.println(request.getParameter("hihi"));
if (request.getEvent().getName().equals("hello")) {
Label l=new Label request.getEvent().getValue().toString);
hr.addComponent(l);
icepush.push();
}
}
public void handleResourceRequest(ResourceRequest request,
ResourceResponse response, Window window) {
}
public void onRequestStart(PortletRequest request, PortletResponse response) {
}
public void onRequestEnd(PortletRequest request, PortletResponse response) {
}
}
thanks for suggestion