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);
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.
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;
output += "</a>";
}
getService().writeStringResponse(response,
- "text/html; charset=UTF-8", output);
+ ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8, output);
}
}
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;
*/
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")));
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;
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);
*/
public static final String WIDGETSET_VERSION_ID = "wsver";
+ /**
+ * Content type to use for text/html responses (should always be UTF-8).
+ */
+ public static final String CONTENT_TYPE_TEXT_HTML_UTF_8 = "text/html; charset=utf-8";
+
}