From 9c157ea073054ef613d72d2939dbd3802649636f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 11 Dec 2013 16:41:11 +0100 Subject: [PATCH] DispatcherPortlet never uses a resource forward on Liferay Issue: SPR-10791 --- .../springframework/web/portlet/DispatcherPortlet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java index d695077f4c6..844f1cfd3e4 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1187,7 +1187,11 @@ public class DispatcherPortlet extends FrameworkPortlet { protected void doDispatch(PortletRequestDispatcher dispatcher, PortletRequest request, MimeResponse response) throws Exception { - if (PortletRequest.RESOURCE_PHASE.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE))) { + // In general, we prefer a forward for resource responses, in order to have full Servlet API + // support in the target resource (e.g. on uPortal). However, on Liferay, a resource forward + // displays an empty page, so we have to resort to an include there... + if (PortletRequest.RESOURCE_PHASE.equals(request.getAttribute(PortletRequest.LIFECYCLE_PHASE)) && + !dispatcher.getClass().getName().startsWith("com.liferay")) { dispatcher.forward(request, response); } else {