incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r834016 - in /sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal: DefaultPortletWindowManager.java services/DefaultPortletInvokerService.java
Date Mon, 09 Nov 2009 11:00:30 GMT
Author: cziegeler
Date: Mon Nov  9 11:00:26 2009
New Revision: 834016

URL: http://svn.apache.org/viewvc?rev=834016&view=rev
Log:
Don't throw NPE if filter is not enabled, wrap request to get context dispatcher.

Modified:
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletInvokerService.java

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java?rev=834016&r1=834015&r2=834016&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
Mon Nov  9 11:00:26 2009
@@ -79,6 +79,10 @@
             return null;
         }
         final PortalRequestContext prc = PortalRequestContext.getContext();
+        if ( prc == null ) {
+            LOGGER.error("Portlet filter is not enabled.");
+            return null;
+        }
         final PortletMode portletMode = prc.getRequestedPortalURL().getPortletMode(windowId.getStringId());
         final WindowState windowState = prc.getRequestedPortalURL().getWindowState(windowId.getStringId());
         return new PortletWindowImpl(info,

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletInvokerService.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletInvokerService.java?rev=834016&r1=834015&r2=834016&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletInvokerService.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletInvokerService.java
Mon Nov  9 11:00:26 2009
@@ -34,6 +34,7 @@
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.pluto.container.FilterManager;
@@ -261,7 +262,7 @@
         request.removeAttribute(ATTR_PORTLET);
 
         // initialize
-        requestContext.init(portletConfig, portletContext.getServletContext(), request, response);
+        requestContext.init(portletConfig, portletContext.getServletContext(), new RequestWrapper(request,
portletContext.getServletContext()), response);
         responseContext.init(request, response);
 
         // The requested method is RENDER: call Portlet.render(..)
@@ -306,4 +307,19 @@
         }
         request.setAttribute(ATTR_PROCESSED, Boolean.TRUE);
     }
+
+    public static final class RequestWrapper extends HttpServletRequestWrapper {
+
+        private final ServletContext servletContext;
+
+        public RequestWrapper(HttpServletRequest request, final ServletContext sc) {
+            super(request);
+            this.servletContext = sc;
+        }
+
+        @Override
+        public RequestDispatcher getRequestDispatcher(String path) {
+            return this.servletContext.getRequestDispatcher(path);
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message