@Override
 public long getLastModified(Object templateSource) {
   ApplicationResource source = (ApplicationResource) templateSource;
   try {
     return source.getLastModified();
   } catch (IOException e) {
     return -1;
   }
 }
  @Override
  protected List<ApplicationResource> getSources(ApplicationContext applicationContext) {
    Collection<ApplicationResource> resources = new ArrayList<>();

    Set<String> definitions = getTilesDefinitions(applicationContext.getInitParams());
    for (String definition : definitions) {
      resources.addAll(applicationContext.getResources(definition));
    }

    List<ApplicationResource> filteredResources = new ArrayList<>();
    for (ApplicationResource resource : resources) {
      if (Locale.ROOT.equals(resource.getLocale())) {
        filteredResources.add(resource);
      }
    }

    return filteredResources;
  }
 @Override
 public ApplicationResource getResource(ApplicationResource base, Locale locale) {
   ApplicationResource retValue = null;
   Collection<ApplicationResource> urlSet = getResources(base.getLocalePath(locale));
   if (urlSet != null && !urlSet.isEmpty()) {
     retValue = urlSet.iterator().next();
   }
   return retValue;
 }
 @Override
 public Reader getReader(Object templateSource, String encoding) throws IOException {
   ApplicationResource source = (ApplicationResource) templateSource;
   return new InputStreamReader(source.getInputStream(), encoding);
 }