> > The "fix" in this case is to delete the compiled 
> > class, which would be in /WEB-INF/cfclasses.
> > Unfortunately, you probably don't have access to 
> > that directory.
> 
> Since the compiled .class files contain the original 
> template location as a string (at about byte 100) it 
> should be do-able for a webhost to provide an interface 
> from which people can delete these classes. And I presume 
> there must be some hook into the runtimeservice that 
> allows you to flush whatever is cached in memory.

Actually, you shouldn't even need to read the content of the class file. The
class file name itself contains a hash of the original file name. Matt
Liotta posted this to another list recently:

"The below Java class should get you pretty close. I know of one special
case where it won't work, but the name will be close enough not to
matter.

import java.io.*;

public class FileUtil {

        public static void main(String[] args) {
                System.out.println(findClass(args[0]));
        }
        
        public static String findClass(String path) {
                File file = new File(path);
                String name = file.getName();
                StringBuffer buf = new StringBuffer(name.length() + 20);
                
                String className = "cf" + name.substring(0,
name.length()-4) + "2e" + name.substring(name.length()-3);
                
        int code = file.hashCode();
        if(code < 0)
            code = ~code;
        
        return className + code + ".class";
        }
    
}"

I compiled it, and it worked fine. Just feed it the fully-qualified file
path and name as an argument. Thanks go to Matt for that.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to