1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet;
16  
17  import com.liferay.portal.kernel.util.ParamUtil;
18  import com.liferay.portal.kernel.util.Validator;
19  import com.liferay.portal.model.Portlet;
20  
21  import java.util.Map;
22  
23  import javax.portlet.PortletContext;
24  import javax.portlet.PortletMode;
25  import javax.portlet.PortletPreferences;
26  import javax.portlet.PortletRequest;
27  import javax.portlet.ResourceRequest;
28  import javax.portlet.ResourceURL;
29  import javax.portlet.WindowState;
30  
31  import javax.servlet.http.HttpServletRequest;
32  
33  /**
34   * <a href="ResourceRequestImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * @author Brian Wing Shun Chan
37   */
38  public class ResourceRequestImpl
39      extends ClientDataRequestImpl implements ResourceRequest {
40  
41      public String getCacheability() {
42          return _cacheablity;
43      }
44  
45      public String getETag() {
46          return null;
47      }
48  
49      public String getLifecycle() {
50          return PortletRequest.RESOURCE_PHASE;
51      }
52  
53      public Map<String, String[]> getPrivateRenderParameterMap() {
54          return null;
55      }
56  
57      public String getResourceID() {
58          return _resourceID;
59      }
60  
61      protected void init(
62          HttpServletRequest request, Portlet portlet,
63          InvokerPortlet invokerPortlet, PortletContext portletContext,
64          WindowState windowState, PortletMode portletMode,
65          PortletPreferences preferences, long plid) {
66  
67          if (Validator.isNull(windowState.toString())) {
68              windowState = WindowState.NORMAL;
69          }
70  
71          if (Validator.isNull(portletMode.toString())) {
72              portletMode = PortletMode.VIEW;
73          }
74  
75          super.init(
76              request, portlet, invokerPortlet, portletContext, windowState,
77              portletMode, preferences, plid);
78  
79          _cacheablity = ParamUtil.getString(
80              request, "p_p_cacheability", ResourceURL.PAGE);
81          _resourceID = request.getParameter("p_p_resource_id");
82      }
83  
84      private String _cacheablity;
85      private String _resourceID;
86  
87  }