@Override
 public Resource getResource(String host, String sPath)
     throws NotAuthorizedException, BadRequestException {
   Path p = Path.path(sPath);
   if (p.getName().startsWith("alt-")) {
     Resource r = wrapped.getResource(host, p.getParent().toString());
     if (r instanceof FileResource) {
       FileResource fr = (FileResource) r;
       String sourceHash = fr.getHash();
       String formatName = p.getName().replace("alt-", "");
       AltFormat f = AltFormat.find(sourceHash, formatName, SessionManager.session());
       FormatSpec format = altFormatGenerator.findFormat(formatName);
       if (f != null) {
         return new AltFormatResource((FileResource) r, p.getName(), f, format);
       } else {
         log.warn(
             "getResource: pre-generated alt format not found: "
                 + sourceHash
                 + " - "
                 + p.getName());
         // if the format is valid then create a resource which will generate on demand
         if (format != null) {
           System.out.println("created resource for format: " + format);
           return new AltFormatResource((FileResource) r, p.getName(), format);
         } else {
           log.warn("getResource: unrecognised format: " + formatName);
         }
         return null;
       }
     } else {
       return null;
     }
   } else {
     return wrapped.getResource(host, sPath);
   }
 }