summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-03-09 14:50:46 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-09 14:50:46 +0200
commit776b54648a44a9d996b362ce71816d1187a84a79 (patch)
tree2c88439cc15fef916358cec5a18d4eac7c6c39ff /server
parent520f2e9f21367799f000911159f2ea5d9bf9e0f2 (diff)
downloadvaadin-framework-776b54648a44a9d996b362ce71816d1187a84a79.tar.gz
vaadin-framework-776b54648a44a9d996b362ce71816d1187a84a79.zip
Include charset in text/html responses (#8777)
Fixes #8775
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/server/BootstrapHandler.java7
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinServlet.java3
-rw-r--r--server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/LoginForm.java3
4 files changed, 11 insertions, 6 deletions
diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java
index 74707842d8..4619a89ce8 100644
--- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java
@@ -352,7 +352,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
private void writeBootstrapPage(VaadinResponse response, String html)
throws IOException {
- response.setContentType("text/html");
+ response.setContentType(
+ ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8);
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(response.getOutputStream(), "UTF-8"));
writer.append(html);
@@ -372,8 +373,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
document.child(0).before(doctype);
Element head = document.head();
- head.appendElement("meta").attr("http-equiv", "Content-Type")
- .attr("content", "text/html; charset=utf-8");
+ head.appendElement("meta").attr("http-equiv", "Content-Type").attr(
+ "content", ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8);
/*
* Enable Chrome Frame in all versions of IE if installed.
diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java
index 3dfb5ba33c..f02ef444b9 100644
--- a/server/src/main/java/com/vaadin/server/VaadinServlet.java
+++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java
@@ -55,6 +55,7 @@ import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.annotations.VaadinServletConfiguration.InitParameterName;
import com.vaadin.sass.internal.ScssStylesheet;
import com.vaadin.server.communication.ServletUIInitHandler;
+import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.JsonConstants;
import com.vaadin.shared.Version;
import com.vaadin.ui.UI;
@@ -587,7 +588,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
output += "</a>";
}
getService().writeStringResponse(response,
- "text/html; charset=UTF-8", output);
+ ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8, output);
}
}
diff --git a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java
index f205e28b7d..6a19680da0 100644
--- a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java
@@ -36,6 +36,7 @@ import com.vaadin.server.UploadException;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
import com.vaadin.server.VaadinSession;
+import com.vaadin.shared.ApplicationConstants;
import com.vaadin.ui.Component;
import com.vaadin.ui.UI;
import com.vaadin.ui.Upload.FailedEvent;
@@ -682,7 +683,8 @@ public class FileUploadHandler implements RequestHandler {
*/
protected void sendUploadResponse(VaadinRequest request,
VaadinResponse response) throws IOException {
- response.setContentType("text/html");
+ response.setContentType(
+ ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8);
final OutputStream out = response.getOutputStream();
final PrintWriter outWriter = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(out, "UTF-8")));
diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java
index 89244004db..1a037ddfc8 100644
--- a/server/src/main/java/com/vaadin/ui/LoginForm.java
+++ b/server/src/main/java/com/vaadin/ui/LoginForm.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import com.vaadin.server.StreamResource;
+import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.ui.loginform.LoginFormConstants;
import com.vaadin.shared.ui.loginform.LoginFormRpc;
import com.vaadin.shared.ui.loginform.LoginFormState;
@@ -309,7 +310,7 @@ public class LoginForm extends AbstractSingleComponentContainer {
StreamResource resource = new StreamResource(new LoginStreamSource(),
LoginFormConstants.LOGIN_RESOURCE_NAME);
- resource.setMIMEType("text/html; charset=utf-8");
+ resource.setMIMEType(ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8);
resource.setCacheTime(-1);
setResource(LoginFormConstants.LOGIN_RESOURCE_NAME, resource);