Skip to content

Commit

Permalink
PLUTO-781 PortletRequestDispatcherImpl forwards to incorrect path
Browse files Browse the repository at this point in the history
  • Loading branch information
ngriffin7a committed Dec 16, 2021
1 parent b06210f commit 391a6a3
Showing 1 changed file with 16 additions and 3 deletions.
Expand Up @@ -31,6 +31,7 @@

import javax.portlet.ClientDataRequest;
import javax.portlet.HeaderRequest;
import javax.portlet.PortalContext;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletRequest;
Expand All @@ -51,7 +52,9 @@
import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;

import org.apache.pluto.container.ContainerServices;
import org.apache.pluto.container.NamespaceMapper;
import org.apache.pluto.container.PortletContainer;
import org.apache.pluto.container.PortletInvokerService;
import org.apache.pluto.container.PortletRequestContext;
import org.apache.pluto.container.PortletResourceRequestContext;
Expand Down Expand Up @@ -79,6 +82,8 @@ public class HttpServletPortletRequestWrapper extends HttpServletRequestWrapper
private static final boolean isDebug = LOG.isDebugEnabled();
private static final boolean isTrace = LOG.isTraceEnabled();

private static final String ENABLE_NESTED_RESOURCE_FORWARDS = "org.apache.pluto.enable.nested.resource.forwards";

private static final String FORWARD_CONTEXT_PATH = "javax.servlet.forward.context_path";
private static final String FORWARD_PATH_INFO = "javax.servlet.forward.path_info";
private static final String FORWARD_QUERY_STRING = "javax.servlet.forward.query_string";
Expand Down Expand Up @@ -378,9 +383,17 @@ public void startForward(String path) {
isMethSpecialHandling = true;

// PLUTO-781
PortletConfig portletConfig = reqctx.getPortletConfig();
String initParameter = portletConfig.getInitParameter("org.apache.pluto.enable.nested.resource.forwards");
if ("true".equalsIgnoreCase(initParameter)) {
PortletContainer portletContainer = reqctx.getContainer();
ContainerServices containerServices = portletContainer.getContainerServices();
PortalContext portalContext = containerServices.getPortalContext();
boolean enableNestedResourceForwards = Boolean.valueOf(portalContext.getProperty(ENABLE_NESTED_RESOURCE_FORWARDS));

if (!enableNestedResourceForwards) {
PortletConfig portletConfig = reqctx.getPortletConfig();
enableNestedResourceForwards = Boolean.valueOf(portletConfig.getInitParameter(ENABLE_NESTED_RESOURCE_FORWARDS));
}

if (enableNestedResourceForwards) {
// Note: When isMethSpecialHandling is false, it causes failures
// in the following Portlet 3.0 TCK tests:
// V2DispatcherTests5_SPEC2_19_IncThenForwardServletResource_invoke7
Expand Down

0 comments on commit 391a6a3

Please sign in to comment.