1 package org.exoplatform.services.portletcontainer.test.portlet; 2 3 import org.exoplatform.services.portletcontainer.ExoPortletContext; 4 import org.exoplatform.services.portletcontainer.event.DefaultPortletMessage; 5 6 import javax.portlet.*; 7 import java.io.IOException ; 8 import java.io.PrintWriter ; 9 10 14 15 22 public class PortletThatSendsMessage extends GenericPortlet{ 23 24 public void init(PortletConfig portletConfig) throws PortletException { 25 } 26 27 public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) 28 throws PortletException, IOException { 29 ExoPortletContext context = (ExoPortletContext) actionRequest.getPortletSession().getPortletContext(); 30 context.send("PortletThatReceivesMessage", 31 new DefaultPortletMessage("message sent"), 32 actionRequest); 33 actionResponse.setRenderParameter("status", "Everything is ok"); 34 } 35 36 public void render(RenderRequest renderRequest, RenderResponse renderResponse) 37 throws PortletException, IOException { 38 renderResponse.setContentType("text/html"); 39 ExoPortletContext context = (ExoPortletContext) renderRequest.getPortletSession().getPortletContext(); 40 context.send("PortletThatReceivesMessage", 41 new DefaultPortletMessage("message sent"), 42 renderRequest); 43 PrintWriter w = renderResponse.getWriter(); 44 w.println("Everything is ok"); 45 } 46 47 public void destroy() { 48 } 49 } 50 | Popular Tags |