You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2001/03/21 01:08:53 UTC

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspCompiler.java JspReader.java ParserController.java TagLibraryInfoImpl.java

remm        01/03/20 16:08:53

  Modified:    jasper/src/share/org/apache/jasper/compiler JspCompiler.java
                        JspReader.java ParserController.java
                        TagLibraryInfoImpl.java
  Log:
  - Jasper should run from WARs (or any other repository which provides a directory
    context to access it).
  - All Watchdog 4 tests pass (servlets, JSP, JSP-XML).
  - Of course, the classes and JARs are still extracted from the WAR until the
    compilation technology is updated (javac wants files :(( ).
  
  Revision  Changes    Path
  1.4       +7 -5      jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java
  
  Index: JspCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspCompiler.java	2001/02/04 01:05:02	1.3
  +++ JspCompiler.java	2001/03/21 00:08:50	1.4
  @@ -163,17 +163,19 @@
        * from whence it came
        */
       public boolean isOutDated() {
  -        File jspReal = null;
  +        long jspRealLastModified = 0;
   
  -        jspReal = new File(ctxt.getRealPath(jsp.getPath()));
  -
  -        if (!jspReal.exists()) {
  +        try {
  +            jspRealLastModified = ctxt.getResource(jsp.getPath())
  +                .openConnection().getLastModified();
  +        } catch (Exception e) {
  +            e.printStackTrace();
               return true;
           }
   
           File classFile = new File(getClassFileName());
           if (classFile.exists()) {
  -            outDated = classFile.lastModified() < jspReal.lastModified();
  +            outDated = classFile.lastModified() < jspRealLastModified;
           } else {
               outDated = true;
           }
  
  
  
  1.5       +2 -0      jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspReader.java
  
  Index: JspReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspReader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JspReader.java	2000/10/11 19:35:14	1.4
  +++ JspReader.java	2001/03/21 00:08:51	1.5
  @@ -248,6 +248,8 @@
   	String longName = (context == null)
   	    ? file.getAbsolutePath()
   	    : context.getRealPath(file.toString());
  +        if (longName == null)
  +            longName = file.toString();
   
   	int fileid = registerSourceFile(longName);
   
  
  
  
  1.12      +1 -1      jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ParserController.java	2001/03/15 22:42:12	1.11
  +++ ParserController.java	2001/03/21 00:08:51	1.12
  @@ -187,7 +187,7 @@
           File file = new File(absFileName);
   	String filePath = (ctxt == null) 
   	    ? file.getAbsolutePath()
  -	    : ctxt.getRealPath(file.toString());
  +	    : file.toString();//ctxt.getRealPath(file.toString());
   	//p("filePath: " + filePath);
   
   	String encoding = topFileEncoding;
  
  
  
  1.21      +8 -4      jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
  
  Index: TagLibraryInfoImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TagLibraryInfoImpl.java	2001/02/18 02:18:14	1.20
  +++ TagLibraryInfoImpl.java	2001/03/21 00:08:52	1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.20 2001/02/18 02:18:14 craigmcc Exp $
  - * $Revision: 1.20 $
  - * $Date: 2001/02/18 02:18:14 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.21 2001/03/21 00:08:52 remm Exp $
  + * $Revision: 1.21 $
  + * $Date: 2001/03/21 00:08:52 $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -152,7 +152,11 @@
           try {
               // see if file exists on the filesystem first
               String real = ctxt.getRealPath(uri);
  -            return (real == null) ? null : new FileInputStream(real);
  +            if (real == null) {
  +                return ctxt.getResourceAsStream(uri);
  +            } else {
  +                return new FileInputStream(real);
  +            }
           }
           catch (FileNotFoundException ex) {
               // if file not found on filesystem, get the resource through
  
  
  

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspCompiler.java JspReader.java ParserController.java TagLibraryInfoImpl.java

Posted by Mel Martinez <me...@yahoo.com>.
--- Mel Martinez <me...@yahoo.com> wrote:
> 
> --- remm@apache.org wrote:
> >   - Of course, the classes and JARs are still
> > extracted from the WAR until the
> >     compilation technology is updated (javac wants
> > files :(( ).
> >   
> 
> :-)  But javac doesn't have any reason to deal with
> the contents of the WAR directly.  JSP 'files' read
> out of the .war are being converted to .java files
> stored in the working directory (i.e. /tmp or
> wherever).  Javac just has to deal with the latter
> files.
> 

Please disregard this stupid inaccuracy.  'Brain
momentarily dumped the fact that the compiler might
need to see inside the .war for imported classes used
in the compilation of the .jsp/.java file.

Sigh...

Mel

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspCompiler.java JspReader.java ParserController.java TagLibraryInfoImpl.java

Posted by Mel Martinez <me...@yahoo.com>.
--- remm@apache.org wrote:
> remm        01/03/20 16:08:53
> 
>   Modified:   
> jasper/src/share/org/apache/jasper/compiler
> JspCompiler.java
>                         JspReader.java
> ParserController.java
>                         TagLibraryInfoImpl.java
>   Log:
>   - Jasper should run from WARs (or any other
> repository which provides a directory
>     context to access it).
>   - All Watchdog 4 tests pass (servlets, JSP,
> JSP-XML).
>   - Of course, the classes and JARs are still
> extracted from the WAR until the
>     compilation technology is updated (javac wants
> files :(( ).
>   

:-)  But javac doesn't have any reason to deal with
the contents of the WAR directly.  JSP 'files' read
out of the .war are being converted to .java files
stored in the working directory (i.e. /tmp or
wherever).  Javac just has to deal with the latter
files.

It should be possible to modify Jasper to work with an
unexpanded .war archive.  Not necessarily trivial, but
definitely possible, in principle, with no need for
new javac compilation tech.

Cheers,

Mel

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/