// Increase header buffer size to allow long URLs (particularly for
// generic-host-page.html which puts the content into the URL).
// (The Server(int) constructor adds one connector internally.)
server.getConnectors()[0].setHeaderBufferSize(100 * 1024);
final ResourceHandler cajaStatic = new ResourceHandler();
cajaStatic.setResourceBase("./ant-war/");
// static file serving for tests
final ResourceHandler resource_handler = new ResourceHandler() {
@Override
protected void doResponseHeaders(HttpServletResponse response,
Resource resource, String mimeType) {
super.doResponseHeaders(response, resource, mimeType);
// If not disabled, IE and Chrome will refuse to execute script text
// which happens to occur in the URL (which applies to our
// generic-host-page for one).
response.setHeader("X-XSS-Protection", "0");
}
};
resource_handler.setResourceBase(".");
resource_handler.getMimeTypes().addMimeMapping(
"ujs", "text/javascript;charset=utf-8");
// caja (=playground for now) server under /caja directory
final String subdir = "/caja";
final ContextHandler caja = new ContextHandler(subdir);