tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From man...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/jasper/resources messages.properties
Date Wed, 23 Feb 2000 02:23:46 GMT
mandar      00/02/22 18:23:45

  Modified:    src/share/org/apache/jasper EmbededServletOptions.java
                        Options.java
               src/share/org/apache/jasper/compiler BaseJspListener.java
                        DelegatingListener.java JspParseEventListener.java
                        ParseEventListener.java Parser.java
               src/share/org/apache/jasper/resources messages.properties
  Added:       src/share/org/apache/jasper/compiler
                        MappedCharDataGenerator.java
  Log:
  * Fix for line numbers in the generated Servlet
    so that they match the actual location of Tags
    in the JSP file.
  * Added a new type of CharDataGenerator that maps
    each HTML line to a Java "println". This seems
    to be really useful for debugging and tools.
    To use this add to the JspServlet conf. the following:
    (in conf/web.xml):
  
          <init-param>
              <param-name>mappedfile</param-name>
              <param-value>true</param-value>
          </init-param>
  
  Revision  Changes    Path
  1.3       +28 -5     jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java
  
  Index: EmbededServletOptions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EmbededServletOptions.java	2000/02/13 06:25:23	1.2
  +++ EmbededServletOptions.java	2000/02/23 02:23:44	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java,v
1.2 2000/02/13 06:25:23 akv Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/02/13 06:25:23 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java,v
1.3 2000/02/23 02:23:44 mandar Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -87,7 +87,14 @@
        * data being used literally in the generated servlet. 
        */
       public boolean largeFile = false;
  -
  +    
  +    /**
  +     * Do you want support for "mapped" files? This will generate
  +     * servlet that has a print statement per line of the JSP file.
  +     * This seems like a really nice feature to have for debugging.
  +     */
  +    public boolean mappedFile = false;
  +    
       /**
        * Do you want stack traces and such displayed in the client's
        * browser? If this is false, such messages go to the standard
  @@ -139,6 +146,13 @@
       }
       
       /**
  +     * Are we supporting HTML mapped servlets?
  +     */
  +    public boolean getMappedFile() {
  +        return mappedFile;
  +    }
  +    
  +    /**
        * Should errors be sent to client or thrown into stderr?
        */
       public boolean getSendErrorToClient() {
  @@ -205,7 +219,16 @@
                   this.largeFile = false;
               else Constants.message ("jsp.warning.largeFile", Logger.WARNING);
           }
  -
  +	
  +        String mapFile = config.getInitParameter("mappedfile"); 
  +        if (mapFile != null) {
  +            if (mapFile.equalsIgnoreCase("true"))
  +                this.mappedFile = true;
  +            else if (mapFile.equalsIgnoreCase("false"))
  +                this.mappedFile = false;
  +            else Constants.message ("jsp.warning.mappedFile", Logger.WARNING);
  +        }
  +	
           String senderr = config.getInitParameter("sendErrToClient");
           if (senderr != null) {
               if (senderr.equalsIgnoreCase("true"))
  
  
  
  1.10      +9 -3      jakarta-tomcat/src/share/org/apache/jasper/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Options.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Options.java	2000/02/13 06:25:23	1.9
  +++ Options.java	2000/02/23 02:23:44	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Options.java,v 1.9 2000/02/13
06:25:23 akv Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/02/13 06:25:23 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Options.java,v 1.10 2000/02/23
02:23:44 mandar Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -82,6 +82,12 @@
        * Are we supporting large files?
        */
       public boolean getLargeFile();
  +
  +    /**
  +     * Are we supporting HTML mapped servlets?
  +     */
  +    public boolean getMappedFile();
  +    
       
       /**
        * Should errors be sent to client or thrown into stderr?
  
  
  
  1.4       +4 -4      jakarta-tomcat/src/share/org/apache/jasper/compiler/BaseJspListener.java
  
  Index: BaseJspListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BaseJspListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BaseJspListener.java	1999/12/21 16:32:30	1.3
  +++ BaseJspListener.java	2000/02/23 02:23:44	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BaseJspListener.java,v
1.3 1999/12/21 16:32:30 rubys Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/12/21 16:32:30 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BaseJspListener.java,v
1.4 2000/02/23 02:23:44 mandar Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -158,7 +158,7 @@
   	throw new JasperException(Constants.getString("jsp.error.not.impl.include"));
       }
   
  -    public void handleTagBegin(Mark start, Hashtable attrs, String prefix, 
  +    public void handleTagBegin(Mark start, Mark stop, Hashtable attrs, String prefix, 
   			       String shortTagName, TagLibraryInfoImpl tli, 
   			       TagInfo ti)
   	throws JasperException
  
  
  
  1.4       +5 -5      jakarta-tomcat/src/share/org/apache/jasper/compiler/DelegatingListener.java
  
  Index: DelegatingListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/DelegatingListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DelegatingListener.java	1999/12/21 16:32:30	1.3
  +++ DelegatingListener.java	2000/02/23 02:23:44	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/DelegatingListener.java,v
1.3 1999/12/21 16:32:30 rubys Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/12/21 16:32:30 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/DelegatingListener.java,v
1.4 2000/02/23 02:23:44 mandar Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -179,13 +179,13 @@
           delegate.handleInclude(start, stop, attrs, param);
       }
   
  -    public void handleTagBegin(Mark start, Hashtable attrs, String prefix, 
  +    public void handleTagBegin(Mark start, Mark stop, Hashtable attrs, String prefix, 
   			       String shortTagName, TagLibraryInfoImpl tli, 
   			       TagInfo ti)
   	throws JasperException
       {
           doAction();
  -        delegate.handleTagBegin(start, attrs, prefix, shortTagName, tli, ti);
  +        delegate.handleTagBegin(start, stop, attrs, prefix, shortTagName, tli, ti);
       }
       
       public void handleTagEnd(Mark start, Mark stop, String prefix, 
  
  
  
  1.8       +12 -8     jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JspParseEventListener.java	2000/02/13 06:25:24	1.7
  +++ JspParseEventListener.java	2000/02/23 02:23:44	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
1.7 2000/02/13 06:25:24 akv Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/02/13 06:25:24 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
1.8 2000/02/23 02:23:44 mandar Exp $
  + * $Revision: 1.8 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -833,10 +833,14 @@
       
       public void handleCharData(char[] chars) throws JasperException {
           GeneratorBase cdg;
  +
           if (ctxt.getOptions().getLargeFile())
               cdg = new StoredCharDataGenerator(vector, dataFile, stringId++, chars);
  -        else
  -            cdg = new CharDataGenerator(chars);
  +        else if(ctxt.getOptions().getMappedFile()) 
  +            cdg = new MappedCharDataGenerator(chars);
  +	else
  +	    cdg = new CharDataGenerator(chars);
  +
           
           // FIXME: change null
           Generator gen
  @@ -846,7 +850,7 @@
   	addGenerator(gen);
       }
       
  -    public void handleTagBegin(Mark start, Hashtable attrs, String prefix, 
  +    public void handleTagBegin(Mark start, Mark stop, Hashtable attrs, String prefix, 
   			       String shortTagName, TagLibraryInfoImpl tli, 
   			       TagInfo ti)
   	throws JasperException
  @@ -855,7 +859,7 @@
           Generator gen
               = new GeneratorWrapper(new TagBeginGenerator(prefix, shortTagName, attrs,
   							 tli, ti),
  -                                   null, null);
  +                                   start, stop);
   
   	addGenerator(gen);
   
  @@ -869,7 +873,7 @@
   	// FIXME: null's
           Generator gen
               = new GeneratorWrapper(new TagEndGenerator(prefix, shortTagName, attrs, tli,
ti),
  -                                   null, null);
  +                                   start, stop);
   
   	addGenerator(gen);
       }
  
  
  
  1.4       +4 -4      jakarta-tomcat/src/share/org/apache/jasper/compiler/ParseEventListener.java
  
  Index: ParseEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/ParseEventListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ParseEventListener.java	1999/12/21 16:32:31	1.3
  +++ ParseEventListener.java	2000/02/23 02:23:44	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/ParseEventListener.java,v
1.3 1999/12/21 16:32:31 rubys Exp $
  - * $Revision: 1.3 $
  - * $Date: 1999/12/21 16:32:31 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/ParseEventListener.java,v
1.4 2000/02/23 02:23:44 mandar Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/02/23 02:23:44 $
    *
    * ====================================================================
    * 
  @@ -105,7 +105,7 @@
        *        is the start of the body after the "/>" if content type is tag dependent
        * stop: can be null if the body contained JSP tags... 
        */
  -    void handleTagBegin(Mark start, Hashtable attrs, String prefix, String shortTagName,
  +    void handleTagBegin(Mark start, Mark stop, Hashtable attrs, String prefix, String shortTagName,
   			TagLibraryInfoImpl tli, TagInfo ti) 
   	throws JasperException;
   
  
  
  
  1.15      +2 -2      jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Parser.java	2000/02/13 06:25:24	1.14
  +++ Parser.java	2000/02/23 02:23:45	1.15
  @@ -782,7 +782,7 @@
   		else
   		    throw new ParseException(start, "Body is supposed to be empty for "+tag);
   		
  -		listener.handleTagBegin(start, attrs, prefix,
  +		listener.handleTagBegin(start, reader.mark(), attrs, prefix,
   					shortTagName, tli, ti);
   		listener.handleTagEnd(start, reader.mark(), prefix, 
   				      shortTagName, attrs, tli, ti);
  @@ -793,7 +793,7 @@
   		if (reader.matches(CLOSE)) {
   		    reader.advance(CLOSE.length());
   		    bodyStart = reader.mark();
  -		    listener.handleTagBegin(bodyStart, attrs, prefix, 
  +		    listener.handleTagBegin(start, bodyStart, attrs, prefix, 
   					    shortTagName, tli, ti);
                       if (bc.equalsIgnoreCase(TagInfo.BODY_CONTENT_TAG_DEPENDENT) ||
                           bc.equalsIgnoreCase(TagInfo.BODY_CONTENT_JSP)) 
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java
  
  Index: MappedCharDataGenerator.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/MappedCharDataGenerator.java,v
1.1 2000/02/23 02:23:44 mandar Exp $
   * $Revision: 1.1 $
   * $Date: 2000/02/23 02:23:44 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.jasper.compiler;
  
  /**
   * CharDataGenerator generates the character data present in the JSP
   * file. Typically this is HTML which lands up as strings in
   * out.println(...).
   * 
   * This generator will print the HTML line-by-line. This is a
   * feature desired by lots of tool vendors.
   *
   * @author Mandar Raje
   */
  public class MappedCharDataGenerator 
      extends GeneratorBase
      implements ServiceMethodPhase
  {
      char[] chars;
      
      public MappedCharDataGenerator(char[] chars) {
  	this.chars = chars;
      }
  
      public void generate(ServletWriter writer, Class phase) {
  	writer.indent();
  	writer.print("out.write(\"");
  	// Generate the char data:
  	int limit       = chars.length;
  	StringBuffer sb = new StringBuffer();
  	for (int i = 0 ; i < limit ; i++) {
  	    int ch = chars[i];
  	    switch(ch) {
  	    case '"':
  		sb.append("\\\"");
  		break;
  	    case '\\':
  		sb.append("\\\\");
  		break;
  	    case '\r':
  		continue;
  		/*
  		  case '\'':
  		  sb.append('\\');
  		  sb.append('\'');
  		  break;
  		*/
  	    case '\n':
  		sb.append("\\r\\n");
  		writer.print(sb.toString());
  		writer.print("\");\n");
  		sb = new StringBuffer();
  		writer.indent();
  		writer.print("out.write(\"");
  		break;
  	    case '\t':
  		sb.append("\\t");
  		break;
  	    default:
  		sb.append((char) ch);
  	    }
  	}
  	writer.print(sb.toString());
  	writer.print("\");\n");
      }
  }
  
  
  
  1.13      +3 -1      jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- messages.properties	2000/02/14 06:15:11	1.12
  +++ messages.properties	2000/02/23 02:23:45	1.13
  @@ -102,7 +102,9 @@
   jsp.error.setproperty.paramOrValue=setProperty: either param or value can be present
   jsp.error.setproperty.arrayVal=setProperty: can't set array property {0} through a string
constant value
   jsp.warning.keepgen=Warning: Invalid value for the initParam keepgenerated. Will use the
default value of \"false\"
  -jsp.warning.largeFile=Warning: Invalid value for the initParam largeFile. Will use the
default value of \"true\"
  +jsp.warning.largeFile=Warning: Invalid value for the initParam
  +largeFile. Will use the default value of \"true\"
  +jsp.warning.mappedFile=Warning: Invalid value for the initParam mappedFile. Will use the
default value of \"false\"
   jsp.warning.sendErrToClient=Warning: Invalid value for the initParam sendErrToClient. Will
use the default value of \"false\"
   jsp.error.badtaglib=Unable to open taglibrary {0} : {1}
   jsp.error.badGetReader=Cannot create a reader when the stream is not buffered
  
  
  

Mime
View raw message