/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portlet;
import com.liferay.portal.kernel.model.Portlet;
import com.liferay.portal.kernel.portlet.InvokerPortlet;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import java.util.Map;
import javax.portlet.PortletContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceURL;
import javax.portlet.WindowState;
import javax.servlet.http.HttpServletRequest;
/**
* @author Brian Wing Shun Chan
*/
public class ResourceRequestImpl
extends ClientDataRequestImpl implements ResourceRequest {
@Override
public String getCacheability() {
return _cacheablity;
}
@Override
public String getETag() {
return null;
}
@Override
public String getLifecycle() {
return PortletRequest.RESOURCE_PHASE;
}
@Override
public Map<String, String[]> getPrivateRenderParameterMap() {
return null;
}
@Override
public String getResourceID() {
return _resourceID;
}
@Override
protected void init(
HttpServletRequest request, Portlet portlet,
InvokerPortlet invokerPortlet, PortletContext portletContext,
WindowState windowState, PortletMode portletMode,
PortletPreferences preferences, long plid) {
if (Validator.isNull(windowState.toString())) {
windowState = WindowState.NORMAL;
}
if (Validator.isNull(portletMode.toString())) {
portletMode = PortletMode.VIEW;
}
super.init(
request, portlet, invokerPortlet, portletContext, windowState,
portletMode, preferences, plid);
_cacheablity = ParamUtil.getString(
request, "p_p_cacheability", ResourceURL.PAGE);
_resourceID = request.getParameter("p_p_resource_id");
if (!PortalUtil.isValidResourceId(_resourceID)) {
_resourceID = StringPool.BLANK;
}
}
private String _cacheablity;
private String _resourceID;
}