Index: portal-impl/src/com/liferay/portlet/ResourceResponseImpl.java =================================================================== --- portal-impl/src/com/liferay/portlet/ResourceResponseImpl.java (revision 15911) +++ portal-impl/src/com/liferay/portlet/ResourceResponseImpl.java (working copy) @@ -26,6 +26,7 @@ import javax.portlet.PortletRequest; import javax.portlet.PortletURL; +import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import javax.portlet.ResourceURL; @@ -49,14 +50,19 @@ public PortletURLImpl createPortletURLImpl( String portletName, String lifecycle) { - - if (lifecycle.equals(PortletRequest.ACTION_PHASE)) { + + String cacheability = null; + if(getPortletRequest() instanceof ResourceRequest){ + cacheability = ((ResourceRequest)getPortletRequest()).getCacheability(); + } + + if (lifecycle.equals(PortletRequest.ACTION_PHASE) && cacheability!= null && !cacheability.equals(ResourceURL.PAGE)) { throw new IllegalStateException( - "Unable to create an action URL from a resource response"); + "Unable to create a action URL from a resource response when the cacheability is not set to PAGE"); } - else if (lifecycle.equals(PortletRequest.RENDER_PHASE)) { + else if (lifecycle.equals(PortletRequest.RENDER_PHASE)&& cacheability!= null && !cacheability.equals(ResourceURL.PAGE)) { throw new IllegalStateException( - "Unable to create a render URL from a resource response"); + "Unable to create a render URL from a resource response when the cacheability is not set to PAGE"); } return super.createPortletURLImpl(portletName, lifecycle);