diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-03-26 13:53:47 +0200 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-03-26 13:53:47 +0200 |
commit | 55a1b204f5f9f3847443bf7ba967e09e0e63ff6b (patch) | |
tree | c84c26f3d8f14a00dcfb2a13ceb748386cd8c823 | |
parent | 437f4e9c2478750e53ef3c6bff03bdd25e547432 (diff) | |
download | vaadin-framework-55a1b204f5f9f3847443bf7ba967e09e0e63ff6b.tar.gz vaadin-framework-55a1b204f5f9f3847443bf7ba967e09e0e63ff6b.zip |
Added headers support for WebSphere Portal. (#13491)7.1.13
Change-Id: Ib5396f8e5c28232d560406542530c034ab1f657d
-rw-r--r-- | server/src/com/vaadin/server/VaadinPortlet.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 093a1c9152..953408ae0b 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -159,6 +159,31 @@ public class VaadinPortlet extends GenericPortlet implements Constants, } } + // Intentionally internal, will be refactored out in 7.2. + static class WebSpherePortalRequest extends VaadinHttpAndPortletRequest { + + public WebSpherePortalRequest(PortletRequest request, + VaadinPortletService vaadinService) { + super(request, getServletRequest(request), vaadinService); + } + + private static HttpServletRequest getServletRequest( + PortletRequest request) { + try { + Class<?> portletUtils = Class + .forName("com.ibm.ws.portletcontainer.portlet.PortletUtils"); + Method getHttpServletRequest = portletUtils.getMethod( + "getHttpServletRequest", PortletRequest.class); + + return (HttpServletRequest) getHttpServletRequest.invoke(null, + request); + } catch (Exception e) { + throw new IllegalStateException( + "WebSphere Portal request not detected."); + } + } + } + public static class VaadinLiferayRequest extends VaadinHttpAndPortletRequest { @@ -426,7 +451,10 @@ public class VaadinPortlet extends GenericPortlet implements Constants, return new VaadinLiferayRequest(request, getService()); } else if (isGateIn(request)) { return new VaadinGateinRequest(request, getService()); + } else if (isWebSphere(request)) { + return new WebSpherePortalRequest(request, getService()); } else { + return new VaadinPortletRequest(request, getService()); } } @@ -455,6 +483,13 @@ public class VaadinPortlet extends GenericPortlet implements Constants, return portalInfo.contains("gatein"); } + private static boolean isWebSphere(PortletRequest request) { + String portalInfo = request.getPortalContext().getPortalInfo() + .toLowerCase(); + + return portalInfo.contains("websphere portal"); + } + private VaadinPortletResponse createVaadinResponse(PortletResponse response) { return new VaadinPortletResponse(response, getService()); } |