public WebApplicationResourceConfig() { packages("com.giorgiosironi.gameoflife.web"); property(MvcFeature.TEMPLATE_BASE_PATH, "templates"); register(FreemarkerMvcFeature.class); register(new AbstractBinder() { @Override protected void configure() { InMemoryGenerationRepository repository = new InMemoryGenerationRepository(); Generation original = Generation.withAliveCells( Cell.onXAndY(1, 1), Cell.onXAndY(1, 2), Cell.onXAndY(2, 1), Cell.onXAndY(2, 2), Cell.onXAndY(7, 1), Cell.onXAndY(7, 2), Cell.onXAndY(7, 3), Cell.onXAndY(7, 8) ); repository.add("a-block-and-a-bar", 0, original); bind(repository).to(GenerationRepository.class); } }); }
@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 Server() { register(FreemarkerMvcFeature.class); packages("ru.qatools.school.baguette.resources"); register(new DynamicFeature() { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { context.register(DatabaseProvider.class); if (resourceInfo.getResourceMethod().isAnnotationPresent(AuthenticationRequired.class)) { context.register(AuthenticationFilter.class); } } }); }
public DrillRestServer(final WorkManager workManager) { register(DrillRoot.class); register(StatusResources.class); register(StorageResources.class); register(ProfileResources.class); register(QueryResources.class); register(MetricsResources.class); register(ThreadsResources.class); register(FreemarkerMvcFeature.class); register(MultiPartFeature.class); property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); //disable moxy so it doesn't conflict with jackson. final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType()); property(disableMoxy, true); register(JsonParseExceptionMapper.class); register(JsonMappingExceptionMapper.class); register(GenericExceptionMapper.class); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(workManager.getContext().getConfig().getMapper()); register(provider); register(new AbstractBinder() { @Override protected void configure() { bind(workManager).to(WorkManager.class); bind(workManager.getContext().getConfig().getMapper()).to(ObjectMapper.class); bind(workManager.getContext().getPersistentStoreProvider()).to(PStoreProvider.class); bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class); } }); }
public MotdApplication() { // scan com.gluonhq package for jax-rs classes packages(true, "com.gluonhq"); // everything inside /webjars should not be handled by the jax-rs application property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "/webjars/.*"); // use freemarker for web templating register(FreemarkerMvcFeature.class); property(FreemarkerMvcFeature.TEMPLATE_BASE_PATH, "freemarker"); }
public Server() { register(FreemarkerMvcFeature.class); register(new DynamicFeature() { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { context.register(DatabaseProvider.class); context.register(AuthUserProvider.class); } }); packages(Server.class.getPackage().getName()); }
public ExampleApplication() { this.packages(true, "it.pkg.presentation"); this.register(JacksonObjectMappProvider.class); this.register(JacksonFeature.class); this.register(MultiPartFeature.class); this.register(FreemarkerMvcFeature.class); this.property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, this.getClass().getResource("/")); }
public ExampleApplication() { this.packages(true, "${package}.presentation"); this.register(JacksonObjectMappProvider.class); this.register(JacksonFeature.class); this.register(MultiPartFeature.class); this.register(FreemarkerMvcFeature.class); this.property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, this.getClass().getResource("/")); }
public Server() { register(FreemarkerMvcFeature.class); register(new DynamicFeature() { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { context.register(DatabaseProvider.class); } }); packages(Server.class.getPackage().getName()); }
public Server() { Splinter splinter = new Splinter(); registerBinders(splinter); SimpleContainer.getLogger().debug( String.format( "Starting application in `%s` environment using `%s` database driver", splinter.getEnvironment().toString().toLowerCase(), splinter.getConfiguration().getDatabaseConfiguration().getDriver().toString().toLowerCase() ) ); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true); register(FreemarkerMvcFeature.class); register(new DynamicFeature() { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { context.register(DatabaseProvider.class); context.register(AuthProvider.class); } }); packages(Server.class.getPackage().getName()); registerSharedVariables(); }
protected void init(ScanResult result) { // FILTERS // register(JSONPrettyPrintFilter.class); register(MediaTypeFilter.class); // RESOURCES // for (Class<?> resource : result.getAnnotatedClasses(RestResource.class)) { register(resource); } // FEATURES property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration()); register(FreemarkerMvcFeature.class); register(MultiPartFeature.class); register(FirstTimeFeature.class); register(DACAuthFilterFeature.class); register(DACExceptionMapperFeature.class); register(DACJacksonJaxbJsonFeature.class); register(TestResourcesFeature.class); // LISTENERS // register(TimingApplicationEventListener.class); // EXCEPTION MAPPERS // register(JsonParseExceptionMapper.class); register(JsonMappingExceptionMapper.class); // BODY WRITERS // register(QlikAppMessageBodyGenerator.class); register(TableauMessageBodyGenerator.class); // PROPERTIES // property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true"); final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType()); property(disableMoxy, true); property(TableauMessageBodyGenerator.CUSTOMIZATION_ENABLED, false); }
public DrillRestServer(final WorkManager workManager, final ServletContext servletContext, final Drillbit drillbit) { register(DrillRoot.class); register(StatusResources.class); register(StorageResources.class); register(ProfileResources.class); register(QueryResources.class); register(MetricsResources.class); register(ThreadsResources.class); register(LogsResources.class); property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, getFreemarkerConfiguration(servletContext)); register(FreemarkerMvcFeature.class); register(MultiPartFeature.class); property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true); final boolean isAuthEnabled = workManager.getContext().getConfig().getBoolean(ExecConstants.USER_AUTHENTICATION_ENABLED); if (isAuthEnabled) { register(LogInLogOutResources.class); register(AuthDynamicFeature.class); register(RolesAllowedDynamicFeature.class); } //disable moxy so it doesn't conflict with jackson. final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType()); property(disableMoxy, true); register(JsonParseExceptionMapper.class); register(JsonMappingExceptionMapper.class); register(GenericExceptionMapper.class); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(workManager.getContext().getLpPersistence().getMapper()); register(provider); // Get an EventExecutor out of the BitServer EventLoopGroup to notify listeners for WebUserConnection. For // actual connections between Drillbits this EventLoopGroup is used to handle network related events. Though // there is no actual network connection associated with WebUserConnection but we need a CloseFuture in // WebSessionResources, so we are using EvenExecutor from network EventLoopGroup pool. final EventExecutor executor = workManager.getContext().getBitLoopGroup().next(); register(new AbstractBinder() { @Override protected void configure() { bind(drillbit).to(Drillbit.class); bind(workManager).to(WorkManager.class); bind(executor).to(EventExecutor.class); bind(workManager.getContext().getLpPersistence().getMapper()).to(ObjectMapper.class); bind(workManager.getContext().getStoreProvider()).to(PersistentStoreProvider.class); bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class); bind(new UserAuthEnabled(isAuthEnabled)).to(UserAuthEnabled.class); if (isAuthEnabled) { bindFactory(DrillUserPrincipalProvider.class).to(DrillUserPrincipal.class); bindFactory(AuthWebUserConnectionProvider.class).to(WebUserConnection.class); } else { bindFactory(AnonDrillUserPrincipalProvider.class).to(DrillUserPrincipal.class); bindFactory(AnonWebUserConnectionProvider.class).to(WebUserConnection.class); } } }); }