KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portletcontainer > test > portlet > PortletThatSendsMessage


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 JavaDoc;
8 import java.io.PrintWriter JavaDoc;
9
10 /**
11  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
12  * Please look at license.txt in info directory for more license detail.
13  **/

14
15 /**
16  * Created by the Exo Development team.
17  * Author : Mestrallet Benjamin
18  * benjmestrallet@users.sourceforge.net
19  * Date: 19 nov. 2003
20  * Time: 00:41:37
21  */

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 JavaDoc {
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 JavaDoc {
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 JavaDoc w = renderResponse.getWriter();
44     w.println("Everything is ok");
45     }
46
47     public void destroy() {
48     }
49 }
50
Popular Tags