001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.kernel.util.Validator;
020 import com.liferay.portal.model.Portlet;
021 import com.liferay.portal.util.PortalUtil;
022
023 import java.util.Map;
024
025 import javax.portlet.PortletContext;
026 import javax.portlet.PortletMode;
027 import javax.portlet.PortletPreferences;
028 import javax.portlet.PortletRequest;
029 import javax.portlet.ResourceRequest;
030 import javax.portlet.ResourceURL;
031 import javax.portlet.WindowState;
032
033 import javax.servlet.http.HttpServletRequest;
034
035
038 public class ResourceRequestImpl
039 extends ClientDataRequestImpl implements ResourceRequest {
040
041 public String getCacheability() {
042 return _cacheablity;
043 }
044
045 @Override
046 public String getETag() {
047 return null;
048 }
049
050 @Override
051 public String getLifecycle() {
052 return PortletRequest.RESOURCE_PHASE;
053 }
054
055 public Map<String, String[]> getPrivateRenderParameterMap() {
056 return null;
057 }
058
059 public String getResourceID() {
060 return _resourceID;
061 }
062
063 @Override
064 protected void init(
065 HttpServletRequest request, Portlet portlet,
066 InvokerPortlet invokerPortlet, PortletContext portletContext,
067 WindowState windowState, PortletMode portletMode,
068 PortletPreferences preferences, long plid) {
069
070 if (Validator.isNull(windowState.toString())) {
071 windowState = WindowState.NORMAL;
072 }
073
074 if (Validator.isNull(portletMode.toString())) {
075 portletMode = PortletMode.VIEW;
076 }
077
078 super.init(
079 request, portlet, invokerPortlet, portletContext, windowState,
080 portletMode, preferences, plid);
081
082 _cacheablity = ParamUtil.getString(
083 request, "p_p_cacheability", ResourceURL.PAGE);
084
085 _resourceID = request.getParameter("p_p_resource_id");
086
087 if (!PortalUtil.isValidResourceId(_resourceID)) {
088 _resourceID = StringPool.BLANK;
089 }
090 }
091
092 private String _cacheablity;
093 private String _resourceID;
094
095 }