tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "? ?" <shi_hang...@hotmail.com>
Subject Hi, a question about JspCompilationContext.isRemoved().
Date Fri, 10 Feb 2006 06:33:06 GMT
Dear developers of jasper,
I have a question about JspCompilationContext.isRemoved(). I think we should
check the file in file system instead of checking a counter.
In this method, we use a counter named ˇ°removedˇ± to determine if the JSP
file is in the file system.
    public boolean isRemoved() {
        if (removed > 1 ) {
            return true;
        }
        return false;
}
But I think there are two problems in above code.
1.	We will always get a 404 page when we recover a JSP file after we delete
it and access it with browser. What cause it is because the counter is
increased in Compiler.isOutDated() when we try to access a deleted JSP file.
But the counter is only reset to 0 in JspCompilationContext.load(), which is
executed after the method isOutDated(). In another word, the method load()
is never reset to 0 once counter is set to 2.
2.	We can access the page through browser successfully for two times after
we have deleted the relative JSP file in file system. Because condition is
ˇ°removedˇ± is equal or larger than 2.

I think it may be better if we change the method in this way.
    public boolean isRemoved() {

        String jsp = getJspFile();
        try {
            URL jspUrl = getResource(jsp);
            if (jspUrl == null) {
                return true;
            }
            return false;
        } catch (Exception e) {
            e.printStackTrace();
            return true;
        }

    }

Do you think it is a sound idea? Does it cause impact against other code?
Any help is appreciated.

Sean

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message