code: static String getOutputName(String resource)
      {
          final int secondToTheLastDot = resource.lastIndexOf('.', resource.length()-5), 
                  slash = resource.lastIndexOf('/', secondToTheLastDot);
          
          return resource.substring(slash+1, secondToTheLastDot);
      }
docs: Returns "foo" from "path/to/foo.java.stg".