KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > portlet > cms > ContentPortlet


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.core.portlet.cms;
10
11 import org.jboss.portlet.JBossActionRequest;
12 import org.jboss.portlet.JBossActionResponse;
13 import org.jboss.portlet.JBossRenderRequest;
14 import org.jboss.portlet.JBossRenderResponse;
15
16 import javax.portlet.PortletException;
17 import javax.portlet.PortletSecurityException;
18 import javax.portlet.UnavailableException;
19 import java.io.IOException JavaDoc;
20
21 /**
22  * <p>This portlet displays an URI from the CMS store.</p>
23  *
24  * <p>The URI to display is retrieved from the portlet preferences under the key uri.</p>
25  *
26  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
27  * @version $Revision: 1.2 $
28  */

29 public class ContentPortlet extends CMSPortlet
30 {
31
32    public void processAction(JBossActionRequest req, JBossActionResponse resp) throws PortletException, PortletSecurityException, IOException JavaDoc
33    {
34       throw new PortletException();
35    }
36
37    public void render(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, IOException JavaDoc
38    {
39       resp.setTitle(getTitle(req));
40       doView(req, resp);
41    }
42
43    protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, IOException JavaDoc, UnavailableException
44    {
45       String JavaDoc uri = req.getPreferences().getValue("uri", null);
46       if (uri == null)
47       {
48          throw new PortletException("No URI defined");
49       }
50       req.getPortletSession().setAttribute("uri", uri);
51       super.doView(req, resp);
52    }
53 }
54
Popular Tags