use of org.apache.tapestry5.ioc.annotations.Contribute in project flowlogix by flowlogix.
the class ServicesModule method provideClassTransformWorkers.
@Contribute(ComponentClassTransformWorker2.class)
@Primary
public static void provideClassTransformWorkers(OrderedConfiguration<ComponentClassTransformWorker2> configuration) {
configuration.addInstance("AJAX", AjaxAnnotationWorker.class, "before:Property");
configuration.add("DisableAfterSubmit", new MixinAdderWorker(Submit.class, AutoDisableAfterSubmit.class), "after:AJAX");
configuration.add("ZoneColorHighlight", new MixinAdderWorker(Zone.class, AutoZoneColorHighlight.class), "after:AJAX");
}
use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.
the class AppModule method setupCustomBaseURLSource.
@Contribute(ServiceOverride.class)
public void setupCustomBaseURLSource(MappedConfiguration<Class, Object> configuration) {
BaseURLSource source = new BaseURLSource() {
public String getBaseURL(boolean secure) {
String protocol = secure ? "https" : "http";
// This is all a bit jury-rigged together. This is for running the app
// interactively; Selenium doesn't seem to handle the transition to https.
int port = secure ? 8443 : 9090;
return String.format("%s://localhost:%d", protocol, port);
}
};
configuration.add(BaseURLSource.class, source);
}
use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.
the class AppModule method configurePersistenceUnitInfos.
@Contribute(EntityManagerSource.class)
public static void configurePersistenceUnitInfos(final MappedConfiguration<String, PersistenceUnitConfigurer> configuration) {
final PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer() {
@Override
public void configure(final TapestryPersistenceUnitInfo unitInfo) {
unitInfo.addManagedClass(User.class);
}
};
configuration.add(AppConstants.TEST_PERSISTENCE_UNIT, configurer);
final PersistenceUnitConfigurer configurer2 = new PersistenceUnitConfigurer() {
@Override
public void configure(final TapestryPersistenceUnitInfo unitInfo) {
unitInfo.addProperty("javax.persistence.jdbc.driver", "org.h2.Driver").addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:test").addProperty("eclipselink.ddl-generation", "create-tables").addProperty("eclipselink.logging.level", "fine").addManagedClass(Thang.class);
}
};
configuration.add(AppConstants.TEST_PERSISTENCE_UNIT_2, configurer2);
}
use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.
the class PageTesterModule method setupTestableOverrides.
@Contribute(ServiceOverride.class)
public static void setupTestableOverrides(MappedConfiguration<Class, Object> configuration, @Local TestableRequest request, @Local TestableResponse response, final ObjectLocator locator) {
configuration.add(Request.class, request);
configuration.add(Response.class, response);
TestableCookieSinkSource cookies = new TestableCookieSinkSource();
configuration.add(CookieSink.class, cookies);
configuration.add(CookieSource.class, cookies);
// With the significant changes to the handling of assets in 5.4, we introduced a problem:
// We were checking at page render time whether to generate URLs for normal or compressed
// assets and that peeked at the HttpServletRequest global, which isn't set up by PageTester.
// What we're doing here is using a hacked version of that code to force GZip support
// on.
configuration.add(ResponseCompressionAnalyzer.class, new ResponseCompressionAnalyzer() {
public boolean isGZipEnabled(ContentType contentType) {
return locator.getObject(CompressionAnalyzer.class, null).isCompressable(contentType.getMimeType());
}
public boolean isGZipSupported() {
return true;
}
});
}
use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.
the class SpringModule method reportSpringContextDetailsAtStartup.
@Contribute(ApplicationInitializer.class)
@Primary
public void reportSpringContextDetailsAtStartup(OrderedConfiguration<ApplicationInitializerFilter> configuration, final ApplicationContext springContext) {
ApplicationInitializerFilter filter = new ApplicationInitializerFilter() {
@Override
public void initializeApplication(Context context, ApplicationInitializer initializer) {
logger.info(String.format("Spring version %s with %,d defined beans.", SpringVersion.getVersion(), springContext.getBeanDefinitionCount()));
initializer.initializeApplication(context);
}
};
configuration.add("SpringContextInitialization", filter);
}
Aggregations