]> source.dussan.org Git - vaadin-framework.git/commitdiff
Made it possible to override the type of wrapped request used in portals
authorArtur Signell <artur@vaadin.com>
Thu, 7 Jun 2012 11:44:54 +0000 (14:44 +0300)
committerLeif Åstrand <leif@vaadin.com>
Thu, 7 Jun 2012 11:44:54 +0000 (14:44 +0300)
Accidentally removed change restored by this commit.

src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java

index 1acc9d128a93d59e53133a5b7ba553ee2b9f9b01..5b2be308a34e0102a0ff197bd44a15984fb449b8 100644 (file)
@@ -67,7 +67,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
     private static final Logger logger = Logger
             .getLogger(AbstractApplicationPortlet.class.getName());
 
-    private static class WrappedHttpAndPortletRequest extends
+    public static class WrappedHttpAndPortletRequest extends
             WrappedPortletRequest {
 
         public WrappedHttpAndPortletRequest(PortletRequest request,
@@ -112,7 +112,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
         }
     }
 
-    private static class WrappedGateinRequest extends
+    public static class WrappedGateinRequest extends
             WrappedHttpAndPortletRequest {
         public WrappedGateinRequest(PortletRequest request,
                 DeploymentConfiguration deploymentConfiguration) {
@@ -134,7 +134,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
         }
     }
 
-    private static class WrappedLiferayRequest extends
+    public static class WrappedLiferayRequest extends
             WrappedHttpAndPortletRequest {
 
         public WrappedLiferayRequest(PortletRequest request,
@@ -169,7 +169,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
 
     }
 
-    private static class AbstractApplicationPortletWrapper implements Callback {
+    public static class AbstractApplicationPortletWrapper implements Callback {
 
         private final AbstractApplicationPortlet portlet;
 
@@ -500,20 +500,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
         AbstractApplicationPortletWrapper portletWrapper = new AbstractApplicationPortletWrapper(
                 this);
 
-        WrappedPortletRequest wrappedRequest;
-
-        String portalInfo = request.getPortalContext().getPortalInfo()
-                .toLowerCase();
-        if (portalInfo.contains("liferay")) {
-            wrappedRequest = new WrappedLiferayRequest(request,
-                    getDeploymentConfiguration());
-        } else if (portalInfo.contains("gatein")) {
-            wrappedRequest = new WrappedGateinRequest(request,
-                    getDeploymentConfiguration());
-        } else {
-            wrappedRequest = new WrappedPortletRequest(request,
-                    getDeploymentConfiguration());
-        }
+        WrappedPortletRequest wrappedRequest = createWrappedRequest(request);
 
         WrappedPortletResponse wrappedResponse = new WrappedPortletResponse(
                 response, getDeploymentConfiguration());
@@ -712,6 +699,30 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
         }
     }
 
+    /**
+     * Wraps the request in a (possibly portal specific) wrapped portlet
+     * request.
+     * 
+     * @param request
+     *            The original PortletRequest
+     * @return A wrapped version of the PorletRequest
+     */
+    protected WrappedPortletRequest createWrappedRequest(PortletRequest request) {
+        String portalInfo = request.getPortalContext().getPortalInfo()
+                .toLowerCase();
+        if (portalInfo.contains("liferay")) {
+            return new WrappedLiferayRequest(request,
+                    getDeploymentConfiguration());
+        } else if (portalInfo.contains("gatein")) {
+            return new WrappedGateinRequest(request,
+                    getDeploymentConfiguration());
+        } else {
+            return new WrappedPortletRequest(request,
+                    getDeploymentConfiguration());
+        }
+
+    }
+
     private DeploymentConfiguration getDeploymentConfiguration() {
         return deploymentConfiguration;
     }