diff options
author | John Ahlroos <john@vaadin.com> | 2013-09-23 16:51:42 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-09-27 10:33:10 +0000 |
commit | a5795f346e077268eb77edef09d902fba57d5804 (patch) | |
tree | c33ff81d236ff3fce1c0f2c93b61a58dda9be917 /server/src | |
parent | 649735f755c51e5c11d5ebe984e7a308fe97552a (diff) | |
download | vaadin-framework-a5795f346e077268eb77edef09d902fba57d5804.tar.gz vaadin-framework-a5795f346e077268eb77edef09d902fba57d5804.zip |
Prefixes GET parameters in Liferay with portlet namespace #12602
Change-Id: I9939a7af83482e136ed0d146accdeec0cd9f10ea
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/server/VaadinPortlet.java | 29 | ||||
-rw-r--r-- | server/src/com/vaadin/server/communication/PortletBootstrapHandler.java | 11 |
2 files changed, 36 insertions, 4 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index d86e5e6507..093a1c9152 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -422,16 +422,37 @@ public class VaadinPortlet extends GenericPortlet implements Constants, * @return A wrapped version of the PorletRequest */ protected VaadinPortletRequest createVaadinRequest(PortletRequest request) { - String portalInfo = request.getPortalContext().getPortalInfo() - .toLowerCase(); - if (portalInfo.contains("liferay")) { + if (isLiferay(request)) { return new VaadinLiferayRequest(request, getService()); - } else if (portalInfo.contains("gatein")) { + } else if (isGateIn(request)) { return new VaadinGateinRequest(request, getService()); } else { return new VaadinPortletRequest(request, getService()); } + } + /** + * Returns true if the portlet request is from Liferay. + * + * @param request + * @return True if Liferay, false otherwise + */ + private static boolean isLiferay(PortletRequest request) { + String portalInfo = request.getPortalContext().getPortalInfo() + .toLowerCase(); + return portalInfo.contains("liferay"); + } + + /** + * Returns true if the portlet request if from GateIn + * + * @param request + * @return True if GateIn, false otherwise + */ + private static boolean isGateIn(PortletRequest request) { + String portalInfo = request.getPortalContext().getPortalInfo() + .toLowerCase(); + return portalInfo.contains("gatein"); } private VaadinPortletResponse createVaadinResponse(PortletResponse response) { diff --git a/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java b/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java index 2458951ada..dd6d3c9283 100644 --- a/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java +++ b/server/src/com/vaadin/server/communication/PortletBootstrapHandler.java @@ -31,6 +31,7 @@ import org.json.JSONObject; import com.vaadin.server.BootstrapHandler; import com.vaadin.server.PaintException; import com.vaadin.server.VaadinPortlet; +import com.vaadin.server.VaadinPortlet.VaadinLiferayRequest; import com.vaadin.server.VaadinPortletRequest; import com.vaadin.server.VaadinPortletResponse; import com.vaadin.server.VaadinRequest; @@ -98,6 +99,8 @@ public class PortletBootstrapHandler extends BootstrapHandler { JSONObject parameters = super.getApplicationParameters(context); VaadinPortletResponse response = (VaadinPortletResponse) context .getResponse(); + VaadinPortletRequest request = (VaadinPortletRequest) context + .getRequest(); MimeResponse portletResponse = (MimeResponse) response .getPortletResponse(); ResourceURL resourceURL = portletResponse.createResourceURL(); @@ -108,6 +111,14 @@ public class PortletBootstrapHandler extends BootstrapHandler { parameters .put(ApplicationConstants.SERVICE_URL_PATH_AS_PARAMETER, true); + // If we are running in Liferay then we need to prefix all parameters + // with the portlet namespace + if (request instanceof VaadinLiferayRequest) { + parameters.put( + ApplicationConstants.SERVICE_URL_PARAMETER_NAMESPACE, + response.getPortletResponse().getNamespace()); + } + return parameters; } }
\ No newline at end of file |