@Override public ConsoleReporter get() { ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).build(); String interval = launchConfig.getOther("metrics.scheduledreporter.interval", "30"); reporter.start(Long.parseLong(interval), TimeUnit.SECONDS); return reporter; }
public NettyHandlerAdapter(Stopper stopper, Handler handler, LaunchConfig launchConfig) { this.handlers = new Handler[] {handler}; this.return404 = Handlers.notFound(); RegistryBuilder registryBuilder = Registries.registry() // If you update this list, update the class level javadoc on Context. .add(Stopper.class, stopper) .add(MimeTypes.class, new ActivationBackedMimeTypes()) .add( PublicAddress.class, new DefaultPublicAddress( launchConfig.getPublicAddress(), launchConfig.getSSLContext() == null ? "http" : "https")) .add(Redirector.class, new DefaultRedirector()) .add(ClientErrorHandler.class, new DefaultClientErrorHandler()) .add(ServerErrorHandler.class, new DefaultServerErrorHandler()) .add(LaunchConfig.class, launchConfig) .add(FileRenderer.class, new DefaultFileRenderer()) .add(CharSequenceRenderer.class, new DefaultCharSequenceRenderer()) .add(FormParser.class, FormParser.multiPart()) .add(FormParser.class, FormParser.urlEncoded()) .add(HttpClient.class, HttpClients.httpClient(launchConfig)); if (launchConfig.isHasBaseDir()) { registryBuilder.add(FileSystemBinding.class, launchConfig.getBaseDir()); } this.registry = registryBuilder.build(); this.addResponseTimeHeader = launchConfig.isTimeResponses(); this.compressResponses = launchConfig.isCompressResponses(); this.applicationConstants = new DefaultContext.ApplicationConstants(launchConfig, new DefaultRenderController()); this.execController = launchConfig.getExecController(); }
@Provides TemplatingConfig provideTemplatingConfig(LaunchConfig launchConfig) { return new DefaultTemplatingConfig( templatesPath, cacheSize, reloadable || launchConfig.isDevelopment(), staticallyCompile); }