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.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.ParamUtil;
20  import com.liferay.portal.model.Portlet;
21  
22  import java.util.Map;
23  
24  import javax.portlet.PortletContext;
25  import javax.portlet.PortletMode;
26  import javax.portlet.PortletPreferences;
27  import javax.portlet.PortletRequest;
28  import javax.portlet.ResourceRequest;
29  import javax.portlet.ResourceURL;
30  import javax.portlet.WindowState;
31  
32  import javax.servlet.http.HttpServletRequest;
33  
34  /**
35   * <a href="ResourceRequestImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   */
39  public class ResourceRequestImpl
40      extends ClientDataRequestImpl implements ResourceRequest {
41  
42      public String getCacheability() {
43          return _cacheablity;
44      }
45  
46      public String getETag() {
47          return null;
48      }
49  
50      public String getLifecycle() {
51          return PortletRequest.RESOURCE_PHASE;
52      }
53  
54      public Map<String, String[]> getPrivateRenderParameterMap() {
55          return null;
56      }
57  
58      public String getResourceID() {
59          return _resourceID;
60      }
61  
62      protected ResourceRequestImpl() {
63          if (_log.isDebugEnabled()) {
64              _log.debug("Creating new instance " + hashCode());
65          }
66      }
67  
68      protected void init(
69          HttpServletRequest request, Portlet portlet,
70          InvokerPortlet invokerPortlet, PortletContext portletContext,
71          WindowState windowState, PortletMode portletMode,
72          PortletPreferences prefs, long plid) {
73  
74          super.init(
75              request, portlet, invokerPortlet, portletContext, windowState,
76              portletMode, prefs, plid);
77  
78          _cacheablity = ParamUtil.getString(
79              request, "p_p_cacheability", ResourceURL.PAGE);
80          _resourceID = request.getParameter("p_p_resource_id");
81      }
82  
83      protected void recycle() {
84          if (_log.isDebugEnabled()) {
85              _log.debug("Recycling instance " + hashCode());
86          }
87  
88          super.recycle();
89  
90          _cacheablity = null;
91          _resourceID = null;
92      }
93  
94      private static Log _log = LogFactoryUtil.getLog(ResourceRequestImpl.class);
95  
96      private String _cacheablity;
97      private String _resourceID;
98  
99  }