// https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk/quickstart/filtered/archetype-resources/src/main/java/services/AppModule.java public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add("HSTSPolicy", new HSTSPolicyHeader()); // HTTPS only: No HTTP allowed configuration.add("CSPolicy", new CSPolicyHeader()); // Restrict JS execution: no CDN // configuration.add("AutoLogout", new AutoLogoutHeader()); // configuration.add("Timing", filter); }
/** * This is a contribution to the RequestHandler service configuration. This is how we extend * Tapestry using the timing filter. A common use for this kind of filter is transaction * management or security. The @Local annotation selects the desired service by type, but only * from the same module. Without @Local, there would be an error due to the other service(s) that * implement RequestFilter (defined in other modules). */ public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add("Timing", filter); }
// http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Tapestry-Tynamo-Rest-and-security-integration-questions-td5714525.html public static void contributeHttpServletRequestHandler( @InjectService("SecurityConfiguration") HttpServletRequestFilter securityConfiguration, OrderedConfiguration<HttpServletRequestFilter> filters) { filters.override( "SecurityConfiguration", securityConfiguration, "before:ResteasyRequestFilter,after:StoreIntoGlobals"); }
public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, PageRenderLinkSource pageRenderLinkSource) { final HashSet<String> ASSETS_WHITE_LIST = new HashSet<String>(Arrays.asList("jpg", "jpeg", "png", "gif", "js", "css", "ico")); configuration.add( "AssetProtectionFilter", new AssetProtectionFilter(ASSETS_WHITE_LIST, pageRenderLinkSource), "before:*"); }
/** Add the properties configurer. */ public static void contributeHibernateSessionSource( OrderedConfiguration<HibernateConfigurer> config, @Inject @Symbol("hibernate.properties") String propertiesFilename) { if (propertiesFilename != null) { if (!new File(propertiesFilename).exists()) throw new RuntimeException( String.format("cant read hibernate properties '%s'", propertiesFilename)); config.add("Properties", new PropertiesHibernateConfigurer(propertiesFilename)); } }
public void contributeValidationMessagesSource(OrderedConfiguration<String> configuration) { configuration.add("myValidationMessages", "jumpstart/web/validators/ValidationMessages"); configuration.add("myTranslationMessages", "jumpstart/web/translators/TranslationMessages"); }
public void contributeComponentRequestHandler( OrderedConfiguration<ComponentRequestFilter> configuration) { configuration.addInstance("PageProtectionFilter", PageProtectionFilter.class); }
// Añadir el filtro de RESTEasy al pipeline de Tapestry public static void contributeHttpServletRequestHandler( OrderedConfiguration<HttpServletRequestFilter> configuration, @InjectService("ResteasyRequestFilter") HttpServletRequestFilter resteasyRequestFilter) { configuration.add( "ResteasyRequestFilter", resteasyRequestFilter, "after:IgnoredPaths", "before:GZIP"); }
public static void contributeComponentMessagesSource( OrderedConfiguration<Resource> configuration, @Value("classpath:com/howardlewisship/tapx/kaptcha/tapx-kaptcha.properties") Resource coreCatalog) { configuration.add("TapxKaptcha", coreCatalog, "before:AppCatalog"); }