Observations on catalina logging

2001-05-27 Thread Ceki Gülcü



Hello,

In case catalina decides to use log4j as its logging API, here is a
series of observations.

1) Thanks to the separation of loaders, it is possible to keep
catalina logging separate from user (servlet) logging even of both
catalina and user servlets use log4j.

2) Logging code in catalina needs to modified to use log4j. The
existing concept of context logging can be replaced by categories.

3) Existing logging configuration instructions need to be converted to
log4j configuration files. Log4j currently supports config files in
XML or key=value (properties) format. As XML is a prerequisite for catalina, you'd 
probably want to use XML config files for log4j. 

4) In case a single category hierarchy does not provide sufficient
flexibility, it is possible to work with multiple category
hierarchies. Each hierarchy can be configured using a distinct
configuration file.

That's it for now. Best regards, Ceki


--
Ceki Gülcü




synchronize keyword may produce deadlocks.

2001-05-27 Thread yhs1634

Hi,
   The synchronize call may deadlock due to thread starvation. This is present
in all versions of java on all platforms i could test (jdk 1.1 thru 1.4b 
on win/sol/lin)
Example code for interlock.java is as follows :
import java.io.*;
import java.lang.*;
public class interlock{
public static int test=0; // 0 - test java synchronize. 1 - test java regular
private static boolean atomic_spinlock1=false;
private static boolean atomic_spinlock2=false; public interlock(){}
public static void main(String[] args) throws InterruptedException {
log(InterlockTest : If this code completes test was a success.); 
if(args.length==1){test=Integer.valueOf(args[0]).intValue();} 
new interlock().startup();} 
public static void log(String s){ System.err.println(+s); }
public static void blink(int 
i){try{Thread.currentThread().sleep(10+i);}catch(Exception 
e){}}
public static void spinlock1_rel(){atomic_spinlock1=false;}
public static boolean spinlock1_set(){ 
if (atomic_spinlock1==false) { atomic_spinlock1=true; return true; } else 
{ return false; } }
public static void spinlock2_rel(){atomic_spinlock2=false;}
public static boolean spinlock2_set(){ 
if (atomic_spinlock2==false) { atomic_spinlock2=true; return true; } else 
{ return false; } }
public static synchronized void s_spinlock1_rel(){atomic_spinlock1=false;}
public static synchronized boolean s_spinlock1_set(){ 
if (atomic_spinlock1==false) { atomic_spinlock1=true; return true; } else 
{ return false; } }
public static synchronized void s_spinlock2_rel(){atomic_spinlock2=false;}
public static synchronized boolean s_spinlock2_set(){ 
if (atomic_spinlock2==false) { atomic_spinlock2=true; return true; } else 
{ return false; } }
private void startup() { if (test==0) {log(Testing atomic spinlocks with 
Java Virtual Machine sync ); } 
else {log( Testing atomic spinlocks without Java Virtual Machine sync...);}
Runner y=new Runner(0);Runner s=new Runner(1); y.start();blink(100);s.start(); 
}
class Runner extends Thread implements Runnable{ private int runr=0;
Runner(int seq) { runr=seq; } public void run() { log( Started runner +runr+ 
-- );
log(runr+: Setting atomic spinlock 1...); 
if (test!=0){while(spinlock1_set()==false){}} else { while(s_spinlock2_set()==false){} 
} 
log(runr+: Set spinlock 1. Now sleeping... );
blink(1000); log(runr+: Finished sleeping. Now setting spinlock 2... (if 
bug exists it will hang here...) );
if (test!=0){while(spinlock2_set()==false){}} else { while(spinlock2_set()==false){} 
}
log(runr+: Spinlock 2 set. Now unsetting both spinlocks... );
if (test!=0){spinlock2_rel(); spinlock1_rel();}else{s_spinlock2_rel(); 
s_spinlock1_rel();}
log(runr+: Completed. );  }}  }

BTW, my email has changed. 
[EMAIL PROTECTED] -- [EMAIL PROTECTED]
Thanks.
-Ys-

Free, encrypted, secure Web-based email at www.hushmail.com


Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Jon Stevens

on 5/26/01 10:18 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 +// Called from MessageBytes.setTime
 +/** 
 + */
 +public static String format1123( Date d ) {
 +return rfc1123Format.format( d );
 +} 
 +
 +
 +// Called from ServerCookie
 +/** 
 + */
 +public static void formatOldCookie( Date d, StringBuffer sb,
 +  FieldPosition fp )
 +{
 +oldCookieFormat.format( d, sb, fp );
 +}
 +
 +// Called from ServerCookie
 +public static String formatOldCookie( Date d )
 +{
 +return oldCookieFormat.format( d );
  }

I thought we weren't using tab's in the files anymore...

-jon




Re: Taglibs Article

2001-05-27 Thread Jon Stevens

on 5/25/01 11:56 AM, Christopher Cain [EMAIL PROTECTED] wrote:

 Jakarta Taglibs was one of the featured articles in the JDC Newsletter
 this morning. Here is the address for those of you not subscribed to it:
 
 http://developer.java.sun.com/developer/technicalArticles/javaserverpages/Jaka
 rtaTaglibs/
 
 I'm guessing that you are now swinging your browser to that address so
 fast that it's getting motion sickness, right Jon? =)
 
 Now, I wonder if I could successfully rekindle a Velocity vs. JSP
 flamewar ... evil grin ... don't ask me, I'm strictly a servlet guy.
 Mixing business and presentation logic is exhilirating, kinda like
 running with scissors or jumping in the pool less than 30 minutes after
 a meal.
 
 - Christopher

It is a very good article (it covers the Jakarta project quite nicely) about
a really crappy technology. Oh wait, you already knew that. :-)

In case you missed it, Sun also did a Best Practices article on Velocity.

http://dcb.sun.com/practices/profiles/velocity.jsp

I find the .jsp suffix quite humorous myself.

-jon




Re: jsp compacter to be released

2001-05-27 Thread Jon Stevens

A better way to write this would be as a Servlet API 2.3 filter (assuming
they can work on an output stream...i forget...).

-jon

on 5/25/01 9:25 PM, Carlos Gaston Alvarez [EMAIL PROTECTED] wrote:

 Hi there,
 
   I have the jsp compacter running and now I am doing the documentation.
   It is a reader that compact the jsps. It can also compact html.
   It works by taking out the blank spaces of html and javascript. So a jsp
 like this
 
 html
  body
  !-- comment --
  script language=javascript
 !--
  alert( %= message % );
  --
   /script
  !-- result = %= result % --
  /body
 /html
 
 will become something like:
 
 htmlbodyscript language=javascript
 !--
 alert( %= message % );
 --
 /script!-- result = %= result % --/body/html
 
 My stimates is that it 'compacts' about a 10% ratio.
 
 My original idea was to integrate it with tomcat so at load time of the jsp
 file it compacts it so the source code is generated over 'compacted' code. I
 will do it, but it will take me some time. I have a plan of action.
 
 1 - release it as stand alone aplication.
 2 - release it as tag library.
 3 - integrate it with jasper.
 4 -  ¿¿include another language??
 
 Step one is done.
 
 Step two needs the tag code to be optimized (for not creating so many
 objects).
 
 Step three ... well I will need some guidance. Anyway, you should be accord.
 And of course, it should have configuration so you can turn it on only if
 you want to and in the files that you want it.
 
 Step four  ¿velocity?
 
 
 I was thinking of sending the source at the list, it is about 20K zipped.
 Please, I need a committer to tell me wath to do.
 
 Thanks in advance,
 
 Gaston
 


-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
http://jakarta.apache.org/velocity/ymtd/ymtd.html




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets HTMLManagerServlet.java ManagerServlet.java

2001-05-27 Thread bip

bip 01/05/27 14:09:11

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Added:   catalina/src/share/org/apache/catalina/servlets
HTMLManagerServlet.java
  Log:
  Changed ManagerServlet to allow for subclassing.
  
  Added HTMLManagerServlet which is a ManagerServlet with
  a extended HTML interface to allow for easier administration.
  
  Revision  ChangesPath
  1.6   +130 -128  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ManagerServlet.java   2001/05/14 00:02:32 1.5
  +++ ManagerServlet.java   2001/05/27 21:09:11 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.5 2001/05/14 00:02:32 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/05/14 00:02:32 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.6 2001/05/27 21:09:11 bip Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/05/27 21:09:11 $
*
* 
*
  @@ -152,10 +152,10 @@
* /ul
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/05/14 00:02:32 $
  + * @version $Revision: 1.6 $ $Date: 2001/05/27 21:09:11 $
*/
   
  -public final class ManagerServlet
  +public class ManagerServlet
   extends HttpServlet implements ContainerServlet {
   
   
  @@ -165,13 +165,13 @@
   /**
* The Context container associated with our web application.
*/
  -private Context context = null;
  +protected Context context = null;
   
   
   /**
* The debugging detail level for this servlet.
*/
  -private int debug = 1;
  +protected int debug = 1;
   
   
   /**
  @@ -179,20 +179,20 @@
* along with the associated Contexts for web applications that we
* are managing.
*/
  -private Deployer deployer = null;
  +protected Deployer deployer = null;
   
   
   /**
* The string manager for this package.
*/
  -private static StringManager sm =
  -  StringManager.getManager(Constants.Package);
  +protected static StringManager sm =
  + StringManager.getManager(Constants.Package);
   
   
   /**
* The Wrapper container associated with this servlet.
*/
  -private Wrapper wrapper = null;
  +protected Wrapper wrapper = null;
   
   
   // --- ContainerServlet Methods
  @@ -250,46 +250,46 @@
* @exception ServletException if a servlet-specified error occurs
*/
   public void doGet(HttpServletRequest request,
  -   HttpServletResponse response)
  - throws IOException, ServletException {
  +  HttpServletResponse response)
  +throws IOException, ServletException {
   
  - // Identify the request parameters that we need
  - String command = request.getPathInfo();
  - if (command == null)
  - command = request.getServletPath();
  - String path = request.getParameter(path);
  - String war = request.getParameter(war);
  -
  - // Prepare our output writer to generate the response message
  - response.setContentType(text/plain);
  - PrintWriter writer = response.getWriter();
  -
  - // Process the requested command
  - if (command == null) {
  - writer.println(sm.getString(managerServlet.noCommand));
  - } else if (command.equals(/install)) {
  - install(writer, path, war);
  - } else if (command.equals(/list)) {
  - list(writer);
  - } else if (command.equals(/reload)) {
  - reload(writer, path);
  - } else if (command.equals(/remove)) {
  - remove(writer, path);
  +// Identify the request parameters that we need
  +String command = request.getPathInfo();
  +if (command == null)
  +command = request.getServletPath();
  +String path = request.getParameter(path);
  +String war = request.getParameter(war);
  +
  +// Prepare our output writer to generate the response message
  +response.setContentType(text/plain);
  +PrintWriter writer = response.getWriter();
  +
  +// Process the requested command
  +if (command == null) {
  +writer.println(sm.getString(managerServlet.noCommand));
  +} else if (command.equals(/install)) {
  +install(writer, path, war);
  +} 

cvs commit: jakarta-tomcat-4.0/webapps/manager/WEB-INF web.xml

2001-05-27 Thread bip

bip 01/05/27 14:13:40

  Modified:webapps/manager/WEB-INF web.xml
  Log:
  Added a comment about HTMLManagerServlet
  
  Revision  ChangesPath
  1.2   +6 -1  jakarta-tomcat-4.0/webapps/manager/WEB-INF/web.xml
  
  Index: web.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/manager/WEB-INF/web.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- web.xml   2000/10/05 02:30:23 1.1
  +++ web.xml   2001/05/27 21:13:40 1.2
  @@ -6,7 +6,12 @@
   
   web-app
   
  -  !-- Define the Manager Servlet --
  +  !-- Define the Manager Servlet
  +   Change servlet-class to: org.apache.catalina.servlets.HTMLManagerServlet
  +   to get a Servlet with a more intuitive HTML interface, don't change if you
  +   have software that is expected to parse the output from ManagerServlet
  +   since they're not compatible.
  +   --
 servlet
   servlet-nameManager/servlet-name
   servlet-classorg.apache.catalina.servlets.ManagerServlet/servlet-class
  
  
  



form-based authentication tomcat-apache

2001-05-27 Thread Michael Jennings

Hi!

I've made a modification to the ApacheConfig module to enable the
mod_jk.conf-auto to include directives to enable form-based authentication.
Can someone with commit privilege commit this change?

Here's the cvs diff:


Index:
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
===
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/Ap
acheConfig.java,v
retrieving revision 1.9
diff -c -r1.9 ApacheConfig.java
***
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
2001/03/14 07:29:45 1.9
---
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
2001/05/27 22:11:35
***
*** 772,777 
--- 772,780 
  mod_jk.println(#);
  mod_jk.println(JkMount  + path +/servlet/*  +
JkMount[jkConnector]);
  mod_jk.println(JkMount  + path +/*.jsp  +
JkMount[jkConnector]);
+ mod_jk.println(# The following line mounts the
form-based authenticator for the +path+ context);
+ mod_jk.println(#);
+ mod_jk.println(JkMount  + path +/*j_security_check
 + JkMount[jkConnector]);


  // Deny serving any files from WEB-INF


__
Mike Jennings
Southgate  Software Ltd.
250-382-6851 (ph)
250-382-6800 (fax)
[EMAIL PROTECTED]




Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/bufDateTool.java

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Jon Stevens wrote:

 on 5/26/01 10:18 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  +{
  +return oldCookieFormat.format( d );
   }
 
 I thought we weren't using tab's in the files anymore...

We are using tabs AFAIK ( or at least I am using tabs and I don't
remember any vote or official rule that says this is not allowed ). 


Costin





cvs commit: jakarta-tomcat-jasper/jasper34/liaison - New directory

2001-05-27 Thread costin

costin  01/05/27 16:06:00

  jakarta-tomcat-jasper/jasper34/liaison - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/generator - New directory

2001-05-27 Thread costin

costin  01/05/27 16:06:04

  jakarta-tomcat-jasper/jasper34/generator - New directory



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java

2001-05-27 Thread costin

costin  01/05/27 16:11:08

  Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java
  Log:
  Fix from Michael Jennings for form-based login in apache
  The new connector will probably provide a better solution in ajp14, but
  this is a good fix we can do now.
  
  Submitted by: [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.10  +10 -2 
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
  
  Index: ApacheConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApacheConfig.java 2001/03/14 07:29:45 1.9
  +++ ApacheConfig.java 2001/05/27 23:11:07 1.10
  @@ -1,4 +1,4 @@
  -/* $Id: ApacheConfig.java,v 1.9 2001/03/14 07:29:45 larryi Exp $
  +/* $Id: ApacheConfig.java,v 1.10 2001/05/27 23:11:07 costin Exp $
* 
*
* The Apache Software License, Version 1.1
  @@ -112,7 +112,7 @@
   p
   @author Costin Manolache
   @author Mel Martinez
  - @version $Revision: 1.9 $ $Date: 2001/03/14 07:29:45 $
  + @version $Revision: 1.10 $ $Date: 2001/05/27 23:11:07 $
*/
   public class ApacheConfig  extends BaseInterceptor { 
   
  @@ -772,6 +772,14 @@
   mod_jk.println(#);
   mod_jk.println(JkMount  + path +/servlet/*  + 
JkMount[jkConnector]);
   mod_jk.println(JkMount  + path +/*.jsp  + 
JkMount[jkConnector]);
  + mod_jk.println(# The following line mounts the  +
  +form-based authenticator for the +
  +path+ context);
  + mod_jk.println(#);
  + mod_jk.println(JkMount  + path +
  +/*j_security_check +
  +JkMount[jkConnector]);
  +
   
   
   // Deny serving any files from WEB-INF
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/mappers DecodeInterceptor.java

2001-05-27 Thread costin

costin  01/05/27 16:14:24

  Modified:src/share/org/apache/tomcat/modules/mappers
DecodeInterceptor.java
  Log:
  Added 2 very common charset detection schemes.
  
  The most important is the per session charset - all browsers will use the
  same encoding for the posted data.
  
  Another common one is using an attribute in the request uri ( or parameter -
  this is not done yet ).
  
  Both will be disabled in the default config, but I think will be very
  usefull for anyone running sites with non 8859-1 charsets.
  
  More to come, please provide feedback.
  
  Revision  ChangesPath
  1.2   +97 -14
jakarta-tomcat/src/share/org/apache/tomcat/modules/mappers/DecodeInterceptor.java
  
  Index: DecodeInterceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/mappers/DecodeInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DecodeInterceptor.java2001/05/26 18:04:42 1.1
  +++ DecodeInterceptor.java2001/05/27 23:14:24 1.2
  @@ -71,8 +71,16 @@
* 
*/
   public class DecodeInterceptor extends  BaseInterceptor  {
  -String defaultEncoding=null;
  -private int encodingInfo;
  +private String defaultEncoding=null;
  +// debug, default will be false, null, null
  +private boolean useSessionEncoding=true; 
  +private String charsetAttribute=charset;
  +private String charsetURIAttribute=;charset=;
  +
  +// Note ids
  +private int encodingInfoNote;
  +private int sessionEncodingNote;
  +
   
   public DecodeInterceptor() {
   }
  @@ -86,26 +94,37 @@
   public void setDefaultEncoding( String s ) {
defaultEncoding=s;
   }
  +
  +public void setUseSessionEncoding( boolean b ) {
  + useSessionEncoding=b;
  +}
  +
  +public void setCharsetAttribute( String s ) {
  + charsetAttribute=s;
  + charsetURIAttribute=; + charsetAttribute + =;
  +}
   
   /*  Initialization  */
   
   public void engineInit( ContextManager cm )
throws TomcatException
   {
  - encodingInfo=cm.getNoteId(ContextManager.REQUEST_NOTE,
  + encodingInfoNote=cm.getNoteId(ContextManager.REQUEST_NOTE,
  req.encoding );
  + sessionEncodingNote=cm.getNoteId(ContextManager.SESSION_NOTE,
  +   session.encoding );
   }
   /*  Request mapping  */
   
   public int postReadRequest( Request req ) {
MessageBytes pathMB = req.requestURI();
// copy the request 
  -
  + 
if( pathMB.isNull())
throw new RuntimeException(ASSERT: null path in request URI);
   
  - //  if( path.indexOf(?) =0 )
  - //  throw new RuntimeException(ASSERT: ? in requestURI);
  + //if( path.indexOf(?) =0 )
  + //   throw new RuntimeException(ASSERT: ? in requestURI);

// Set the char encoding first
String charEncoding=null;   
  @@ -121,18 +140,44 @@
 charEncoding +   + contentTypeString  );
}
   
  - if( debug  11 ) dumpHeaders(headers);
  + if( debug  99 ) dumpHeaders(headers);

// No explicit encoding - try to guess it from Accept-Language
//MessageBytes acceptC= headers.getValue( Accept-Charset );
   
// No explicit encoding - try to guess it from Accept-Language
// MessageBytes acceptL= headers.getValue( Accept-Language );
  +
  + // Special trick: ;charset= attribute ( similar with sessionId )
  + // That's perfect for multibyte chars in URLs
  + if(charEncoding==null  charsetURIAttribute != null ) {
  + int idxCharset=req.requestURI().indexOf( charsetURIAttribute );
  + if( idxCharset = 0 ) {
  + String uri=req.requestURI().toString();
  + int nextAtt=uri.indexOf( ';', idxCharset + 1 );
  + String next=null;
  + if( nextAtt  0 ) {
  + next=uri.substring( nextAtt );
  + charEncoding=
  + uri.substring(idxCharset+
  +   charsetURIAttribute.length(),nextAtt);
  + req.requestURI().
  + setString(uri.substring(0, idxCharset) + next);
  + } else {
  + charEncoding=uri.substring(idxCharset+
  +charsetURIAttribute.length());
  + req.requestURI().
  + setString(uri.substring(0, idxCharset));
  + }
  + 
  + if( debug  0 )
  + log(ReqAtt=  + charEncoding +   +
  + req.requestURI() );
  + }
  + }

  - // Try per context default
  

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/http Parameters.java

2001-05-27 Thread costin

costin  01/05/27 16:16:20

  Modified:src/share/org/apache/tomcat/util/buf ByteChunk.java
   src/share/org/apache/tomcat/util/http Parameters.java
  Log:
  Removed the debug from Parameters.
  
  Added the indexOf() method in ByteChunk - it'll save the other 5-6 strings
  we allocated per request. ( the code is not in use right now ). We're
  close to zero allocations per simple request ( and soon parameter processing
  will also be very close to zero ).
  
  Revision  ChangesPath
  1.4   +20 -1 
jakarta-tomcat/src/share/org/apache/tomcat/util/buf/ByteChunk.java
  
  Index: ByteChunk.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/ByteChunk.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteChunk.java2001/05/26 17:17:01 1.3
  +++ ByteChunk.java2001/05/27 23:16:19 1.4
  @@ -560,6 +560,25 @@
}
return true;
   }
  +
  +public int indexOf( String src, int srcOff, int srcLen, int myOff ) {
  + char first=src.charAt( srcOff );
  +
  + // Look for first char 
  + int srcEnd=srcOff + srcLen;
  + 
  + for( int i=myOff; i end - srcLen ; i++ ) {
  + if( buff[i] != first ) continue;
  + // found first char, now look for a match
  + int myPos=i+1;
  + for( int srcPos=srcOff; srcPos srcEnd; ) {
  + if( buff[myPos++] != src.charAt( srcPos++ ))
  + break;
  + if( srcPos==srcEnd ) return i; // found it
  + }
  + }
  + return -1;
  +}
   
   //  Hash code  
   
  @@ -615,7 +634,7 @@
return -1;
   }
   
  -/** Find a character, no side effects.
  +/** Find a character, no side effects.
*  @returns index of char if found, -1 if not
*/
   public static int findChar( byte buf[], int start, int end, char c ) {
  
  
  
  1.13  +1 -1  
jakarta-tomcat/src/share/org/apache/tomcat/util/http/Parameters.java
  
  Index: Parameters.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/http/Parameters.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Parameters.java   2001/05/26 17:24:17 1.12
  +++ Parameters.java   2001/05/27 23:16:19 1.13
  @@ -480,7 +480,7 @@
return sb.toString();
   }
   
  -private static int debug=1;
  +private static int debug=0;
   private void log(String s ) {
System.out.println(Parameters:  + s );
   }
  
  
  



cvs commit: jakarta-tomcat-jasper/jasper34/generator/org - New directory

2001-05-27 Thread costin

costin  01/05/27 16:16:35

  jakarta-tomcat-jasper/jasper34/generator/org - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34 - New directory

2001-05-27 Thread costin

costin  01/05/27 16:16:41

  jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34 - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core - New directory

2001-05-27 Thread costin

costin  01/05/27 16:16:51

  jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core - New directory



cvs commit: jakarta-tomcat-jasper/lib - New directory

2001-05-27 Thread costin

costin  01/05/27 16:23:30

  jakarta-tomcat-jasper/lib - New directory



cvs commit: jakarta-tomcat-jasper/lib servlet.jar tomcat_core.jar tomcat_util.jar

2001-05-27 Thread costin

costin  01/05/27 16:27:35

  Added:   lib  servlet.jar tomcat_core.jar tomcat_util.jar
  Log:
  For easy compilation - added the binaries jasper34 depends on.
  
  The tomcat_util.jar is also used ( in part ) by the connector. In time
  we'll migrate it to commons ( or keep it in jakarta-tomcat-connectors ).
  As we are refactoring the code in jasper it will be replaced with
  pluggable interfaces - but I don't think it's a priority for now.
  
  We can assume we'll use some generic utils ( at least the pools ) - and
  importing the code in jasper will not help.
  
  tomcat-core is imported to build the 3.3 specific module - will go away
  after we improve the build.xml.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-jasper/lib/servlet.jar
  
Binary file
  
  
  1.1  jakarta-tomcat-jasper/lib/tomcat_core.jar
  
Binary file
  
  
  1.1  jakarta-tomcat-jasper/lib/tomcat_util.jar
  
Binary file
  
  



cvs commit: jakarta-tomcat-jasper/jasper34 build.xml

2001-05-27 Thread costin

costin  01/05/27 16:29:36

  Added:   jasper34 build.xml
  Log:
  Initial build file.
  
  It'll generate 3 jars: jasper_runtime.jar will be visible in the
  webapp classloader and included in WEB-INF/lib for jspc processed
  apps.
  
  jasper.jar is the code generator ( it'll be an executable jar, using jspc as
  main class )
  
  jasper_liaison.jar will contain the servlet and container-specific liaison
  classes.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-jasper/jasper34/build.xml
  
  Index: build.xml
  ===
  project name=jasper34 default=main basedir=.
   
property name=optimize value=false/
property name=debug value=on/
  
property name=jakarta-tomcat-jasper location=.. /

property name=build.dir 
location=${jakarta-tomcat-jasper}/build /
  
property name=jasper34.src 
location=${jakarta-tomcat-jasper}/jasper34 /
  
property name=tomcat.home 
location=${jakarta-tomcat-jasper}/../jakarta-tomcat/build/tomcat /
  
property name=servlet22.jar 
location=${jakarta-tomcat-jasper}/lib/servlet.jar /
  
!-- we'll use the common utils - or even better the connector, 
 since we'll want to take advantage of it --
property name=tomcat_util.jar 
location=${jakarta-tomcat-jasper}/lib/tomcat_util.jar /
  
!-- used to compile tomcat33 liaison --
property name=tomcat_core.jar 
location=${jakarta-tomcat-jasper}/lib/tomcat_core.jar /
  
!-- For later use ( while merging with catalina ) --
property name=servlet23.jar 
location=${jakarta-tomcat-jasper}/lib/servlet23.jar /
property name=catalina.jar 
location=${jakarta-tomcat-jasper}/lib/catalina.jar /
  
  
!--   --
  
target name=prepare 
  description=Prepare the build dir, copy static files
  mkdir dir=${build.dir} /
  mkdir dir=${build.dir}/classes /
/target
  
target name=runtime 
  description=Build the runtime 
  javac destdir=${build.dir}/classes
   debug=${debug} 
   optimize=${optimize} 
   srcdir=${jasper34.src}/runtime
   deprecation=off 
classpath
pathelement location=${servlet22.jar} /
pathelement location=${tomcat_util.jar} /
/classpath
include name=**/
  /javac
  
  copy todir=${build.dir}/classes/org/apache/jasper34
fileset dir=${jasper34.src}/runtime/org/apache/jasper34
include name=**/*.properties/
include name=**/*.dtd/
/fileset
  /copy
  
  jar jarfile=${build.dir}/jasper34_runtime.jar 
 basedir=${build.dir}/classes 
include name=org/apache/jasper34/runtime/**/
  /jar
/target
  
target name=generator 
  description=Generator using JSP1.1
  javac destdir=${build.dir}/classes
   debug=${debug} 
   optimize=${optimize} 
   srcdir=${jasper34.src}/generator
   deprecation=off 
classpath
pathelement location=${servlet22.jar} /
pathelement location=${tomcat_util.jar} /
pathelement location=${build.dir}/jasper34_runtime.jar /
/classpath
include name=**/
  /javac
  
  copy todir=${build.dir}/classes/org/apache/jasper34
fileset dir=${jasper34.src}/generator/org/apache/jasper34
include name=**/*.properties/
include name=**/*.dtd/
/fileset
  /copy
  
  jar jarfile=${build.dir}/jasper34.jar 
 basedir=${build.dir}/classes 
include name=org/apache/jasper34/generator/**/
include name=org/apache/jasper34/core/**/
include name=org/apache/jasper34/resources/**/
  /jar
/target
  
!-- XXX detect if tomcat33, tomcat40 is available, build the adapters
only as result of detection --
  
target name=liaison 
  description=Adapters for different containers
  javac destdir=${build.dir}/classes
   debug=${debug} 
   optimize=${optimize} 
   srcdir=${jasper34.src}/generator
   deprecation=off 
classpath
pathelement location=${servlet22.jar} /
pathelement location=${tomcat_util.jar} /
pathelement location=${tomcat_core.jar} /
pathelement location=${catalina.jar} /
/classpath
include name=**/
  /javac
  
  copy todir=${build.dir}/classes/org/apache/jasper34
fileset dir=${jasper34.src}/liaison/org/apache/jasper34
include name=**/*.properties/
include name=**/*.dtd/
/fileset
  /copy
  
  jar jarfile=${build.dir}/jasper34_liaison.jar 
 basedir=${build.dir}/classes 
include name=org/apache/jasper34/servlet/**/
include name=org/apache/jasper34/tomcat33/**/
  /jar
  
/target
  
target name=main 

cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org - New directory

2001-05-27 Thread costin

costin  01/05/27 16:29:51

  jakarta-tomcat-jasper/jasper34/liaison/org - New directory



Re: form-based authentication tomcat-apache

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Michael Jennings wrote:

 Hi!
 
 I've made a modification to the ApacheConfig module to enable the
 mod_jk.conf-auto to include directives to enable form-based authentication.
 Can someone with commit privilege commit this change?

Done, thanks.

Costin

 
 Here's the cvs diff:
 
 
 Index:
 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
 ===
 RCS file:
 /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/Ap
 acheConfig.java,v
 retrieving revision 1.9
 diff -c -r1.9 ApacheConfig.java
 ***
 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
 2001/03/14 07:29:45 1.9
 ---
 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
 2001/05/27 22:11:35
 ***
 *** 772,777 
 --- 772,780 
   mod_jk.println(#);
   mod_jk.println(JkMount  + path +/servlet/*  +
 JkMount[jkConnector]);
   mod_jk.println(JkMount  + path +/*.jsp  +
 JkMount[jkConnector]);
 + mod_jk.println(# The following line mounts the
 form-based authenticator for the +path+ context);
 + mod_jk.println(#);
 + mod_jk.println(JkMount  + path +/*j_security_check
  + JkMount[jkConnector]);
 
 
   // Deny serving any files from WEB-INF
 
 
 __
 Mike Jennings
 Southgate  Software Ltd.
 250-382-6851 (ph)
 250-382-6800 (fax)
 [EMAIL PROTECTED]
 




Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/bufDateTool.java

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Jon Stevens wrote:

 on 5/27/01 4:01 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  We are using tabs AFAIK ( or at least I am using tabs and I don't
  remember any vote or official rule that says this is not allowed ).
  
  
  Costin
 
 http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg08150.html

http://jakarta.apache.org/site/source.html


Costin




Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Jon Stevens

on 5/27/01 5:04 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 http://jakarta.apache.org/site/source.html
 
 
 Costin

Costin, you are being stupid (again).

However, some projects may decide to override these defaults and use their
own defined conventions.

-jon




Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/bufDateTool.java

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Jon Stevens wrote:

 on 5/27/01 5:04 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  http://jakarta.apache.org/site/source.html
  
  
  Costin
 
 Costin, you are being stupid (again).
 
 However, some projects may decide to override these defaults and use their
 own defined conventions.

Yes, and tomcat hasn't decided that AFAIK. I'm monitoring the votes quite
closely now ( unless the PMC made such a decision for us, or the ASF )

Jon, try to write more code and less mail. Leave mail to people who can
behave. 

Costin





Re: Vacation

2001-05-27 Thread kevin seguin

 
 Regarding the connector - sorry I didn't had more time to spend on it, but
 I'll be able to help more after I'll be back. I plan to do a
 re-implementation of the java side of Ajp13/14, and also to do some
 optimizations on the JNI side, and I'll try to help with the config stuff
 ( if Henri doesn't finish it before I get a chance to help :-) If someone
 could import the new buffer stuff - it would be great.
 

so it's safe to assume the changes to all the buffer stuff
(org.apache.tomcat.util.buf) is pretty much done in 3.3?  if so, i'll
take that stuff and overlay what's in jakarta-tomcat-connectors/util
with it.  i have been kind of watching and waiting to see when a good
time to do this would be.

thanks :)

-kevin.



Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Jon Stevens

on 5/27/01 5:25 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Jon, try to write more code and less mail.

Once again, you completely miss the point Costin.

Your code isn't any good if people can't read the diff's that go into CVS
because they don't format correctly in email clients because of the tab's.

-jon




Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/bufDateTool.java

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Jon Stevens wrote:

 on 5/27/01 5:25 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  Jon, try to write more code and less mail.
 
 Once again, you completely miss the point Costin.

I guess you completely miss the point - calling people stupid and behaving
the way you typically do may be fine in some places, but it's not
on an apache mailing list. 


 Your code isn't any good if people can't read the diff's that go into CVS
 because they don't format correctly in email clients because of the tab's.

It's a matter of principle here - the fact that some mail clients or
editors chose to ignore standards and common practices doesn't mean the
standard itself is bad and shouldn't be used.


Costin




Re: Vacation

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, kevin seguin wrote:

  
  Regarding the connector - sorry I didn't had more time to spend on it, but
  I'll be able to help more after I'll be back. I plan to do a
  re-implementation of the java side of Ajp13/14, and also to do some
  optimizations on the JNI side, and I'll try to help with the config stuff
  ( if Henri doesn't finish it before I get a chance to help :-) If someone
  could import the new buffer stuff - it would be great.
  
 
 so it's safe to assume the changes to all the buffer stuff
 (org.apache.tomcat.util.buf) is pretty much done in 3.3?  if so, i'll
 take that stuff and overlay what's in jakarta-tomcat-connectors/util
 with it.  i have been kind of watching and waiting to see when a good
 time to do this would be.

I'm not sure - we'll still have a number of bug fixes and probably few
small improvements.

The buffers do belong to jakarta-tomcat-connectors/util, and in a perfect
world we wouldn't have them duplicated - 3.3 should only use what's in
connectors. 

I wouldn't mind making tomcat-connectors/util the master source for the
buffer stuff, but it needs some changes in the build scripts. I'm not sure
how other people would feel about this - we are very close to 3.3beta. 


Costin






Re: Issues with Tomcat 3.2.1, JSPs and I18N ( Implicit charactertran slation ??? )

2001-05-27 Thread cmanolache

Hi Chris,

Can you reproduce this in normal JSP ( without oracle ) ? Can you send me
a small webapp where I can reproduce it ? Does it happens in 3.3 too ? 

I am trying to solve (most) I18N bugs and problems for 3.3, it's very
tricky but can be done :-) 


Costin 



On Fri, 25 May 2001, Chris Halverson wrote:

 I'm running Tomcat 3.2.1 on a Solaris box JDK 1.3
 and using ECS1.4.1 for generating HTML
 
 I can save CJKV characters to my back end Oracle db, retrieve them,
 and display them if I'm using a servlet.  Doesn't matter whether I use ECS
 or string handling.  The browser recognizes that I'm sending in UTF-8
 encoding
 and handles the characters just fine.
 
 However when I use the same code to get the data from the DB and run it 
 through a JSP page I get gobbledygook.
 
 A couple of other factors
 1.  Yes I'm setting the contentType to text/html; charset=UTF-8 in the
 Page Directiive
 2.  Yes the browser is set to use the UTF-8 encoding.
 2.  Yes I realize that the jsps are compiled into a servlet but while
 looking at the jsp compiled java src file
  it appears that the servlet uses a specialized class JspWriter to
 handle printing to the output stream.
 3.  ECS had a similar issue in previous versions.  There are some tricky
 issues with how streams are handled
  so that you don't run into implicit and screwy character encoding
 issues.
 
 I would appreciate any feedback, I'm going to dig through the Tomcat source
 to see if I can find the root problem
 and would hate to do that if there was an easy answer that I'm missing.
 
 Thanks.
 Chris Halverson
 
 Christopher R. Halverson
 nCube
 [EMAIL PROTECTED]
 Never underestimate the ability of any human to delude themselves,
 and convince others their delusion is absolute
 
 
 




Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Jon Stevens

on 5/27/01 5:54 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 It's a matter of principle here - the fact that some mail clients or
 editors chose to ignore standards and common practices doesn't mean the
 standard itself is bad and shouldn't be used.
 
 Costin

Making developers jump through hoops (such as using a particular mail
client) in order to participate in Tomcat development is not good for the
project.

Also, this has nothing to do with standards. People should be able to
choose whatever font they want to read their email.

-jon




Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/bufDateTool.java

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, Jon Stevens wrote:

 on 5/27/01 5:54 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  It's a matter of principle here - the fact that some mail clients or
  editors chose to ignore standards and common practices doesn't mean the
  standard itself is bad and shouldn't be used.
  
  Costin
 
 Making developers jump through hoops (such as using a particular mail
 client) in order to participate in Tomcat development is not good for the
 project.
 
 Also, this has nothing to do with standards. People should be able to
 choose whatever font they want to read their email.

It has all to do with standards. Tabs have been used for indentation for
at least the last 15 years ( that's when I started playing with computers-
and the tab was there ).

A program to display a simple fixed-font text with tabs is quite trivial
- and it's not jumping through hoops. 

I guess that's enough talking with someone who calls me stupid, need to
check my mail filters now. 

Costin




Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Jon Stevens

on 5/27/01 6:45 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 It has all to do with standards. Tabs have been used for indentation for
 at least the last 15 years ( that's when I started playing with computers-
 and the tab was there ).

Great! I have you beat. I started creating software when I was 9 and now I'm
28. So there.

 A program to display a simple fixed-font text with tabs is quite trivial
 - and it's not jumping through hoops.

A program that can deal with using spaces instead of tabs in the source
files is quite trivial.

-jon




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/qlog FastDateFormat.java

2001-05-27 Thread costin

costin  01/05/27 19:09:55

  Modified:src/share/org/apache/tomcat/util/qlog FastDateFormat.java
  Log:
  Roll back the previous change - problems if you compile with 1.4 and
  run with 1.3
  
  Revision  ChangesPath
  1.3   +5 -1  
jakarta-tomcat/src/share/org/apache/tomcat/util/qlog/FastDateFormat.java
  
  Index: FastDateFormat.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/qlog/FastDateFormat.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FastDateFormat.java   2001/05/26 17:28:55 1.2
  +++ FastDateFormat.java   2001/05/28 02:09:55 1.3
  @@ -123,8 +123,12 @@
sb.setCharAt(--pos, Character.forDigit(ms % 10, 10));
}
   }
  - toAppendTo.append(sb); // StringBuffer will call toString internally,
  + toAppendTo.append(sb.toString());
  + // StringBuffer will call toString internally,
// except for 1.4 where append(SB) is defined - one more object saved
  + // Bad if you compile with 1.4 - it'll no longer work on 1.2, so
  + // toString will be used ( this can be optimized using the buffers
  + // directly )
return toAppendTo;
   }
   
  
  
  



cvs commit: jakarta-tomcat-jasper/lib tomcat_core.jar

2001-05-27 Thread costin

costin  01/05/27 19:16:14

  Removed: lib  tomcat_core.jar
  Log:
  Removed tomcat_core.jar, that's stupid. We can just point to a valid
  tomcat installation ( and detect if it's there ).
  
  ( I'll keep servlet.jar and tomcat_utils.jar - those are needed for
  runtime and generator, but the liaison can detect the env )



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache - New directory

2001-05-27 Thread costin

costin  01/05/27 19:16:43

  jakarta-tomcat-jasper/jasper34/liaison/org/apache - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34 - New directory

2001-05-27 Thread costin

costin  01/05/27 19:16:46

  jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34 - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/servlet - New directory

2001-05-27 Thread costin

costin  01/05/27 19:16:54

  jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/servlet - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/tomcat33 - New directory

2001-05-27 Thread costin

costin  01/05/27 19:16:58

  jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/tomcat33 - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/cli - New directory

2001-05-27 Thread costin

costin  01/05/27 19:17:01

  jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/cli - New directory



cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/servlet EmbededServletOptions.java JasperLoader.java JasperLoader12.java JspEngineContext.java JspLoader.java JspServlet.java ServletEngine.java TomcatServletEngine.java

2001-05-27 Thread costin

costin  01/05/27 19:17:58

  Added:   jasper34/liaison/org/apache/jasper34/servlet
EmbededServletOptions.java JasperLoader.java
JasperLoader12.java JspEngineContext.java
JspLoader.java JspServlet.java ServletEngine.java
TomcatServletEngine.java
  Log:
  Added the (old) servlet interface.
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/servlet/EmbededServletOptions.java
  
  Index: EmbededServletOptions.java
  ===
  /*
   * 
   * 
   * 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 [EMAIL PROTECTED]
   *
   * 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.jasper34.servlet;
  
  import java.io.File;
  
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletContext;
  
  import org.apache.jasper34.core.*;
  
  import org.apache.tomcat.util.log.*;
  
  /**
   * A class to hold all init parameters specific to the JSP engine. 
   *
   * @author Anil K. Vijendran
   * @author Hans Bergsten
   */
  public final class EmbededServletOptions implements Options {
  /**
   * Do you want to keep the generated Java files around?
   */
  public boolean keepGenerated = true;
  
  /**
   * Do you want support for large files? What this essentially
   * means is that we generated code so that the HTML data in a JSP
   * file is stored separately as opposed to those constant string
   * 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
   * error or a log file if the standard error is redirected. 
   */
  public boolean sendErrorToClient = false;
  
  /**
   * Do we want to include debugging information in the class file?
   */
  public boolean classDebugInfo = 

cvs commit: jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/tomcat33 JasperEngineContext.java JasperOptionsImpl.java JspInterceptor.java

2001-05-27 Thread costin

costin  01/05/27 19:18:59

  Added:   jasper34/liaison/org/apache/jasper34/tomcat33
JasperEngineContext.java JasperOptionsImpl.java
JspInterceptor.java
  Log:
  Added tomcat33 specific interface ( will be compiled only if 33 is detected).
  
  This is few times faster than the servlet and the default for 3.3.
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-jasper/jasper34/liaison/org/apache/jasper34/tomcat33/JasperEngineContext.java
  
  Index: JasperEngineContext.java
  ===
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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.jasper34.tomcat33;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  import org.apache.jasper34.generator.*;
  import org.apache.jasper34.generator.Compiler;
  import org.apache.jasper34.core.*;
  import org.apache.jasper34.runtime.*;
  
  import java.util.*;
  import java.io.*;
  import java.net.*;
  
  //import org.apache.jasper.JspCompilationContext;
  
  /** Alternative implementation of JspCompilationContext ( in addition
  to the servlet and standalone ). Used by JspInterceptor - but
  it's in no way specific to tomcat.
  */
  public class JasperEngineContext implements JspCompilationContext {
  JspReader reader;
  ServletWriter writer;
  ServletContext context;
  ClassLoader loader;
  boolean isErrPage;
  String jspFile;
  String servletClassName;
  String servletPackageName;
  String servletJavaFileName;
  String contentType;
  Options options;
  
  String cpath;// for compiling JSPs.
  ServletContext sctx;
  String outputDir;
  
  public JasperEngineContext()
  {
  }
  
  public void setClassPath( String s ) {
cpath=s;
  }
  
  /**
   * The classpath that is passed off to the Java compiler. 
   */
  public String getClassPath() {
return cpath;
  }
  
  /**
   * Get the input reader for the JSP text. 
   */
  public JspReader getReader() {
if( debug0 ) log(getReader  + reader );
  return reader;
  }
  
  /**
   * Where is the servlet being generated?
   */
  public ServletWriter getWriter() {
if( debug0 ) log(getWriter  + writer );
   

cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator JspParseEventListener.java

2001-05-27 Thread costin

costin  01/05/27 19:19:31

  Modified:jasper34/generator/org/apache/jasper34/core Constants.java
   jasper34/generator/org/apache/jasper34/generator
JspParseEventListener.java
  Log:
  Fix to generate code for the right runtime.
  
  Revision  ChangesPath
  1.2   +1 -1  
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core/Constants.java
  
  Index: Constants.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core/Constants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Constants.java2001/05/27 23:23:16 1.1
  +++ Constants.java2001/05/28 02:19:30 1.2
  @@ -72,7 +72,7 @@
*/
   public class Constants {
   public static String JSP_RUNTIME_PACKAGE =
  - org.apache.jasper.runtime;
  + org.apache.jasper34.runtime;
   
   /**
* The base class of the generated servlets. 
  
  
  
  1.2   +2 -1  
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/JspParseEventListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JspParseEventListener.java2001/05/27 23:19:31 1.1
  +++ JspParseEventListener.java2001/05/28 02:19:30 1.2
  @@ -276,7 +276,8 @@
   writer.println(private boolean _jspx_inited = false;);
   writer.println();
   
  -writer.println(public final synchronized void _jspx_init() throws 
JasperException {);
  +writer.println(public final synchronized void _jspx_init() throws  +
  +Constants.JSP_RUNTIME_PACKAGE + .JasperException {);
   writer.pushIndent();
   writer.println(if (! _jspx_inited) {);
   writer.pushIndent();
  
  
  



cvs commit: jakarta-tomcat-jasper/jasper34 build.xml

2001-05-27 Thread costin

costin  01/05/27 19:20:42

  Modified:jasper34 build.xml
  Log:
  Fix to take tomcat from the right directory.
  
  Added code to install ( replace ) the current jasper from tc.
  
  Revision  ChangesPath
  1.2   +28 -7 jakarta-tomcat-jasper/jasper34/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper34/build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.xml 2001/05/27 23:29:36 1.1
  +++ build.xml 2001/05/28 02:20:42 1.2
  @@ -12,8 +12,11 @@
location=${jakarta-tomcat-jasper}/jasper34 /
   
 property name=tomcat.home 
  - location=${jakarta-tomcat-jasper}/../jakarta-tomcat/build/tomcat /
  +  location=${jakarta-tomcat-jasper}/../jakarta-tomcat/build/tomcat /
   
  +  property name=catalina.home 
  +location=${jakarta-tomcat-jasper}/../jakarta-tomcat-4.0/build/catalina /
  +
 property name=servlet22.jar 
location=${jakarta-tomcat-jasper}/lib/servlet.jar /
   
  @@ -22,10 +25,6 @@
 property name=tomcat_util.jar 
location=${jakarta-tomcat-jasper}/lib/tomcat_util.jar /
   
  -  !-- used to compile tomcat33 liaison --
  -  property name=tomcat_core.jar 
  - location=${jakarta-tomcat-jasper}/lib/tomcat_core.jar /
  -
 !-- For later use ( while merging with catalina ) --
 property name=servlet23.jar 
location=${jakarta-tomcat-jasper}/lib/servlet23.jar /
  @@ -103,18 +102,25 @@
   
 target name=liaison 
  description=Adapters for different containers
  +available classpath=${tomcat.home}/lib/common/tomcat_core.jar 
  +classname=org.apache.tomcat.core.BaseInterceptor 
  +property=tomcat33
  +/
  +echo message=XXX ${tomcat33} ${tomcat.home}/lib/common/tomcat_core.jar/
   javac destdir=${build.dir}/classes
   debug=${debug} 
   optimize=${optimize} 
  -srcdir=${jasper34.src}/generator
  +srcdir=${jasper34.src}/liaison
   deprecation=off 
 classpath
pathelement location=${servlet22.jar} /
pathelement location=${tomcat_util.jar} /
  - pathelement location=${tomcat_core.jar} /
  + pathelement location=${tomcat.home}/lib/common/tomcat_core.jar /
  + pathelement location=${tomcat.home}/lib/container/facade22.jar /
pathelement location=${catalina.jar} /
 /classpath
 include name=**/
  +  exclude name=**/JasperInterceptor** unless=${tomcat33}/
   /javac
   
   copy todir=${build.dir}/classes/org/apache/jasper34
  @@ -133,6 +139,21 @@
 /target
   
 target name=main depends=prepare,runtime,generator,liaison/
  +
  +  target name=install depends=main 
  +copy file=${build.dir}/jasper34_liaison.jar 
  +   todir=${tomcat.home}/lib/container /
  +copy file=${build.dir}/jasper34.jar 
  +   todir=${tomcat.home}/lib/container /
  +copy file=${build.dir}/jasper34_runtime.jar 
  +   todir=${tomcat.home}/lib/common /
  +
  +!-- Easiest way to plug the new module --
  +replace file=${tomcat.home}/conf/modules.xml 
  +  token=org.apache.tomcat.facade.JspInterceptor 
  +  value=org.apache.jasper34.tomcat33.JspInterceptor
  +  /
  +  /target
   
 target name=clean 
   delete dir=${build.dir}/
  
  
  



Re: Vacation

2001-05-27 Thread kevin seguin

 
 The buffers do belong to jakarta-tomcat-connectors/util, and in a perfect
 world we wouldn't have them duplicated - 3.3 should only use what's in
 connectors.
 
 I wouldn't mind making tomcat-connectors/util the master source for the
 buffer stuff, but it needs some changes in the build scripts. I'm not sure
 how other people would feel about this - we are very close to 3.3beta.
 

it would be great to have the buffer code in one place, but, i've never
really been comfortable with jakarta-tomcat-connectors/util being that
place.  it would make more sense to me to have something like
jakarta-tomcat-util, where common utility code like the buffers stuff
could live.  jtc should be just for connectors.

if people don't want a whole new module for utility code, then i suppose
jtc is the next best place...

-kevin.



Jasper34

2001-05-27 Thread cmanolache

Hi,

I finished the initial commit, and ( a bit surprising ) it worked from the 
first attempt... Not bad.

To try it out:
- get jakarta-tomcat
- build it
- get jakarta-tomcat-jasper
- build it with ant install

That will copy the jasper jars and fix the tomcat config ( replacing the
module class for JspInterceptor ).

Of course, expect some bugs - but the code is almost identical right now. 

The biggest change is the cleaner separation between
(some) components. More important is that it works, and can provide
feedback and be used ( I expect it to be quite stable and solid - moving
code around and refactoring doesn't hurt too much ).


Costin







Re: Vacation

2001-05-27 Thread cmanolache

On Sun, 27 May 2001, kevin seguin wrote:

  The buffers do belong to jakarta-tomcat-connectors/util, and in a perfect
  world we wouldn't have them duplicated - 3.3 should only use what's in
  connectors.
  
  I wouldn't mind making tomcat-connectors/util the master source for the
  buffer stuff, but it needs some changes in the build scripts. I'm not sure
  how other people would feel about this - we are very close to 3.3beta.
  
 
 it would be great to have the buffer code in one place, but, i've never
 really been comfortable with jakarta-tomcat-connectors/util being that
 place.  it would make more sense to me to have something like
 jakarta-tomcat-util, where common utility code like the buffers stuff
 could live.  jtc should be just for connectors.
 
 if people don't want a whole new module for utility code, then i suppose
 jtc is the next best place...

I agree - it may even be the best place. It's very low-level code, it must
be part of and integrated in the connector - and upper levels should use
it. 

Most of the performance comes from the lower level, the protocol and the
connector implementation is going to be critical - and having control over
the low-level representation is very important.

The only problem is that right now ( with 3.3 so close ) we may have to
keep them in sync. But we can try ( if Larry is ok with that ) to change
the build scripts and use a single copy - in jtc.

Costin






cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/javacompiler - New directory

2001-05-27 Thread costin

costin  01/05/27 19:58:22

  jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/javacompiler - New 
directory



cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator Compiler.java ClassName.java JasperMangler.java JavaCompiler.java JikesJavaCompiler.java JspCompiler.java SunJavaCompiler.java

2001-05-27 Thread costin

costin  01/05/27 20:00:18

  Modified:jasper34/generator/org/apache/jasper34/generator
Compiler.java
  Removed: jasper34/generator/org/apache/jasper34/generator
ClassName.java JasperMangler.java JavaCompiler.java
JikesJavaCompiler.java JspCompiler.java
SunJavaCompiler.java
  Log:
  Few more file moves.
  
  The old mangling scheme is specific to the old servlet, no need to keep it
  in the generator.
  
  I expect a full rewrite of the servlet, and maybe use of standard URLClasLoader
  and normal file names ( I think Glenn mentioned it's already done in 4.0,
  so we just need to merge the code ).
  
  Revision  ChangesPath
  1.2   +4 -4  
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/Compiler.java
  
  Index: Compiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/Compiler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Compiler.java 2001/05/27 23:19:30 1.1
  +++ Compiler.java 2001/05/28 03:00:17 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/Compiler.java,v
 1.1 2001/05/27 23:19:30 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/05/27 23:19:30 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/generator/Compiler.java,v
 1.2 2001/05/28 03:00:17 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/05/28 03:00:17 $
*
* 
* 
  @@ -70,7 +70,7 @@
   
   import org.apache.jasper34.core.*;
   import org.apache.jasper34.runtime.JasperException;
  -import org.apache.jasper34.core.*;
  +import org.apache.jasper34.javacompiler.*;
   //import org.apache.jasper.compiler.ParseException;
   
   import org.apache.tomcat.util.log.*;
  
  
  



cvs commit: jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/javacompiler JavaCompiler.java JikesJavaCompiler.java SunJavaCompiler.java

2001-05-27 Thread costin

costin  01/05/27 20:01:20

  Added:   jasper34/generator/org/apache/jasper34/javacompiler
JavaCompiler.java JikesJavaCompiler.java
SunJavaCompiler.java
  Log:
  The javac part.
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/javacompiler/JavaCompiler.java
  
  Index: JavaCompiler.java
  ===
  /*
   * 
   * 
   * 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 [EMAIL PROTECTED]
   *
   * 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.jasper34.javacompiler;
  
  import java.io.OutputStream;
  
  /**
   * If you want to plugin your own Java compiler, you probably want to
   * write a class that implements this interface. 
   *
   * @author Anil K. Vijendran
   * @author Sam Ruby
   */
  public interface JavaCompiler {
  
  /**
   * Specify where the compiler can be found
   */ 
  void setCompilerPath(String compilerPath);
  
  /**
   * Set the encoding (character set) of the source
   */ 
  void setEncoding(String encoding);
  
  /**
   * Set the class path for the compiler
   */ 
  void setClasspath(String classpath);
  
  /**
   * Set the output directory
   */ 
  void setOutputDir(String outdir);
  
  /**
   * Set where you want the compiler output (messages) to go 
   */ 
  void setMsgOutput(OutputStream out);
  
  /**
   * Set if you want debugging information in the class file 
   */ 
  void setClassDebugInfo(boolean classDebugInfo);
  
  /**
   * Execute the compiler
   * @param source - file name of the source to be compiled
   */ 
  boolean compile(String source);
  
  }
  
  
  
  
  1.1  
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/javacompiler/JikesJavaCompiler.java
  
  Index: JikesJavaCompiler.java
  ===
  /*
   * 
   *
   * 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 

Re: cvs commit:jakarta-tomcat/src/share/org/apache/tomcat/util/buf DateTool.java

2001-05-27 Thread Remy Maucherat

 [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote:
 
  It has all to do with standards. Tabs have been used for indentation
for
  at least the last 15 years ( that's when I started playing with
computers-
  and the tab was there ).

 But the point is that we're using SPACES... Since _EVER_... Discussion
 closed.

I really doubt you guys have been using spaces everywhere since JServ. Look
at Craig's source for JServ 2 (err, I mean, Catalina) : there are tabs
everywhere ;)

Frankly, I don't think we should make a big deal of the whole issue.

Remy




cvs commit: jakarta-tomcat-jasper/jasper34/runtime/org/apache/jasper34/runtime JspRuntimeLibrary.java

2001-05-27 Thread costin

costin  01/05/27 22:07:37

  Modified:jasper34/runtime/org/apache/jasper34/runtime
JspRuntimeLibrary.java
  Log:
  Quick optimization for jsp:get/setProperty. Method lookup result
  is cached, as it is the most expensive part of method invocation.
  
  This can be quite easily put back into 3.3 - but I don't think it's
  a good idea: we'll have more tunnings and it'll save time to keep
  33 stable and just replace the whole thing when it has had enough testing.
  
  Revision  ChangesPath
  1.2   +37 -6 
jakarta-tomcat-jasper/jasper34/runtime/org/apache/jasper34/runtime/JspRuntimeLibrary.java
  
  Index: JspRuntimeLibrary.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper34/runtime/org/apache/jasper34/runtime/JspRuntimeLibrary.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JspRuntimeLibrary.java2001/05/27 23:09:20 1.1
  +++ JspRuntimeLibrary.java2001/05/28 05:07:37 1.2
  @@ -60,6 +60,7 @@
   
   import java.io.IOException;
   import java.util.Enumeration;
  +import java.util.Hashtable;
   
   import java.lang.reflect.Method;
   
  @@ -216,6 +217,7 @@
   //---
   // functions to convert builtin Java data types to string.
   //---
  +// Used by GetProperty 
   // __begin toStringMethod
   public static String toString(Object o) {
   return (o == null) ?  : o.toString();
  @@ -540,11 +542,26 @@
throw new JasperException(ex);
}   
   }
  +   
  +public static Hashtable readMethodCache=new Hashtable();
  +public static Hashtable writeMethodCache=new Hashtable();
   
  -public static java.lang.reflect.Method getWriteMethod(Class beanClass, String 
prop)
  -throws JasperException {
  +
  +public static java.lang.reflect.Method getWriteMethod(Class beanClass,
  +   String prop)
  + throws JasperException
  +{
java.lang.reflect.Method method = null; 
   Class type = null;
  +
  + Hashtable methods=(Hashtable)writeMethodCache.get( beanClass );
  + if( methods==null ) {
  + methods=new Hashtable();
  + writeMethodCache.put( beanClass, methods );
  + }
  + method=(java.lang.reflect.Method)methods.get( prop );
  + if( method != null ) return method;
  +
try {
java.beans.BeanInfo info
   = java.beans.Introspector.getBeanInfo(beanClass);
  @@ -578,14 +595,27 @@
   new Object[] {prop, beanClass.getName()}));
   }
   }
  +
  + methods.put( prop, method );
   return method;
   }
   
  -public static java.lang.reflect.Method getReadMethod(Class beanClass, String 
prop)
  -throws JasperException {
  -java.lang.reflect.Method method = null;
  +public static java.lang.reflect.Method getReadMethod(Class beanClass,
  +  String prop)
  + throws JasperException
  +{
  + java.lang.reflect.Method method = null;
   Class type = null;
  -try {
  +
  + Hashtable methods=(Hashtable)readMethodCache.get( beanClass );
  + if( methods==null ) {
  + methods=new Hashtable();
  + readMethodCache.put( beanClass, methods );
  + }
  + method=(java.lang.reflect.Method)methods.get( prop );
  + if( method != null ) return method;
  + 
  + try {
   java.beans.BeanInfo info
   = java.beans.Introspector.getBeanInfo(beanClass);
   if ( info != null ) {
  @@ -619,6 +649,7 @@
   }
   }
   
  + methods.put( prop, method );
return method;
   }