summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2011-01-19 08:15:23 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2011-01-19 08:15:23 +0000
commit6c0ff7452815dcc2efab394099ca36c3f26e68c9 (patch)
tree42d882618bd9d9d8e7ba679bd3760f9e936732bb
parent23260c35e007fa501ceb3cf87d8d09782d7516ae (diff)
downloadvaadin-framework-6c0ff7452815dcc2efab394099ca36c3f26e68c9.tar.gz
vaadin-framework-6c0ff7452815dcc2efab394099ca36c3f26e68c9.zip
opening the server side for customized communication ( e.g. jsonp)
svn changeset:16945/svn branch:6.5
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index d30c0920f3..068cf2e1fa 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -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(;;);[{");
}