]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added support for portlet requests.
authorPetter Holmström <petter.holmstrom@itmill.com>
Fri, 30 Oct 2009 07:10:18 +0000 (07:10 +0000)
committerPetter Holmström <petter.holmstrom@itmill.com>
Fri, 30 Oct 2009 07:10:18 +0000 (07:10 +0000)
svn changeset:9475/svn branch:portlet_2.0

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

index 67e8ac7f061d3eb01a28d5e29ba6b9fad218b812..f7bba2f3ec886621100ae30992d631b6d0ceb28a 100644 (file)
@@ -6,6 +6,7 @@ package com.vaadin.terminal.gwt.server;
 
 import java.util.Locale;
 
+import javax.portlet.PortletRequest;
 import javax.servlet.http.HttpServletRequest;
 
 import com.vaadin.terminal.Terminal;
@@ -76,8 +77,31 @@ public class WebBrowser implements Terminal {
         }
     }
 
+    void updateBrowserProperties(PortletRequest request) {
+        locale = request.getLocale();
+        address = null;
+        secureConnection = request.isSecure();
+
+        final String agent = request.getProperty("user-agent");
+        if (agent != null) {
+            browserApplication = agent;
+        }
+
+        final String sw = request.getParameter("sw");
+        if (sw != null) {
+            final String sh = request.getParameter("sh");
+            try {
+                screenHeight = Integer.parseInt(sh);
+                screenWidth = Integer.parseInt(sw);
+            } catch (final NumberFormatException e) {
+                screenHeight = screenWidth = 0;
+            }
+        }
+    }
+
     /**
-     * Get the IP-address of the web browser.
+     * Get the IP-address of the web browser. If the application is running
+     * inside a portlet, this method will return null.
      * 
      * @return IP-address in 1.12.123.123 -format
      */