diff options
author | Artur Signell <artur@vaadin.com> | 2012-05-22 16:03:50 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-05-22 16:07:03 +0300 |
commit | e1d2b8f1797e9e373161cfc7658b1e5386f98125 (patch) | |
tree | 92c2fc757d3daf91f4af458a322701ba89722d79 | |
parent | 2ad73a7b9aedd38b14b0e40195e557dc4b097edd (diff) | |
download | vaadin-framework-e1d2b8f1797e9e373161cfc7658b1e5386f98125.tar.gz vaadin-framework-e1d2b8f1797e9e373161cfc7658b1e5386f98125.zip |
Made it possible to override the type of wrapped request used in portals
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java | 47 |
1 files changed, 29 insertions, 18 deletions
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; } |