]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed GateIn portal support and action request problem (#8670)
authorArtur Signell <artur@vaadin.com>
Thu, 19 Apr 2012 13:30:18 +0000 (16:30 +0300)
committerArtur Signell <artur@vaadin.com>
Thu, 19 Apr 2012 19:10:35 +0000 (22:10 +0300)
src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java
tests/integration-testscripts/GateIn-3/integration-test-GateIn-3.1.0-portlet2.html

index 8235859758a5a384d686cc2343352c14f4c51cfb..0d670863399f83bf960819b43b2dce57c2d563ae 100644 (file)
@@ -610,6 +610,10 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
                     if (application.isRunning()) {
                         switch (requestType) {
                         case RENDER:
+                        case ACTION:
+                            // Both action requests and render requests are ok
+                            // without a Root as they render the initial HTML
+                            // and then do a second request
                             try {
                                 root = application
                                         .getRootForRequest(wrappedRequest);
index 56e99450d268033964cada5bc8a237ccdbdc8635..e772aec6cc24b3a86b5b74cd435b94966e57623a 100644 (file)
@@ -2118,7 +2118,18 @@ public abstract class AbstractCommunicationManager implements Serializable {
                 String initialUIDL = getInitialUIDL(combinedRequest, root);
                 params.put("uidl", initialUIDL);
             }
-            response.getWriter().write(params.toString());
+
+            // NOTE! GateIn requires, for some weird reason, getOutputStream
+            // to be used instead of getWriter() (it seems to interpret
+            // application/json as a binary content type)
+            final OutputStream out = response.getOutputStream();
+            final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+                    new OutputStreamWriter(out, "UTF-8")));
+
+            outWriter.write(params.toString());
+            // NOTE GateIn requires the buffers to be flushed to work
+            outWriter.flush();
+            out.flush();
         } catch (RootRequiresMoreInformationException e) {
             // Requiring more information at this point is not allowed
             // TODO handle in a better way
index 2c9828b66b67ebc5e92305c7da107c2295d45d71..3838695aa33cd69f91c5ae0be99a97adf5f5a27a 100644 (file)
@@ -13,6 +13,7 @@ import javax.portlet.ClientDataRequest;
 import javax.portlet.PortletRequest;
 import javax.portlet.ResourceRequest;
 
+import com.vaadin.Application;
 import com.vaadin.terminal.CombinedRequest;
 import com.vaadin.terminal.DeploymentConfiguration;
 import com.vaadin.terminal.WrappedRequest;
@@ -118,8 +119,21 @@ public class WrappedPortletRequest implements WrappedRequest {
     }
 
     public BrowserDetails getBrowserDetails() {
-        // No browserDetails available for normal requests
-        return null;
+        return new BrowserDetails() {
+            public String getUriFragment() {
+                return null;
+            }
+
+            public String getWindowName() {
+                return null;
+            }
+
+            public WebBrowser getWebBrowser() {
+                PortletApplicationContext2 context = (PortletApplicationContext2) Application
+                        .getCurrentApplication().getContext();
+                return context.getBrowser();
+            }
+        };
     }
 
     public Locale getLocale() {
index d97a9dce4a06811bf49c5422e9bd9a6cb722d6f4..85258d7036213fd1f9c688c9226ff56039a27610 100644 (file)
 </tr>
 <tr>
        <td>mouseClickAndWait</td>
-       <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div/div[5]/div/div/a</td>
+       <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td>
        <td>10,10</td>
 </tr>
 <tr>
 </tr>
 <tr>
        <td>mouseClickAndWait</td>
-       <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div/div[5]/div/div/a</td>
+       <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td>
        <td>15,8</td>
 </tr>
 <tr>