1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.kernel.util.ParamUtil;
25  import com.liferay.portal.model.Portlet;
26  
27  import java.util.Map;
28  
29  import javax.portlet.PortletContext;
30  import javax.portlet.PortletMode;
31  import javax.portlet.PortletPreferences;
32  import javax.portlet.PortletRequest;
33  import javax.portlet.ResourceRequest;
34  import javax.portlet.WindowState;
35  
36  import javax.servlet.http.HttpServletRequest;
37  
38  /**
39   * <a href="ResourceRequestImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * @author Brian Wing Shun Chan
42   *
43   */
44  public class ResourceRequestImpl
45      extends ClientDataRequestImpl implements ResourceRequest {
46  
47      public String getCacheability() {
48          return _cacheablity;
49      }
50  
51      public String getETag() {
52          return null;
53      }
54  
55      public String getLifecycle() {
56          return PortletRequest.RESOURCE_PHASE;
57      }
58  
59      public Map<String, String[]> getPrivateRenderParameterMap() {
60          return null;
61      }
62  
63      public String getResourceID() {
64          return _resourceID;
65      }
66  
67      protected ResourceRequestImpl() {
68          if (_log.isDebugEnabled()) {
69              _log.debug("Creating new instance " + hashCode());
70          }
71      }
72  
73      protected void init(
74          HttpServletRequest request, Portlet portlet,
75          InvokerPortlet invokerPortlet, PortletContext portletContext,
76          WindowState windowState, PortletMode portletMode,
77          PortletPreferences prefs, long plid) {
78  
79          super.init(
80              request, portlet, invokerPortlet, portletContext, windowState,
81              portletMode, prefs, plid);
82  
83          _cacheablity = ParamUtil.getString(request, "p_p_cacheability");
84          _resourceID = request.getParameter("p_p_resource_id");
85      }
86  
87      protected void recycle() {
88          if (_log.isDebugEnabled()) {
89              _log.debug("Recycling instance " + hashCode());
90          }
91  
92          super.recycle();
93  
94          _cacheablity = null;
95          _resourceID = null;
96      }
97  
98      private static Log _log = LogFactoryUtil.getLog(ResourceRequestImpl.class);
99  
100     private String _cacheablity;
101     private String _resourceID;
102 
103 }