@SuppressWarnings("unchecked")
  public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration) {

    // From java.util.Date to DateMidnight

    Coercion<java.util.Date, DateMidnight> toDateMidnight =
        new Coercion<java.util.Date, DateMidnight>() {
          public DateMidnight coerce(java.util.Date input) {
            // TODO - confirm this conversion always works, esp. across timezones
            return JodaTimeUtil.toDateMidnight(input);
          }
        };

    configuration.add(
        new CoercionTuple<java.util.Date, DateMidnight>(
            java.util.Date.class, DateMidnight.class, toDateMidnight));

    // From DateMidnight to java.util.Date

    Coercion<DateMidnight, java.util.Date> fromDateMidnight =
        new Coercion<DateMidnight, java.util.Date>() {
          public java.util.Date coerce(DateMidnight input) {
            // TODO - confirm this conversion always works, esp. across timezones
            return JodaTimeUtil.toJavaDate(input);
          }
        };

    configuration.add(
        new CoercionTuple<DateMidnight, java.util.Date>(
            DateMidnight.class, java.util.Date.class, fromDateMidnight));

    // From java.util.Date to LocalDate

    Coercion<java.util.Date, LocalDate> toLocalDate =
        new Coercion<java.util.Date, LocalDate>() {
          public LocalDate coerce(java.util.Date input) {
            // TODO - confirm this conversion always works, esp. across timezones
            return JodaTimeUtil.toLocalDate(input);
          }
        };

    configuration.add(
        new CoercionTuple<java.util.Date, LocalDate>(
            java.util.Date.class, LocalDate.class, toLocalDate));

    // From LocalDate to java.util.Date

    Coercion<LocalDate, java.util.Date> fromLocalDate =
        new Coercion<LocalDate, java.util.Date>() {
          public java.util.Date coerce(LocalDate input) {
            // TODO - confirm this conversion always works, esp. across timezones
            return JodaTimeUtil.toJavaDate(input);
          }
        };

    configuration.add(
        new CoercionTuple<LocalDate, java.util.Date>(
            LocalDate.class, java.util.Date.class, fromLocalDate));
  }
 public static void contributeWebSecurityManager(Configuration<Realm> configuration) {
   configuration.add(new ExtendedPropertiesRealm("classpath:shiro-users.properties"));
 }
 public static void contributeIgnoredPathsFilter(Configuration<String> configuration) {
   configuration.add("/partials/*");
 }
 public static void contributeApplication(
     Configuration<Object> singletons, TareasResource todosResource) {
   // Contribuir a la configuración del servicio Application con los
   // servicios REST
   singletons.add(todosResource);
 }
 public static void contributeResteasyPackageManager(Configuration<String> configuration) {
   configuration.add("dev.openshift.tapestry.angular.ws");
 }
 public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) {
   configuration.add(new LibraryMapping("angular", "dev.openshift.tapestry.angular"));
 }
 /** @param pConfiguration to use */
 public static void contributeResponseCompressionAnalyzer(
     final Configuration<String> pConfiguration) {
   pConfiguration.add("application/json");
 }
Exemple #8
0
 public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) {
   configuration.add(new LibraryMapping("tapx", "com.howardlewisship.tapx.kaptcha"));
 }
 public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) {
   configuration.add(new LibraryMapping(PATH_PREFIX, "org.tynamo.security.federatedaccounts"));
 }