]> source.dussan.org Git - vaadin-framework.git/commitdiff
opening the server side for customized communication ( e.g. jsonp)
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 19 Jan 2011 08:15:23 +0000 (08:15 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 19 Jan 2011 08:15:23 +0000 (08:15 +0000)
svn changeset:16945/svn branch:6.5

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

index d30c0920f3e858cb50cbce9e02733e6585b4a454..068cf2e1fa4830479344cad20ec754b01b0972ff 100644 (file)
@@ -788,10 +788,7 @@ public abstract class AbstractCommunicationManager implements
             return;
         }
 
-        // Sets the response type
-        response.setContentType("application/json; charset=UTF-8");
-        // some dirt to prevent cross site scripting
-        openJsonMessage(outWriter);
+        openJsonMessage(outWriter, response);
 
         // security key
         Object writeSecurityTokenFlag = request
@@ -1786,10 +1783,9 @@ public abstract class AbstractCommunicationManager implements
         // client that application has quit and where to point browser now
         // Set the response type
         final OutputStream out = response.getOutputStream();
-        response.setContentType("application/json; charset=UTF-8");
         final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
                 new OutputStreamWriter(out, "UTF-8")));
-        openJsonMessage(outWriter);
+        openJsonMessage(outWriter, response);
         outWriter.print("\"redirect\":{");
         outWriter.write("\"url\":\"" + logoutUrl + "\"}");
         closeJsonMessage(outWriter);
@@ -1806,8 +1802,12 @@ public abstract class AbstractCommunicationManager implements
      * Writes the opening of JSON message to be sent to client.
      * 
      * @param outWriter
+     * @param response
      */
-    protected void openJsonMessage(PrintWriter outWriter) {
+    protected void openJsonMessage(PrintWriter outWriter, Response response) {
+        // Sets the response type
+        response.setContentType("application/json; charset=UTF-8");
+        // some dirt to prevent cross site scripting
         outWriter.print("for(;;);[{");
     }