1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.portal;
18
19
20
21 import org.apache.jetspeed.om.registry.RegistryEntry;
22 import org.apache.jetspeed.om.registry.PortletEntry;
23 import org.apache.jetspeed.services.Registry;
24
25
26 import org.apache.turbine.util.DynamicURI;
27 import org.apache.turbine.util.ParameterParser;
28 import org.apache.turbine.util.RunData;
29
30 /***
31 <p>
32 Handles providing URIs to Portlet interface providers.
33 </p>
34
35 <p>
36 The URIs are based on the individual actions such as Edit/Max. Editing a
37 portlet allows you to preview it and perform certain actions such as subscribing
38 to it or adding it to your Mozilla sidebar. Maximizing a portlet allows you to
39 view this portlet at full screen.
40 </p>
41
42 <p>
43 The following HTTP parameters are used to allow Jetspeed to figure out what to
44 render:
45
46 <pre>
47 name: fetches the name from the portlet registry and then adds some more info:
48 - url: the URL on which this portlet is based
49 - parameter-{NAME]: allows the client to add params to a Portlet
50 - metainfo-[NAME}: allows the client to supply the title or description
51 of the Portlet
52 </pre>
53
54 </p>
55
56 @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
57 @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
58 @version $Id: PortletURIManager.java,v 1.40 2004/02/23 04:05:35 jford Exp $
59 */
60
61 public class PortletURIManager {
62
63
64
65 /***
66 Get a PortletURI by it's name and rundata
67
68 @see #getPortletMaxURI( RegistryEntry, RunData)
69 */
70 public static DynamicURI getPortletMaxURI( String name, RunData data ) {
71 return getPortletMaxURI(
72 Registry.getEntry(Registry.PORTLET, name ),
73 data );
74 }
75
76 /***
77 Get a URI for viewing this portlet by itself. This is the only method that
78 will work if the user has disabled cookies.
79 */
80
81 public static DynamicURI getPortletEditURI( Portlet portlet,
82 RunData data) {
83
84 DynamicURI uri = new DynamicURI( data, "Info" );
85 uri.addPathInfo( "portlet", portlet.getName() );
86
87 return uri;
88
89 }
90
91
92 /***
93 Get a URL for viewing this URL full screen. This is the only method that
94 will work if the user has disabled cookies.
95 */
96 public static DynamicURI getPortletMaxURI( RegistryEntry entry, RunData data ) {
97
98 DynamicURI uri = new DynamicURI( data );
99
100 uri.addPathInfo( "portlet", entry.getName() );
101
102 return uri;
103
104 }
105
106 /***
107 <p>
108 Given a ParameterParser, get a PortletEntry. This is used so that when you have a
109 URI created from PortletURIManager you can get back the PortletEntry that created
110 it originally.
111 </p>
112
113 <p>
114 Return null if we aren't able to figure out the PortletEntry
115 </p>
116 */
117 public static final PortletEntry getEntry( ParameterParser params )
118 {
119 String name = params.getString( "portlet" );
120 return (PortletEntry)Registry.getEntry(Registry.PORTLET, name );
121 }
122
123 }