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