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 @Override
042 public String getCacheability() {
043 return _cacheablity;
044 }
045
046 @Override
047 public String getETag() {
048 return null;
049 }
050
051 @Override
052 public String getLifecycle() {
053 return PortletRequest.RESOURCE_PHASE;
054 }
055
056 @Override
057 public Map<String, String[]> getPrivateRenderParameterMap() {
058 return null;
059 }
060
061 @Override
062 public String getResourceID() {
063 return _resourceID;
064 }
065
066 @Override
067 protected void init(
068 HttpServletRequest request, Portlet portlet,
069 InvokerPortlet invokerPortlet, PortletContext portletContext,
070 WindowState windowState, PortletMode portletMode,
071 PortletPreferences preferences, long plid) {
072
073 if (Validator.isNull(windowState.toString())) {
074 windowState = WindowState.NORMAL;
075 }
076
077 if (Validator.isNull(portletMode.toString())) {
078 portletMode = PortletMode.VIEW;
079 }
080
081 super.init(
082 request, portlet, invokerPortlet, portletContext, windowState,
083 portletMode, preferences, plid);
084
085 _cacheablity = ParamUtil.getString(
086 request, "p_p_cacheability", ResourceURL.PAGE);
087
088 _resourceID = request.getParameter("p_p_resource_id");
089
090 if (!PortalUtil.isValidResourceId(_resourceID)) {
091 _resourceID = StringPool.BLANK;
092 }
093 }
094
095 private String _cacheablity;
096 private String _resourceID;
097
098 }