本文整理汇总了Java中org.glassfish.jersey.server.filter.EncodingFilter类的典型用法代码示例。如果您正苦于以下问题:Java EncodingFilter类的具体用法?Java EncodingFilter怎么用?Java EncodingFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EncodingFilter类属于org.glassfish.jersey.server.filter包,在下文中一共展示了EncodingFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJerseyTest
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
private JerseyTest createJerseyTest(Boolean binaryCompressionOnly) {
return new JerseyTest() {
@Override
protected Application configure() {
ResourceConfig config = new ResourceConfig();
config.register(TestResource.class);
config.register(EncodingFilter.class);
config.register(GZipEncoder.class);
config.register(GatewayBinaryResponseFilter.class);
if (binaryCompressionOnly != null) {
config.property(GatewayBinaryResponseFilter.BINARY_COMPRESSION_ONLY_PROPERTY,
binaryCompressionOnly);
}
return config;
}
};
}
示例2: Main
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
private Main() {
packages("us.askplatyp.kb.lucene.http");
register(JacksonFeature.class);
register(EntityFilteringFeature.class);
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(WikidataLuceneIndexFactory.class).to(LuceneIndex.class);
}
});
register(CORSFilter.class);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
EncodingFilter.enableFor(this, DeflateEncoder.class);
configureSwagger();
}
示例3: RackApiApplicationConfig
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
/**
* コンストラクタです。
*/
public RackApiApplicationConfig() {
packages(RackApiScanPackage.class.getPackage().getName());
packages(ConnectorScanPackage.class.getPackage().getName());
packages(SpringLifecycleListener.class.getPackage().getName());
property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, true);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
register(ValidationConfigurationContextResolver.class);
register(JacksonFeature.class);
register(LoggingFilter.class);
register(LocaleContextFilter.class);
register(EncodingFilter.class);
register(GZipEncoder.class);
registerClasses(JerseyConfigs.getExcpetionMappers());
}
示例4: RestResourceConfig
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
public RestResourceConfig() {
log.info("-----------------------------loading JERSEY2 restful---------------------------");
packages("com.framework.rest.service");
register(RestAuthRequestFilter.class);
register(RestResponseFilter.class);
register(LoggingFilter.class);
register(JacksonFeature.class);
register(DeflateEncoder.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
}
示例5: JerseyConfig
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
public JerseyConfig() {
log.info("Registering classes");
register(AppConfiguration.class);
packages("com.pokebattler.fight.data");
packages("com.pokebattler.fight.resources");
register(ProtobufJsonProvider.class);
register(ProtobufBinaryProvider.class);
// need to be in order
register(ETagResponseFilter.class);
register(CORSResponseFilter.class);
register(CacheControlResponseFilter.class);
register(EntityFilteringFeature.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
}
示例6: configure
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
@Override
protected Application configure() {
return new ResourceConfig(MockServer.class)
.register(RolesAllowedDynamicFeature.class)
.register(new MockSecurityFilter(), Priorities.AUTHENTICATION)
.register(JerseyClient.createMoxyJsonResolver())
.register(GZipEncoder.class)
.register(EncodingFilter.class);
}
示例7: createAndStartHandler
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
private GatewayRequestObjectHandlerImpl createAndStartHandler(ResourceConfig config, TestService testService) {
config.register(GatewayFeature.class);
Binder binder = new InstanceBinder.Builder().addInstance(testService, TestService.class).build();
config.register(binder);
config.register(TestResource.class);
config.register(EncodingFilter.class);
config.register(GZipEncoder.class);
config.register(SomeCheckedAppExceptionMapper.class);
config.register(SomeUncheckedAppExceptionMapper.class);
config.register(GlobalExceptionMapper.class);
GatewayRequestObjectHandlerImpl handler = new GatewayRequestObjectHandlerImpl();
handler.init(config);
handler.start();
return handler;
}
示例8: RequestHandler
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
public RequestHandler() {
// configure the application with the resource
init(new ResourceConfig()
.register(GatewayFeature.class)
.register(MultiPartFeature.class)
.register(EncodingFilter.class)
.register(GZipEncoder.class)
.packages("com.jrestless.aws.examples"));
start();
}
示例9: registerStuff
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
protected static void registerStuff(ResourceConfig rConfig) {
rConfig.register(AccessOriginFilter.class);
/*
* rConfig.register(ErrorMapper.class);
* rConfig.register(PreFilter.class);
* rConfig.register(PostFilter.class);
*/
rConfig.register(GenericExceptionMapper.class);
rConfig.register(org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainerProvider.class);
EncodingFilter.enableFor(rConfig, GZipEncoder.class);
rConfig.register(JsonIteratorConverter.class);
}
示例10: createHttpServer
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
private HttpServer createHttpServer()
throws IOException, IllegalArgumentException, UriBuilderException, URISyntaxException {
ResourceConfig resourceConfig = new ResourceConfig()
.packages(true, Configuration.instance().getStrings("APP.Jersey.Resources").toArray(new String[0]))
.register(FrontendFeature.class);
EncodingFilter.enableFor(resourceConfig, GZipEncoder.class);
return GrizzlyHttpServerFactory.createHttpServer(getURI(), resourceConfig, false);
}
示例11: RestDemoJaxRsApplication
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
/**
* Register JAX-RS application components.
*/
public RestDemoJaxRsApplication() {
packages("org.codingpedia.demo.rest");
// // register application resources
// register(PodcastsResource.class);
// register(PodcastLegacyResource.class);
//
// // register filters
// register(RequestContextFilter.class);
// register(LoggingResponseFilter.class);
// register(CORSResponseFilter.class);
//
// // register exception mappers
// register(GenericExceptionMapper.class);
// register(AppExceptionMapper.class);
// register(CustomReasonPhraseExceptionMapper.class);
// register(NotFoundExceptionMapper.class);
//
// // register features
// register(JacksonFeature.class);
register(EntityFilteringFeature.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
// property(EntityFilteringFeature.ENTITY_FILTERING_SCOPE, new Annotation[] {PodcastDetailedView.Factory.get()});
}
示例12: deploy
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
@Override
public void deploy(WebAppContext context) {
context.addFilter(new FilterHolder(maintenanceModeFilter), "/whois/*", EnumSet.allOf(DispatcherType.class));
final ResourceConfig resourceConfig = new ResourceConfig();
EncodingFilter.enableFor(resourceConfig, GZipEncoder.class);
EncodingFilter.enableFor(resourceConfig, DeflateEncoder.class);
resourceConfig.register(MultiPartFeature.class);
resourceConfig.register(whoisRestService);
resourceConfig.register(whoisSearchService);
resourceConfig.register(whoisVersionService);
resourceConfig.register(syncUpdatesService);
resourceConfig.register(asnTransfersRestService);
resourceConfig.register(inetnumTransfersRestService);
resourceConfig.register(whoisMetadata);
resourceConfig.register(geolocationService);
resourceConfig.register(abuseContactService);
resourceConfig.register(autocompleteService);
resourceConfig.register(referencesService);
resourceConfig.register(defaultExceptionMapper);
resourceConfig.register(domainObjectService);
resourceConfig.register(fullTextSearch);
resourceConfig.register(batchUpdatesService);
resourceConfig.register(new CacheControlFilter());
final JacksonJaxbJsonProvider jaxbJsonProvider = new JacksonJaxbJsonProvider();
jaxbJsonProvider.configure(SerializationFeature.INDENT_OUTPUT, true);
jaxbJsonProvider.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
resourceConfig.register(jaxbJsonProvider);
// only allow cross-origin requests from ripe.net
final FilterHolder crossOriginFilterHolder = context.addFilter(org.eclipse.jetty.servlets.CrossOriginFilter.class, "/whois/*", EnumSet.allOf(DispatcherType.class));
crossOriginFilterHolder.setInitParameter(org.eclipse.jetty.servlets.CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "https?://*.ripe.net");
context.addServlet(new ServletHolder("Whois REST API", new ServletContainer(resourceConfig)), "/whois/*");
}
示例13: MockWebApplication
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
public MockWebApplication(boolean operational, long timeout) {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(EncodingFilter.class);
classes.add(GZipEncoder.class);
classes.add(ClientEncodingAssertingFilter.class);
this.classes = Collections.unmodifiableSet(classes);
Set<Object> singletons = new HashSet<Object>();
singletons.add(new MockWebService(operational, timeout));
this.singletons = Collections.unmodifiableSet(singletons);
}
示例14: WebConverterApplication
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
public WebConverterApplication(IWebConverterConfiguration webConverterConfiguration) {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(ConverterResource.class);
classes.add(EncodingFilter.class);
classes.add(GZipEncoder.class);
this.classes = Collections.unmodifiableSet(classes);
Set<Object> singletons = new HashSet<Object>();
singletons.add(new WebConverterConfigurationBinder(webConverterConfiguration));
this.singletons = Collections.unmodifiableSet(singletons);
}
示例15: enableContentEncodingGzip
import org.glassfish.jersey.server.filter.EncodingFilter; //导入依赖的package包/类
private void enableContentEncodingGzip(Environment environment) {
EncodingFilter.enableFor(environment.jersey().getResourceConfig(), GZipEncoder.class);
}