1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jetspeed.portal.portlets;
19
20
21 import org.apache.jetspeed.portal.PortletConfig;
22
23 /***
24 * Extend AbstractPortlet to re-define the handle used for portlet caching:
25 * This handle uses the portlet's unique id and the portal page's id to form
26 * a portlet instance id for caching.
27 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
28 * @author <a href="mailto:ggolden@apache.org">Glenn R. Golden</a>
29 */
30 public class AbstractInstancePortlet
31 extends AbstractPortlet
32 {
33 /***
34 * Construct the handle used for caching.
35 * @param config The config object, expected to be a PortletConfig.
36 */
37 public static Object getHandle(Object config)
38 {
39
40
41 PortletConfig pc = null;
42
43 if (!(config instanceof PortletConfig))
44 {
45 return null;
46 }
47
48
49
50 pc = (PortletConfig)config;
51
52 StringBuffer handle = new StringBuffer(256);
53 handle.append(pc.getPageId());
54 handle.append('/');
55 handle.append(pc.getPortletId());
56
57 return handle.toString();
58
59 }
60
61 }
62