View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.portletbridge.portlet;
17  
18  import javax.portlet.PortletPreferences;
19  import javax.portlet.PortletURL;
20  import javax.portlet.RenderRequest;
21  import javax.portlet.RenderResponse;
22  
23  /***
24   * @author JMcCrindle
25   */
26  public class PortletFunctions {
27      
28      private RenderRequest request = null;
29      private RenderResponse response = null;
30      private PortletPreferences preferences;
31  
32      public PortletFunctions(RenderRequest request, RenderResponse response) {
33          this.request = request;
34          this.response = response;
35          this.preferences = request.getPreferences();
36      }
37  
38      public RenderRequest getRequest() {
39          return request;
40      }
41      public RenderResponse getResponse() {
42          return response;
43      }
44      public PortletPreferences getPreferences() {
45          return preferences;
46      }
47      public String actionUrl() {
48          PortletURL portletURL = this.response.createActionURL();
49          return portletURL.toString();
50      }
51      public String preference(String name, String defaultValue) {
52          return preferences.getValue(name, defaultValue);
53      }
54      public String systemProxyHost() {
55          return System.getProperty("proxyHost");
56      }
57      public String systemProxyPort() {
58          return System.getProperty("proxyPort");
59      }
60  }