Ejemplo n.º 1
0
  // 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);
  }
Ejemplo n.º 2
0
  /**
   * 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);
  }
 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");
 }
Ejemplo n.º 6
0
 // 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");
 }
Ejemplo n.º 7
0
 public static void contributeComponentMessagesSource(
     OrderedConfiguration<Resource> configuration,
     @Value("classpath:com/howardlewisship/tapx/kaptcha/tapx-kaptcha.properties")
         Resource coreCatalog) {
   configuration.add("TapxKaptcha", coreCatalog, "before:AppCatalog");
 }