Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-54099 Skip rendering only if logic in portlet_content_wrapper is going to executed #34523

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions portal-impl/src/com/liferay/portal/util/PortalImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6471,6 +6471,59 @@ public boolean isSecure(HttpServletRequest request) {
return secure;
}

@Override
public boolean isSkipPortletContentProcessing(
Group group, HttpServletRequest httpServletRequest,
LayoutTypePortlet layoutTypePortlet, PortletDisplay portletDisplay,
String portletName)
throws Exception {

boolean skipPortletContentRendering = isSkipPortletContentRendering(
group, layoutTypePortlet, portletDisplay, portletName);

if (!skipPortletContentRendering) {
return false;
}

Portlet portlet = PortletLocalServiceUtil.getPortletById(
getCompanyId(httpServletRequest), portletDisplay.getId());

if (portlet.isSystem() || !portlet.isUseDefaultTemplate()) {
return false;
}

ServletContext servletContext =
(ServletContext)httpServletRequest.getAttribute(WebKeys.CTX);

InvokerPortlet invokerPortlet = PortletInstanceFactoryUtil.create(
portlet, servletContext);

if (invokerPortlet.isStrutsPortlet() ||
invokerPortlet.isStrutsBridgePortlet()) {

return false;
}

return true;
}

@Override
public boolean isSkipPortletContentRendering(
Group group, LayoutTypePortlet layoutTypePortlet,
PortletDisplay portletDisplay, String portletName)
throws PortalException {

if (group.isLayoutPrototype() &&
layoutTypePortlet.hasPortletId(portletDisplay.getId()) &&
portletDisplay.isModeView() &&
!portletName.equals(PortletKeys.NESTED_PORTLETS)) {

return true;
}

return false;
}

@Override
public boolean isSystemGroup(String groupName) {
if (groupName == null) {
Expand Down
13 changes: 13 additions & 0 deletions portal-service/src/com/liferay/portal/util/Portal.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import com.liferay.portal.model.LayoutFriendlyURLComposite;
import com.liferay.portal.model.LayoutQueryStringComposite;
import com.liferay.portal.model.LayoutSet;
import com.liferay.portal.model.LayoutTypePortlet;
import com.liferay.portal.model.Portlet;
import com.liferay.portal.model.ResourcePermission;
import com.liferay.portal.model.User;
import com.liferay.portal.theme.PortletDisplay;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portlet.expando.model.ExpandoBridge;

Expand Down Expand Up @@ -1328,6 +1330,17 @@ public boolean isLayoutDescendant(Layout layout, long layoutId)

public boolean isSecure(HttpServletRequest request);

public boolean isSkipPortletContentProcessing(
Group group, HttpServletRequest httpServletRequest,
LayoutTypePortlet layoutTypePortlet, PortletDisplay portletDisplay,
String portletName)
throws Exception;

public boolean isSkipPortletContentRendering(
Group group, LayoutTypePortlet layoutTypePortlet,
PortletDisplay portletDisplay, String portletName)
throws PortalException;

public boolean isSystemGroup(String groupName);

public boolean isSystemRole(String roleName);
Expand Down
22 changes: 22 additions & 0 deletions portal-service/src/com/liferay/portal/util/PortalUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
import com.liferay.portal.model.LayoutFriendlyURLComposite;
import com.liferay.portal.model.LayoutQueryStringComposite;
import com.liferay.portal.model.LayoutSet;
import com.liferay.portal.model.LayoutTypePortlet;
import com.liferay.portal.model.Portlet;
import com.liferay.portal.model.ResourcePermission;
import com.liferay.portal.model.User;
import com.liferay.portal.service.PortletLocalServiceUtil;
import com.liferay.portal.theme.PortletDisplay;
import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portlet.InvokerPortlet;
import com.liferay.portlet.PortletInstanceFactoryUtil;
Expand Down Expand Up @@ -2204,6 +2206,26 @@ public static boolean isSecure(HttpServletRequest request) {
return getPortal().isSecure(request);
}

public static boolean isSkipPortletContentProcesssing(
Group group, HttpServletRequest htpServletRequest,
LayoutTypePortlet layoutTypePortlet, PortletDisplay portletDisplay,
String portletName)
throws Exception {

return getPortal().isSkipPortletContentProcessing(
group, htpServletRequest, layoutTypePortlet, portletDisplay,
portletName);
}

public static boolean isSkipPortletContentRendering(
Group group, LayoutTypePortlet layoutTypePortlet,
PortletDisplay portletDisplay, String portletName)
throws PortalException {

return getPortal().isSkipPortletContentRendering(
group, layoutTypePortlet, portletDisplay, portletName);
}

public static boolean isSystemGroup(String groupName) {
return getPortal().isSystemGroup(groupName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</c:if>

<c:choose>
<c:when test="<%= group.isLayoutPrototype() && layoutTypePortlet.hasPortletId(portletDisplay.getId()) && !portletName.equals(PortletKeys.NESTED_PORTLETS) && portletDisplay.isModeView() %>">
<c:when test="<%= PortalUtil.isSkipPortletContentRendering(group, layoutTypePortlet, portletDisplay, portletName) %>">
<div class="alert alert-info">
<liferay-ui:message key="configure-this-application-and-place-it-where-desired-on-the-page" />
</div>
Expand Down
7 changes: 6 additions & 1 deletion portal-web/docroot/html/portal/render_portlet.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,14 @@ if ((invokerPortlet != null) && (invokerPortlet.isStrutsPortlet() || invokerPort
boolean portletException = GetterUtil.getBoolean(request.getAttribute(WebKeys.PARALLEL_RENDERING_TIMEOUT_ERROR));
Boolean portletVisibility = null;

boolean skipPortletProcessing = PortalUtil.isSkipPortletContentProcesssing(group, request, layoutTypePortlet, portletDisplay, portletDisplay.getPortletName());

if (portlet.isActive() && portlet.isReady() && supportsMimeType && (invokerPortlet != null)) {
try {
invokerPortlet.render(renderRequestImpl, renderResponseImpl);

if (!skipPortletProcessing) {
invokerPortlet.render(renderRequestImpl, renderResponseImpl);
}

portletVisibility = (Boolean)renderRequestImpl.getAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY);

Expand Down