1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.aggregator.impl;
18
19 import javax.portlet.PortletPreferences;
20
21 import org.apache.jetspeed.portlet.PortletHeaderRequest;
22 import org.apache.jetspeed.request.RequestContext;
23 import org.apache.pluto.core.impl.PortletPreferencesImpl;
24 import org.apache.pluto.om.common.ParameterSet;
25 import org.apache.pluto.om.common.Parameter;
26 import org.apache.pluto.om.window.PortletWindow;
27
28
29 public class PortletHeaderRequestImpl implements PortletHeaderRequest
30 {
31 private RequestContext requestContext;
32 private String portletApplicationContextPath;
33 private PortletWindow portletWindow;
34 private ParameterSet initParamSet;
35
36 public PortletHeaderRequestImpl( RequestContext requestContext, PortletWindow portletWindow, String portletApplicationContextPath )
37 {
38 this.requestContext = requestContext;
39 this.portletApplicationContextPath = portletApplicationContextPath;
40 this.portletWindow = portletWindow;
41 }
42
43 public String getPortalContextPath()
44 {
45 return requestContext.getRequest().getContextPath();
46 }
47
48 public PortletPreferences getPreferences()
49 {
50 return new PortletPreferencesImpl(org.apache.pluto.Constants.METHOD_NOOP, this.portletWindow.getPortletEntity());
51 }
52
53 public String getInitParameter( String name )
54 {
55 ParameterSet iParamSet = this.initParamSet;
56 if ( iParamSet == null )
57 {
58 iParamSet = this.portletWindow.getPortletEntity().getPortletDefinition().getInitParameterSet();
59 this.initParamSet = iParamSet;
60 }
61 if ( iParamSet != null )
62 {
63 Parameter initParam = iParamSet.get( name );
64 if ( initParam != null )
65 {
66 return initParam.getValue();
67 }
68 }
69 return null;
70 }
71
72 /***
73 * @return Returns the portletApplicationContextPath.
74 */
75 public String getPortletApplicationContextPath()
76 {
77 return portletApplicationContextPath;
78 }
79
80 }