01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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: public class PortletHeaderRequestImpl implements PortletHeaderRequest {
29: private RequestContext requestContext;
30: private String portletApplicationContextPath;
31: private PortletWindow portletWindow;
32: private ParameterSet initParamSet;
33:
34: public PortletHeaderRequestImpl(RequestContext requestContext,
35: PortletWindow portletWindow,
36: String portletApplicationContextPath) {
37: this .requestContext = requestContext;
38: this .portletApplicationContextPath = portletApplicationContextPath;
39: this .portletWindow = portletWindow;
40: }
41:
42: public String getPortalContextPath() {
43: return requestContext.getRequest().getContextPath();
44: }
45:
46: public PortletPreferences getPreferences() {
47: return new PortletPreferencesImpl(
48: org.apache.pluto.Constants.METHOD_NOOP,
49: this .portletWindow.getPortletEntity());
50: }
51:
52: public String getInitParameter(String name) {
53: ParameterSet iParamSet = this .initParamSet;
54: if (iParamSet == null) {
55: iParamSet = this .portletWindow.getPortletEntity()
56: .getPortletDefinition().getInitParameterSet();
57: this .initParamSet = iParamSet;
58: }
59: if (iParamSet != null) {
60: Parameter initParam = iParamSet.get(name);
61: if (initParam != null) {
62: return initParam.getValue();
63: }
64: }
65: return null;
66: }
67:
68: /**
69: * @return Returns the portletApplicationContextPath.
70: */
71: public String getPortletApplicationContextPath() {
72: return portletApplicationContextPath;
73: }
74:
75: }
|