本文整理汇总了Java中com.sun.jersey.api.container.filter.GZIPContentEncodingFilter类的典型用法代码示例。如果您正苦于以下问题:Java GZIPContentEncodingFilter类的具体用法?Java GZIPContentEncodingFilter怎么用?Java GZIPContentEncodingFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GZIPContentEncodingFilter类属于com.sun.jersey.api.container.filter包,在下文中一共展示了GZIPContentEncodingFilter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureWebAppServlets
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
protected void configureWebAppServlets() {
// Add in the web services filters/serves if app has them.
// Using Jersey/guice integration module. If user has web services
// they must have also bound a default one in their webapp code.
if (this.wsName != null) {
// There seems to be an issue with the guice/jersey integration
// where we have to list the stuff we don't want it to serve
// through the guicecontainer. In this case its everything except
// the the web services api prefix. We can't just change the filter
// from /* below - that doesn't work.
String regex = "(?!/" + this.wsName + ")";
serveRegex(regex).with(DefaultWrapperServlet.class);
Map<String, String> params = new HashMap<String, String>();
params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
params.put(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
filter("/*").through(getWebAppFilterClass(), params);
}
}
示例2: CCOWContextListener
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
public CCOWContextListener(final ContextState commonContext, final Module... behaviourModules) {
super();
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
logger.info("Starting up servlet ...");
this.modules = ImmutableList.<Module> builder().add(behaviourModules).add(new EndpointModule(commonContext))
.add(new JerseyServletModule() {
@Override
protected void configureServlets() {
final Map<String, String> params = ImmutableMap.<String, String> builder()
.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS,
GZIPContentEncodingFilter.class.getName())
.build();
bind(CORSFilter.class).in(Singleton.class);
bind(UrlRewriteFilter.class).in(Singleton.class);
serve("/*").with(GuiceContainer.class, params);
filter("/*").through(CORSFilter.class);
filter("/*").through(UrlRewriteFilter.class);
requestStaticInjection(WebSocketsConfigurator.class);
}
}).build();
}
示例3: configureServlets
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
@Override
public void configureServlets() {
setup();
serve("/", "/__stop").with(Dispatcher.class);
for (String path : this.getServePathSpecs()) {
serve(path).with(Dispatcher.class);
}
String regex = "(?!/ws)";
serveRegex(regex).with(SliderDefaultWrapperServlet.class);
Map<String, String> params = new HashMap<String, String>();
params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
params.put(ResourceConfig.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
//params.put("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
//params.put("com.sun.jersey.spi.container.ContainerResponseFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
//params.put("com.sun.jersey.config.feature.Trace", "true");
params.put("com.sun.jersey.config.property.WadlGeneratorConfig",
AMWadlGeneratorConfig.CLASSNAME);
filter("/*").through(GuiceContainer.class, params);
}
示例4: configureServlets
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
@Override
public void configureServlets() {
setup();
serve("/", "/__stop").with(Dispatcher.class);
for (String path : this.servePathSpecs) {
serve(path).with(Dispatcher.class);
}
// Add in the web services filters/serves if app has them.
// Using Jersey/guice integration module. If user has web services
// they must have also bound a default one in their webapp code.
if (this.wsName != null) {
// There seems to be an issue with the guice/jersey integration
// where we have to list the stuff we don't want it to serve
// through the guicecontainer. In this case its everything except
// the the web services api prefix. We can't just change the filter
// from /* below - that doesn't work.
String regex = "(?!/" + this.wsName + ")";
serveRegex(regex).with(DefaultWrapperServlet.class);
Map<String, String> params = new HashMap<String, String>();
params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
params.put(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
filter("/*").through(GuiceContainer.class, params);
}
}
示例5: configureServlets
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
@Override protected void configureServlets() {
bind(GuiceContainer.class);
bind(JacksonJsonProvider.class).toProvider(JacksonJsonProviderProvider.class).in(Scopes.SINGLETON);
List<String> responseFilters = Arrays.asList(
EncodingJerseyResponseFilter.class.getName(),
GZIPContentEncodingFilter.class.getName()
);
Map<String, String> params = ImmutableMap.of(
WebComponent.RESOURCE_CONFIG_CLASS, JerseyResourceConfig.class.getName(),
PackagesResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, Joiner.on(",").join(responseFilters)
);
serve("/Preferanser/*").with(GuiceContainer.class, params);
}
示例6: responseFilters
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
protected ImmutableList<Class<? extends ContainerResponseFilter>> responseFilters() {
return ImmutableList.of(CachingFilter.class,
PaginationFilter.class,
GZIPContentEncodingFilter.class);
}
示例7: requestFilters
import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter; //导入依赖的package包/类
protected ImmutableList<Class<? extends ContainerRequestFilter>> requestFilters() {
return ImmutableList.of(GZIPContentEncodingFilter.class,
URIContentNegotiationFilter.class,
AuthenticationFilter.class);
}