static ResourceConfig generateResourceConfig(Config config, Graphene graphene) { ResourceConfig rc = new ResourceConfig(); // settings rc.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); rc.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // TODO: remove in production // basic features rc.register(CORSFilter.class); rc.register(JacksonFeature.class); rc.register(ValidationFeature.class); // custom resources GrapheneResourceFactory factory = new GrapheneResourceFactory(config, graphene); rc.register(factory.createResource(AdminResource.class)); rc.register(factory.createResource(CoreferenceResource.class)); rc.register(factory.createResource(RelationExtractionResource.class)); return rc; }
@Inject public ApiConfig(ServiceLocator serviceLocator) { register(JacksonFeature.class); register(ValidationFeature.class); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true"); register(AuthenticationRequestFilter.class); register(AdminNecessaryRequestFilter.class); register(RepositoryControllRequestFilter.class); register(HttpCacheControlFilter.class); register(ApiForbiddenExceptionMapper.class); register(ApiNotFoundExceptionMapper.class); register(ApiLoginRequiredExceptionMapper.class); register(AjaxValidationErrorExceptionMapper.class); register(PostErrorResponseFilter.class); GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator); GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(GuiceListener.get()); packages(false, this.getClass().getPackage() + ".rs"); }
@Inject public AppConfig(ServiceLocator serviceLocator) { register(FreemarkerMvcFeature.class); property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/templates"); property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, FlexibleConfiguration.class); register(AttachContextInterceptor.class); register(ValidationFeature.class); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true"); register(AuthenticationRequestFilter.class); register(AdminNecessaryRequestFilter.class); register(RepositoryControllRequestFilter.class); register(HtmlLoginRequiredExceptionMapper.class); register(HttpCacheControlFilter.class); GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator); GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(GuiceListener.get()); packages(false, this.getClass().getPackage() + ".html"); }
public JerseyConfig() { register(ValidationFeature.class); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // Swagger listing resources register(io.swagger.jaxrs.listing.ApiListingResource.class); register(io.swagger.jaxrs.listing.SwaggerSerializers.class); }
public BaseApplication() { packages(true, SERVICES_PACKAGE); packages(true, DAO_PACKAGE); packages(true, ANALYSIS_PACKAGE); register(MultiPartFeature.class); register(ValidationFeature.class); register(DocumentsService.class); }
@Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<Class<?>>(); classes.add(CoffeesResource.class); classes.add(ValidationFeature.class); return classes; }
/** * Register server features * @param config The config to register the features with * @param restConfig The application's configuration */ protected void registerFeatures(Configurable<?> config, T restConfig) { config.register(ValidationFeature.class); }