3
你好我使用碼頭9與guice和澤西島。如何使用GZIP?碼頭GZIP過濾器
Server server = new Server(8080);
ServletContextHandler handler = new ServletContextHandler();
handler.addFilter(GuiceFilter.class, "/*", EnumSet.allOf(DispatcherType.class));
handler.addFilter(CORSFilter.class, "/*", EnumSet.allOf(DispatcherType.class));
FilterHolder holder = new FilterHolder(GzipFilter.class);
holder.setInitParameter("deflateCompressionLevel", "9");
holder.setInitParameter("minGzipSize", "0");
holder.setInitParameter("mimeTypes", "application/json");
handler.addFilter(holder, "/*", EnumSet.of(DispatcherType.REQUEST));
handler.addEventListener(new GuiceServletConfig());
server.setHandler(handler);
server.start();
server.join();
趁我請求調試不叫
我不知道,但不應將過濾器吉斯進行配置呢? – Opal