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