View Javadoc

1   /*
2    * Copyright 2003,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  /* 
17  
18   */
19  
20  package org.apache.pluto.portlet;
21  
22  import javax.portlet.*;
23  import org.apache.pluto.core.*;
24  
25  import org.apache.pluto.om.window.PortletWindow;
26  import org.apache.pluto.om.portlet.PortletDefinition;
27  import org.apache.pluto.om.portlet.PortletApplicationDefinition;
28  
29  
30  public class PortletUtils
31  {
32  
33      // Access to InternalPortletRequest
34      public static PortletWindow getPortletWindow(RenderRequest request)
35      {
36          InternalPortletRequest internalRequest = CoreUtils.getInternalRequest(request);
37          return internalRequest.getInternalPortletWindow();
38      }
39  
40      public static PortletWindow getPortletWindow(ActionRequest request)
41      {
42          InternalPortletRequest internalRequest = CoreUtils.getInternalRequest(request);
43          return internalRequest.getInternalPortletWindow();
44      }
45  
46      // Access to InternalPortletResponse
47      public static PortletWindow getPortletWindow(RenderResponse response)
48      {
49          InternalPortletResponse internalResponse = CoreUtils.getInternalResponse(response);
50          return internalResponse.getInternalPortletWindow();
51      }
52  
53      public static PortletWindow getPortletWindow(ActionResponse response)
54      {
55          InternalPortletResponse internalResponse = CoreUtils.getInternalResponse(response);
56          return internalResponse.getInternalPortletWindow();
57      }
58  
59      // Access to InternalPortletConfig
60      public static javax.servlet.ServletConfig getServletConfig(PortletConfig config)
61      {
62          InternalPortletConfig internalConfig = CoreUtils.getInternalConfig(config);
63          return internalConfig.getServletConfig();
64      }
65  
66      public static PortletDefinition getPortletDefinition(PortletConfig config)
67      {
68          InternalPortletConfig internalConfig = CoreUtils.getInternalConfig(config);
69          return internalConfig.getInternalPortletDefinition();
70      }
71  
72      // Access to InternalPortletContext
73      public static javax.servlet.ServletContext getServletContext(PortletContext context)
74      {
75          InternalPortletContext internalContext = CoreUtils.getInternalContext(context);
76          return internalContext.getServletContext();
77      }
78  
79      public static PortletApplicationDefinition getPortletApplicationDefinition(PortletContext context)
80      {
81          InternalPortletContext internalContext = CoreUtils.getInternalContext(context);
82          return internalContext.getInternalPortletApplicationDefinition();
83      }
84  
85  }