Java 类org.glassfish.jersey.server.filter.UriConnegFilter 实例源码

项目:SciGraph    文件:MainApplication.java   
@Override
public void run(ApplicationConfiguration configuration, Environment environment) throws Exception {
  environment.jersey().register(new UriConnegFilter(new MediaTypeMappings(), Collections.<String, String>emptyMap()));
  Map<String, Object> props = new HashMap<>();
  props.put(MessageProperties.LEGACY_WORKERS_ORDERING, true);
  environment.jersey().getResourceConfig().addProperties(props);
  addWriters(environment.jersey());
  configureCors(environment);

  //TODO: This path should not be hard coded.
  configureSwagger(environment, "scigraph");
  environment.servlets().
          addFilter("Swagger Filter", factory.getInjector().getInstance(SwaggerFilter.class))
  .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/swagger.json", "/swagger");

  environment.servlets().addFilter("swaggerDocResolver", new SwaggerDocUrlFilter())
  .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*");

  DynamicCypherResourceFactory cypherFactory = factory.getInjector().getInstance(DynamicCypherResourceFactory.class);
  for (Map.Entry<String,Path> config: configuration.getCypherResources().entrySet()) {
    environment.jersey().getResourceConfig().registerResources(cypherFactory.create(config.getKey(), config.getValue()).getBuilder().build());
  }
}
项目:ameba    文件:SysFilteringFeature.java   
/**
 * {@inheritDoc}
 */
@Override
public boolean configure(FeatureContext context) {
    Configuration configuration = context.getConfiguration();
    if (!configuration.isRegistered(UriConnegFilter.class)) {
        context.register(UriConnegFilter.class, Priorities.AUTHENTICATION - 100);
    }

    if (!context.getConfiguration().isRegistered(DownloadEntityFilter.class)) {
        context.register(DownloadEntityFilter.class);
    }

    if (!configuration.isRegistered(LoadBalancerRequestFilter.class)) {
        context.register(LoadBalancerRequestFilter.class);
    }
    return true;
}
项目:jersey-2.x-webapp-for-servlet-container    文件:SampleApplication.java   
private UriConnegFilter uriConnegFilter() {
  Map<String, MediaType> mediaTypeMappings = new HashMap<>();
  mediaTypeMappings.put("xml", MediaType.APPLICATION_XML_TYPE);
  mediaTypeMappings.put("json", MediaType.APPLICATION_JSON_TYPE);

  return new UriConnegFilter(mediaTypeMappings, null);
}
项目:openregister-java    文件:UriDataFormatFilter.java   
public UriDataFormatFilter(Map<String, MediaType> mediaTypeMappings) {
    uriConnegFilter = new UriConnegFilter(mediaTypeMappings, null);
}