summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-04-23 14:12:14 +0300
committerVaadin Code Review <review@vaadin.com>2015-04-24 06:58:44 +0000
commit7572ef713e218f29ca316652f13cf6eef88d1c0b (patch)
treec125f4baba849d6778801a49352954dfb3adb23a /server
parentefc3617cf50d4e190db3c3891aed01b30b322120 (diff)
downloadvaadin-framework-7572ef713e218f29ca316652f13cf6eef88d1c0b.tar.gz
vaadin-framework-7572ef713e218f29ca316652f13cf6eef88d1c0b.zip
Always include content-type in JSON XHR response (#17608)
Change-Id: I0be5315dd514f99d69b1dc511a45acc5e7c288ca
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/communication/UidlRequestHandler.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
index d28107e8f8..6e338c5773 100644
--- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java
+++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
@@ -36,6 +36,7 @@ import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.JsonConstants;
import com.vaadin.shared.Version;
import com.vaadin.ui.UI;
+
import elemental.json.JsonException;
/**
@@ -70,7 +71,7 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
if (uI == null) {
// This should not happen but it will if the UI has been closed. We
// really don't want to see it in the server logs though
- response.getWriter().write(
+ UIInitHandler.commitJsonResponse(request, response,
getUINotFoundErrorJSON(session.getService(), request));
return true;
}
@@ -99,18 +100,14 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
} catch (JsonException e) {
getLogger().log(Level.SEVERE, "Error writing JSON to response", e);
// Refresh on client side
- response.getWriter().write(
- VaadinService.createCriticalNotificationJSON(null, null,
- null, null));
+ writeRefresh(request, response);
return true;
} catch (InvalidUIDLSecurityKeyException e) {
getLogger().log(Level.WARNING,
"Invalid security key received from {0}",
request.getRemoteHost());
// Refresh on client side
- response.getWriter().write(
- VaadinService.createCriticalNotificationJSON(null, null,
- null, null));
+ writeRefresh(request, response);
return true;
} finally {
stringWriter.close();
@@ -142,6 +139,13 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
}
}
+ private void writeRefresh(VaadinRequest request, VaadinResponse response)
+ throws IOException {
+ String json = VaadinService.createCriticalNotificationJSON(null, null,
+ null, null);
+ UIInitHandler.commitJsonResponse(request, response, json);
+ }
+
private void writeUidl(VaadinRequest request, VaadinResponse response,
UI ui, Writer writer, boolean repaintAll) throws IOException {
openJsonMessage(writer, response);