From: Artur Signell Date: Thu, 7 Jun 2012 11:44:54 +0000 (+0300) Subject: Made it possible to override the type of wrapped request used in portals X-Git-Tag: 7.0.0.alpha3~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac9c7f065645874a6cf7f78bfb7068703b171418;p=vaadin-framework.git Made it possible to override the type of wrapped request used in portals Accidentally removed change restored by this commit. --- diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index 1acc9d128a..5b2be308a3 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -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; }