本文整理汇总了Java中org.apache.hadoop.hbase.rest.filter.GzipFilter类的典型用法代码示例。如果您正苦于以下问题:Java GzipFilter类的具体用法?Java GzipFilter怎么用?Java GzipFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GzipFilter类属于org.apache.hadoop.hbase.rest.filter包,在下文中一共展示了GzipFilter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServletContainer
import org.apache.hadoop.hbase.rest.filter.GzipFilter; //导入依赖的package包/类
public void startServletContainer(Configuration conf) throws Exception {
if (server != null) {
LOG.error("ServletContainer already running");
return;
}
// Inject the conf for the test by being first to make singleton
RESTServlet.getInstance(conf);
// set up the Jersey servlet container for Jetty
ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter(
"com.sun.jersey.config.property.resourceConfigClass",
ResourceConfig.class.getCanonicalName());
sh.setInitParameter("com.sun.jersey.config.property.packages",
"jetty");
LOG.info("configured " + ServletContainer.class.getName());
// set up Jetty and run the embedded server
server = new Server(0);
server.setSendServerVersion(false);
server.setSendDateHeader(false);
// set up context
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(sh, "/*");
context.addFilter(GzipFilter.class, "/*", 0);
// start the server
server.start();
// get the port
testServletPort = server.getConnectors()[0].getLocalPort();
LOG.info("started " + server.getClass().getName() + " on port " +
testServletPort);
}