示例#1
0
 public Modules setupApplicationScope(Container applicationScope) {
   applicationScope.addInstance(Modules.class, this);
   applicationScope.addActivator(
       ModuleDefinitions.class, applicationScope.getActivator(Modules.class));
   selfRegister(applicationScope);
   return this;
 }
 public Application build() {
   if (application == null) {
     container.addInstance(BasePath.class, basePath("/"));
     application = container.get(Application.class);
   }
   return application;
 }
 @Override
 public Container addPerRequestObjects(Container container) throws Exception {
   return container
       .add(ClearFlashPredicate.class, ClearFlashOnSuccessfulNonInternalHtmlResponse.class)
       .add(Flash.class)
       .decorate(HttpHandler.class, FlashHandler.class);
 }
 private ApplicationBuilder(Application application) {
   container.addInstance(Application.class, application);
 }
 private void setupContainer() {
   container.addInstance(ApplicationBuilder.class, this);
   Containers.decorateUsingActivator(container, Application.class, ActivateModules.class);
 }
 private ApplicationBuilder(Class<? extends Application> application) {
   container.add(Application.class, application);
   setupContainer();
 }
 public Server start(ServerConfiguration configuration) {
   container.addInstance(ServerConfiguration.class, configuration);
   container.addInstance(BasePath.class, configuration.basePath());
   container.addActivator(Server.class, ServerActivator.class);
   return container.get(Server.class);
 }
 public Container addPerArgumentObjects(final Container container) {
   container.addType(PropertiesPath.class, PropertiesPathFromStringResolver.class);
   return container;
 }