App.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:timezone 作者:
@Override
    public void run(AppConfig configuration, Environment environment) throws IOException {

        // Enable CORS headers
        final FilterRegistration.Dynamic cors = environment.servlets().addFilter("CORS", CrossOriginFilter.class);

        // Configure CORS parameters
        cors.setInitParameter("allowedOrigins", "*");
        cors.setInitParameter("allowedHeaders", "X-Requested-With,Content-Type,Accept,Origin");
        cors.setInitParameter("allowedMethods", "OPTIONS,GET,PUT,POST,DELETE,HEAD");

        // Add URL mapping
        cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

        Quadtree quadtree = new Quadtree();
        URL world = this.getClass().getResource("tz_world.shp");
        new TZShapeReader(quadtree).read(world);
        TimeZoneService timeZoneService = new TimeZoneService(quadtree);

        environment.jersey().register(timeZoneService);


//        // healthChecks
//        environment.healthChecks().register("app-health-check", new AppHealthCheck());
//
//        // filter
//        environment.servlets().addFilter("ip-filter", new IPFilter(configuration.getIPWhiteList(), configuration.getIPBlackList())).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号