tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/http Parameters.java
Date Tue, 26 Dec 2000 23:35:38 GMT
costin      00/12/26 15:35:38

  Modified:    src/share/org/apache/tomcat/core Response.java
               src/share/org/apache/tomcat/modules/server Ajp12.java
                        Ajp13.java Ajp13Interceptor.java
                        JNIConnectionHandler.java
               src/share/org/apache/tomcat/request AccessInterceptor.java
                        InvokerInterceptor.java ReloadInterceptor.java
                        StaticInterceptor.java
               src/share/org/apache/tomcat/startup EmbededTomcat.java
               src/share/org/apache/tomcat/util ByteChunk.java
                        CharChunk.java
               src/share/org/apache/tomcat/util/http Parameters.java
  Log:
  small fixes, updates for the changes in Request and ContextManager
  
  Revision  Changes    Path
  1.44      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Response.java	2000/12/05 14:02:41	1.43
  +++ Response.java	2000/12/26 23:35:33	1.44
  @@ -339,13 +339,14 @@
   	notifyEndHeaders();
       }
   
  +    // XXX XXX 
       /** Signal that we're done with the headers, and body will follow.
        *  Any implementation needs to notify ContextManager, to allow
        *  interceptors to fix headers.
        */
       public void notifyEndHeaders() throws IOException {
   	commited=true;
  -	if(request.getProtocol()==null) // HTTP/0.9 
  +	if(request.protocol().isNull()) // HTTP/0.9 
   	    return;
   
   	// let CM notify interceptors and give a chance to fix
  
  
  
  1.10      +1 -2      jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12.java
  
  Index: Ajp12.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Ajp12.java	2000/12/17 02:37:55	1.9
  +++ Ajp12.java	2000/12/26 23:35:34	1.10
  @@ -140,8 +140,7 @@
   
   		    //Apache document root
   		    dummy = readString(ajpin, null);               
  -		    req.setPathInfo( readString(ajpin, null));               
  -		    //Apache parsed path-translated XXX Bug in mod_jserv !!!!!
  +		    req.pathInfo().setString( readString(ajpin, null));               		    //Apache
parsed path-translated XXX Bug in mod_jserv !!!!!
   		    dummy = readString(ajpin, null);
   		    req.queryString().setString( readString(ajpin, null));  
   		    req.setRemoteAddr(readString(ajpin, ""));
  
  
  
  1.7       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java
  
  Index: Ajp13.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Ajp13.java	2000/12/05 06:30:15	1.6
  +++ Ajp13.java	2000/12/26 23:35:34	1.7
  @@ -249,7 +249,7 @@
           byte methodCode = msg.getByte();
           req.method().setString( methodTransArray[(int)methodCode - 1] );
   
  -        req.setProtocol(            msg.getString());
  +        req.protocol().setString( msg.getString());
           req.requestURI().setString( msg.getString());
   
           req.setRemoteAddr(          msg.getString());
  
  
  
  1.5       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13Interceptor.java
  
  Index: Ajp13Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13Interceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Ajp13Interceptor.java	2000/11/30 07:36:03	1.4
  +++ Ajp13Interceptor.java	2000/12/26 23:35:34	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13Interceptor.java,v
1.4 2000/11/30 07:36:03 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/11/30 07:36:03 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13Interceptor.java,v
1.5 2000/12/26 23:35:34 costin Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/12/26 23:35:34 $
    *
    * ====================================================================
    *
  @@ -254,7 +254,7 @@
       {
           super.endHeaders();
       
  -        if (request.getProtocol() == null) {
  +        if (request.protocol().isNull()) {
               return;
           }
   
  
  
  
  1.5       +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java
  
  Index: JNIConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JNIConnectionHandler.java	2000/11/30 04:58:45	1.4
  +++ JNIConnectionHandler.java	2000/12/26 23:35:34	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v
1.4 2000/11/30 04:58:45 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/11/30 04:58:45 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v
1.5 2000/12/26 23:35:34 costin Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/12/26 23:35:34 $
    *
    * ====================================================================
    *
  @@ -381,7 +381,7 @@
   
       public void endHeaders() throws IOException {
   
  -    	if(request.getProtocol()==null) // HTTP/0.9 
  +    	if(request.protocol().isNull()) // HTTP/0.9 
   	        return;
   
           super.endHeaders();
  
  
  
  1.28      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java
  
  Index: AccessInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- AccessInterceptor.java	2000/12/13 19:58:03	1.27
  +++ AccessInterceptor.java	2000/12/26 23:35:35	1.28
  @@ -220,6 +220,7 @@
       {
   	Context ctx=ct.getContext();
   	Container ctxCt=ctx.getContainer();
  +	// XXX add the note only if we have a security constraint
   	SecurityConstraints ctxSecurityC=(SecurityConstraints)ctxCt.
   	    getNote( secMapNote );
   	if( ctxSecurityC==null) {
  @@ -245,7 +246,7 @@
   	Context ctx=req.getContext();
   	SecurityConstraints ctxSec=(SecurityConstraints)ctx.getContainer().
   	    getNote( secMapNote );
  -	if( ctxSec.patterns==0 ) return 0; // fast exit
  +	if( ctxSec==null || ctxSec.patterns==0 ) return 0; // fast exit
   	
   	String reqURI = RequestUtil.URLDecode(req.requestURI().toString());
   	String ctxPath= ctx.getPath();
  
  
  
  1.17      +4 -4      jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java
  
  Index: InvokerInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/InvokerInterceptor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- InvokerInterceptor.java	2000/12/13 19:58:03	1.16
  +++ InvokerInterceptor.java	2000/12/26 23:35:35	1.17
  @@ -91,8 +91,8 @@
   	// default servlet / container
   	
   	// if doesn't starts with /servlet - return
  -	String pathInfo = req.getPathInfo();
  -	String servletPath=req.getServletPath();
  +	String pathInfo = req.pathInfo().toString();
  +	String servletPath=req.servletPath().toString();
   	
   	// Now we need to fix path info and servlet path
   	if( servletPath == null ||
  @@ -126,8 +126,8 @@
   		 " SP=" + newServletPath +
   		 " PI=" + newPathInfo);
   	
  - 	req.setServletPath(newServletPath);
  -	req.setPathInfo(newPathInfo);
  + 	req.servletPath().setString(newServletPath);
  +	req.pathInfo().setString(newPathInfo);
   	
   	Handler wrapper = ctx.getServletByName(servletName);
   	if (wrapper != null) {
  
  
  
  1.10      +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/request/ReloadInterceptor.java
  
  Index: ReloadInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/ReloadInterceptor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ReloadInterceptor.java	2000/12/02 08:26:49	1.9
  +++ ReloadInterceptor.java	2000/12/26 23:35:35	1.10
  @@ -154,7 +154,7 @@
   
   		cm.addContext( ctx1 );
   
  -		cm.initContext( ctx1 );
  +		ctx1.init();
   
   		// XXX Make sure ctx is destroyed - we may have
   		// undetected leaks 
  
  
  
  1.28      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/StaticInterceptor.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- StaticInterceptor.java	2000/12/13 19:58:03	1.27
  +++ StaticInterceptor.java	2000/12/26 23:35:35	1.28
  @@ -126,7 +126,7 @@
   
   	// will call getRealPath(), all path normalization
   	// and a number of checks
  -	String pathInfo=req.getServletPath();
  +	String pathInfo=req.servletPath().toString();
   	if( pathInfo==null ) pathInfo="";
   
   	String absPath=FileUtil.safePath( ctx.getAbsolutePath(),
  @@ -244,7 +244,7 @@
   	    subReq=req.getChild();
   
   	Context ctx=subReq.getContext();
  -	String pathInfo=subReq.getServletPath();
  +	String pathInfo=subReq.servletPath().toString();
   	String absPath = (String)subReq.getNote( realFileNote );
   	if( absPath==null )
   	    absPath=FileUtil.safePath( context.getAbsolutePath(),
  @@ -365,7 +365,7 @@
   	Request subReq=req;
   	if( inInclude ) subReq = req.getChild();
   	Context ctx=req.getContext();
  -	String pathInfo=subReq.getServletPath();
  +	String pathInfo=subReq.servletPath().toString();
   	if( pathInfo == null ) pathInfo="";
   	String absPath=FileUtil.safePath( context.getAbsolutePath(),
   					  pathInfo);
  
  
  
  1.33      +14 -5     jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- EmbededTomcat.java	2000/12/12 20:21:43	1.32
  +++ EmbededTomcat.java	2000/12/26 23:35:36	1.33
  @@ -71,7 +71,9 @@
        *  For tomcat, it will be a BaseInterceptor.
        * 	See the top level documentation
        */
  -    public void addApplicationAdapter( Object adapter ) {
  +    public void addApplicationAdapter( Object adapter )
  +	throws TomcatException
  +    {
   	if(requestInt==null)  initDefaultInterceptors();
   
   	// In our case the adapter must be BaseInterceptor.
  @@ -99,7 +101,9 @@
       /** Add a web service on the specified address. You must add all the
        *  endpoints before calling start().
        */
  -    public void addEndpoint( int port, InetAddress addr , String hostname) {
  +    public void addEndpoint( int port, InetAddress addr , String hostname)
  +	throws TomcatException
  +    {
   	if(debug>0) log( "addConnector " + port + " " + addr +
   			 " " + hostname );
   
  @@ -119,6 +123,7 @@
        */
       public void addSecureEndpoint( int port, InetAddress addr, String hostname,
   				    String keyFile, String keyPass )
  +	throws TomcatException
       {
   	if(debug>0) log( "addSecureConnector " + port + " " + addr + " " +
   			 hostname );
  @@ -143,7 +148,9 @@
       
       /** Add and init a context
        */
  -    public Object addContext( String ctxPath, URL docRoot ) {
  +    public Object addContext( String ctxPath, URL docRoot )
  +	throws TomcatException
  +    {
   	if(debug>0) log( "add context \"" + ctxPath + "\" " + docRoot );
   	if( contextM == null )
   	    initContextManager();
  @@ -245,7 +252,7 @@
   // 	    }
   	    Context ctx=(Context)sctx;
   	    //contextM.getRealContext( sctx );
  -	    contextM.initContext( ctx );
  +	    ctx.init();
   
   	    //	    Object pd=ctx.getProtectionDomain();
   	    //	    log("Ctx.pd " + pd);
  @@ -303,7 +310,9 @@
   	    ((BaseInterceptor)ri).setDebug( debug );
       }
   
  -    private void initContextManager() {
  +    private void initContextManager()
  +	throws TomcatException 
  +    {
   	if(requestInt==null)  initDefaultInterceptors();
   	contextM=new ContextManager();
   	contextM.setDebug( debug );
  
  
  
  1.2       +10 -4     jakarta-tomcat/src/share/org/apache/tomcat/util/ByteChunk.java
  
  Index: ByteChunk.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/ByteChunk.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ByteChunk.java	2000/12/07 18:34:51	1.1
  +++ ByteChunk.java	2000/12/26 23:35:37	1.2
  @@ -360,11 +360,17 @@
        * @param s the string
        */
       public int indexOf(char c, int starting) {
  +	return indexOf( bytes, bytesOff+starting, bytesOff+bytesLen, c);
  +    }
  +
  +    public static int  indexOf( byte bytes[], int off, int end, char qq )
  +    {
   	// Works only for UTF 
  -	int max=bytesOff+bytesLen;
  -	byte bb[]=bytes;
  -	for (int i = bytesOff+starting; i < max ; i++) {
  -	    if( (byte)c == bb[i]) return i;
  +	while( off < end ) {
  +	    byte b=bytes[off];
  +	    if( b==qq )
  +		return off;
  +	    off++;
   	}
   	return -1;
       }
  
  
  
  1.2       +11 -2     jakarta-tomcat/src/share/org/apache/tomcat/util/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/CharChunk.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CharChunk.java	2000/12/07 18:34:51	1.1
  +++ CharChunk.java	2000/12/26 23:35:37	1.2
  @@ -274,11 +274,20 @@
        * @param s the string
        */
       public int indexOf(char c, int starting) {
  -	for (int i = charsOff+starting; i < charsOff + charsLen; i++) {
  -	    if( c == chars[i] ) return i;
  +	return indexOf( chars, charsOff+starting, charsOff+charsLen, c );
  +    }
  +
  +    public static int indexOf( char chars[], int off, int end, char qq )
  +    {
  +	while( off < end ) {
  +	    char b=chars[off];
  +	    if( b==qq )
  +		return off;
  +	    off++;
   	}
   	return -1;
       }
  +
   
   
   }
  
  
  
  1.4       +16 -30    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Parameters.java	2000/12/07 18:34:54	1.3
  +++ Parameters.java	2000/12/26 23:35:38	1.4
  @@ -87,13 +87,17 @@
   	isSet=false;
   	isFormBased=false;
       }
  -    // XXX need better name
  +
  +    /**
  +     */
       public boolean isEvaluated() {
   	return isSet;
       }
  +    
       public void setEvaluated( boolean b ) {
   	isSet=b;
       }
  +    
       // XXX need better name
       public boolean hasFormData() {
   	return isFormBased;
  @@ -102,38 +106,18 @@
   	isFormBased=b;
       }
       
  -    // duplicated
  -    public static int indexOf( byte bytes[], int off, int end, char qq )
  -    {
  -	while( off < end ) {
  -	    byte b=bytes[off];
  -	    if( b==qq )
  -		return off;
  -	    off++;
  -	}
  -	return off;
  -    }
  -
  -    public static int indexOf( char chars[], int off, int end, char qq )
  -    {
  -	while( off < end ) {
  -	    char b=chars[off];
  -	    if( b==qq )
  -		return off;
  -	    off++;
  -	}
  -	return off;
  -    }
  -
       public void processParameters( byte bytes[], int start, int len ) {
   	int end=start+len;
   	int pos=start;
   	
           do {
   	    int nameStart=pos;
  -	    int nameEnd=indexOf(bytes, nameStart, end, '=' );
  +	    int nameEnd=ByteChunk.indexOf(bytes, nameStart, end, '=' );
  +	    if( nameEnd== -1 ) nameEnd=end;
  +	    
   	    int valStart=nameEnd+1;
  -	    int valEnd=indexOf(bytes, valStart, end, '&');
  +	    int valEnd=ByteChunk.indexOf(bytes, valStart, end, '&');
  +	    if( valEnd== -1 ) valEnd=end;
   	    
   	    pos=valEnd+1;
   	    
  @@ -157,15 +141,17 @@
   	
           do {
   	    int nameStart=pos;
  -	    int nameEnd=indexOf(chars, nameStart, end, '=' );
  +	    int nameEnd=CharChunk.indexOf(chars, nameStart, end, '=' );
  +	    if( nameEnd== -1 ) nameEnd=end;
  +
   	    int valStart=nameEnd+1;
  -	    int valEnd=indexOf(chars, valStart, end, '&');
  -	    
  +	    int valEnd=CharChunk.indexOf(chars, valStart, end, '&');
  +	    if( valEnd== -1 ) valEnd=end;
   	    pos=valEnd+1;
   	    
   	    if( nameEnd<=nameStart ) {
   		continue;
  -		// invalid chunk - it's better to ignore
  +		// invalid chunk - no name, it's better to ignore
   		// XXX log it ?
   	    }
   	    
  
  
  

Mime
View raw message