tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject svn commit: r690452 - in /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache: coyote/ juli/ tomcat/util/buf/ tomcat/util/http/ tomcat/util/modeler/
Date Sat, 30 Aug 2008 04:17:51 GMT
Author: costin
Date: Fri Aug 29 21:17:45 2008
New Revision: 690452

URL: http://svn.apache.org/viewvc?rev=690452&view=rev
Log:
Merged from main branch.


Modified:
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java
    tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java Fri Aug 29
21:17:45 2008
@@ -151,7 +151,16 @@
      */
     public static final ActionCode ACTION_AVAILABLE = new ActionCode(23);
 
+    /**
+     * Callback for an asynchronous close of the Comet event
+     */
+    public static final ActionCode ACTION_COMET_CLOSE = new ActionCode(24);
 
+    /**
+     * Callback for setting the timeout asynchronously
+     */
+    public static final ActionCode ACTION_COMET_SETTIMEOUT = new ActionCode(25);
+    
     // ----------------------------------------------------------- Constructors
     int code;
 

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java Fri Aug 29 21:17:45
2008
@@ -60,5 +60,12 @@
         (System.getSecurityManager() != null);
 
 
+    /**
+     * If true, custom HTTP status messages will be used in headers.
+     */
+    public static final boolean USE_CUSTOM_STATUS_MSG_IN_HEADER =
+        Boolean.valueOf(System.getProperty(
+                "org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER",
+                "false")).booleanValue(); 
 
 }

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java Fri Aug 29 21:17:45
2008
@@ -23,10 +23,11 @@
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.buf.UDecoder;
-import org.apache.tomcat.util.http.ContentType;
-import org.apache.tomcat.util.http.Cookies;
+
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.http.Parameters;
+import org.apache.tomcat.util.http.ContentType;
+import org.apache.tomcat.util.http.Cookies;
 
 /**
  * This is a low-level, efficient representation of a server request. Most 

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java Fri
Aug 29 21:17:45 2008
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URLClassLoader;
+import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Collections;
@@ -134,9 +135,9 @@
                 Handler handler = null;
                 ClassLoader current = classLoader;
                 while (current != null) {
-                    info = (ClassLoaderLogInfo) classLoaderLoggers.get(current);
+                    info = classLoaderLoggers.get(current);
                     if (info != null) {
-                        handler = (Handler) info.handlers.get(handlerName);
+                        handler = info.handlers.get(handlerName);
                         if (handler != null) {
                             break;
                         }
@@ -173,7 +174,7 @@
     public synchronized Logger getLogger(final String name) {
         ClassLoader classLoader = Thread.currentThread()
                 .getContextClassLoader();
-        return (Logger) getClassLoaderInfo(classLoader).loggers.get(name);
+        return getClassLoaderInfo(classLoader).loggers.get(name);
     }
     
     
@@ -197,7 +198,7 @@
     public String getProperty(String name) {
         ClassLoader classLoader = Thread.currentThread()
             .getContextClassLoader();
-        String prefix = (String) this.prefix.get();
+        String prefix = this.prefix.get();
         if (prefix != null) {
             name = prefix + name;
         }
@@ -209,7 +210,7 @@
         if ((result == null) && (info.props.isEmpty())) {
             ClassLoader current = classLoader.getParent();
             while (current != null) {
-                info = (ClassLoaderLogInfo) classLoaderLoggers.get(current);
+                info = classLoaderLoggers.get(current);
                 if (info != null) {
                     result = info.props.getProperty(name);
                     if ((result != null) || (!info.props.isEmpty())) {
@@ -264,8 +265,7 @@
         if (classLoader == null) {
             classLoader = ClassLoader.getSystemClassLoader();
         }
-        ClassLoaderLogInfo info = (ClassLoaderLogInfo) classLoaderLoggers
-                .get(classLoader);
+        ClassLoaderLogInfo info = classLoaderLoggers.get(classLoader);
         if (info == null) {
             final ClassLoader classLoaderParam = classLoader;
             AccessController.doPrivileged(new PrivilegedAction() {
@@ -278,7 +278,7 @@
                     return null;
                 }
             });
-            info = (ClassLoaderLogInfo) classLoaderLoggers.get(classLoader);
+            info = classLoaderLoggers.get(classLoader);
         }
         return info;
     }
@@ -296,9 +296,14 @@
         InputStream is = null;
         // Special case for URL classloaders which are used in containers: 
         // only look in the local repositories to avoid redefining loggers 20 times
-        if ((classLoader instanceof URLClassLoader) 
-                && (((URLClassLoader) classLoader).findResource("logging.properties")
!= null)) {
-            is = classLoader.getResourceAsStream("logging.properties");
+        try {
+            if ((classLoader instanceof URLClassLoader) 
+                    && (((URLClassLoader) classLoader).findResource("logging.properties")
!= null)) {
+                is = classLoader.getResourceAsStream("logging.properties");
+            }
+        } catch (AccessControlException ace) {
+            // No permission to configure logging in context
+            // Ignore and carry on
         }
         if ((is == null) && (classLoader == ClassLoader.getSystemClassLoader()))
{
             String configFileStr = System.getProperty("java.util.logging.config.file");
@@ -356,8 +361,7 @@
     protected void readConfiguration(InputStream is, ClassLoader classLoader)
         throws IOException {
         
-        ClassLoaderLogInfo info = 
-            (ClassLoaderLogInfo) classLoaderLoggers.get(classLoader);
+        ClassLoaderLogInfo info = classLoaderLoggers.get(classLoader);
         
         try {
             info.props.load(is);
@@ -497,8 +501,7 @@
                     nextName = name.substring(0, dotIndex);
                     name = name.substring(dotIndex + 1);
                 }
-                LogNode childNode = (LogNode) currentNode.children
-                        .get(nextName);
+                LogNode childNode = currentNode.children.get(nextName);
                 if (childNode == null) {
                     childNode = new LogNode(currentNode);
                     currentNode.children.put(nextName, childNode);

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java Fri Aug 29 21:17:45
2008
@@ -36,7 +36,7 @@
  * named {prefix}.{date}.{suffix} in a configured directory, with an
  * optional preceding timestamp.
  *
- * @version $Revision: 483782 $ $Date: 2006-12-07 18:24:30 -0800 (Thu, 07 Dec 2006) $
+ * @version $Revision: 666232 $ $Date: 2008-06-10 10:43:28 -0700 (Tue, 10 Jun 2008) $
  */
 
 public class FileHandler
@@ -133,8 +133,12 @@
         }
         
         try {
-            writer.write(result);
-            writer.flush();
+            if (writer!=null) {
+                writer.write(result);
+                writer.flush();
+            } else {
+                reportError("FileHandler is closed or not yet initialized, unable to log
["+result+"]", null, ErrorManager.WRITE_FAILURE);
+            }
         } catch (Exception e) {
             reportError(null, e, ErrorManager.WRITE_FAILURE);
             return;

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java
(original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java
Fri Aug 29 21:17:45 2008
@@ -50,10 +50,10 @@
     /** Create a converter, with bytes going to a byte buffer
      */
     public B2CConverter(String encoding)
-	throws IOException
+        throws IOException
     {
-	this.encoding=encoding;
-	reset();
+        this.encoding=encoding;
+        reset();
     }
 
     
@@ -61,7 +61,7 @@
      *  The encoding remain in effect, the internal buffers remain allocated.
      */
     public  void recycle() {
-	conv.recycle();
+        conv.recycle();
     }
 
     static final int BUFFER_SIZE=8192;
@@ -71,56 +71,50 @@
      * @deprecated
      */
     public  void convert( ByteChunk bb, CharChunk cb )
-	throws IOException
+        throws IOException
     {
-	// Set the ByteChunk as input to the Intermediate reader
-	convert(bb, cb, cb.getBuffer().length - cb.getEnd());
+        // Set the ByteChunk as input to the Intermediate reader
+        convert(bb, cb, cb.getBuffer().length - cb.getEnd());
     }
 
+
     public void convert( ByteChunk bb, CharChunk cb, int limit) 
         throws IOException
     {
         iis.setByteChunk( bb );
-        convert(cb, limit);
-    }
-
-    private void convert(CharChunk cb, int limit)
-	throws IOException
-    {
-	try {
-	    // read from the reader
-            int count = 0;
-	    while( limit > 0 ) { // conv.ready() ) {
+        try {
+            // read from the reader
+            int bbLengthBeforeRead = 0;
+            while( limit > 0 ) { // conv.ready() ) {
                 int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE;
-		int cnt=conv.read( result, 0, size );
-		if( cnt <= 0 ) {
-		    // End of stream ! - we may be in a bad state
-		    if( debug>0)
-			log( "EOF" );
-		    //		    reset();
-		    return;
-		}
-		if( debug > 1 )
-		    log("Converted: " + new String( result, 0, cnt ));
-
-		// XXX go directly
-		cb.append( result, 0, cnt );
-                limit -= cnt;
-	    }
-	} catch( IOException ex) {
-	    if( debug>0)
-		log( "Reseting the converter " + ex.toString() );
-	    reset();
-	    throw ex;
-	}
+                bbLengthBeforeRead = bb.getLength();
+                int cnt=conv.read( result, 0, size );
+                if( cnt <= 0 ) {
+                    // End of stream ! - we may be in a bad state
+                    if( debug>0)
+                        log( "EOF" );
+                    return;
+                }
+                if( debug > 1 )
+                    log("Converted: " + new String( result, 0, cnt ));
+                cb.append( result, 0, cnt );
+                limit = limit - (bbLengthBeforeRead - bb.getLength());
+            }
+        } catch( IOException ex) {
+            if( debug>0)
+                log( "Reseting the converter " + ex.toString() );
+            reset();
+            throw ex;
+        }
     }
 
+
     public void reset()
-	throws IOException
+        throws IOException
     {
-	// destroy the reader/iis
-	iis=new IntermediateInputStream();
-	conv=new ReadConvertor( iis, encoding );
+        // destroy the reader/iis
+        iis=new IntermediateInputStream();
+        conv=new ReadConvertor( iis, encoding );
     }
 
     private final int debug=0;
@@ -141,45 +135,45 @@
 
 
     private  static String decodeString(ByteChunk mb, String enc)
-	throws IOException
+        throws IOException
     {
-	byte buff=mb.getBuffer();
-	int start=mb.getStart();
-	int end=mb.getEnd();
-	if( useNewString ) {
-	    if( enc==null) enc="UTF8";
-	    return new String( buff, start, end-start, enc );
-	}
-	B2CConverter b2c=null;
-	if( useSpecialDecoders &&
-	    (enc==null || "UTF8".equalsIgnoreCase(enc))) {
-	    if( utfD==null ) utfD=new UTF8Decoder();
-	    b2c=utfD;
-	}
-	if(decoders == null ) decoders=new Hashtable();
-	if( enc==null ) enc="UTF8";
-	b2c=(B2CConverter)decoders.get( enc );
-	if( b2c==null ) {
-	    if( useSpecialDecoders ) {
-		if( "UTF8".equalsIgnoreCase( enc ) ) {
-		    b2c=new UTF8Decoder();
-		}
-	    }
-	    if( b2c==null )
-		b2c=new B2CConverter( enc );
-	    decoders.put( enc, b2c );
-	}
-	if( conversionBuf==null ) conversionBuf=new CharChunk(1024);
-
-	try {
-	    conversionBuf.recycle();
-	    b2c.convert( this, conversionBuf );
-	    //System.out.println("XXX 1 " + conversionBuf );
-	    return conversionBuf.toString();
-	} catch( IOException ex ) {
-	    ex.printStackTrace();
-	    return null;
-	}
+        byte buff=mb.getBuffer();
+        int start=mb.getStart();
+        int end=mb.getEnd();
+        if( useNewString ) {
+            if( enc==null) enc="UTF8";
+            return new String( buff, start, end-start, enc );
+        }
+        B2CConverter b2c=null;
+        if( useSpecialDecoders &&
+            (enc==null || "UTF8".equalsIgnoreCase(enc))) {
+            if( utfD==null ) utfD=new UTF8Decoder();
+            b2c=utfD;
+        }
+        if(decoders == null ) decoders=new Hashtable();
+        if( enc==null ) enc="UTF8";
+        b2c=(B2CConverter)decoders.get( enc );
+        if( b2c==null ) {
+            if( useSpecialDecoders ) {
+                if( "UTF8".equalsIgnoreCase( enc ) ) {
+                    b2c=new UTF8Decoder();
+                }
+            }
+            if( b2c==null )
+                b2c=new B2CConverter( enc );
+            decoders.put( enc, b2c );
+        }
+        if( conversionBuf==null ) conversionBuf=new CharChunk(1024);
+
+        try {
+            conversionBuf.recycle();
+            b2c.convert( this, conversionBuf );
+            //System.out.println("XXX 1 " + conversionBuf );
+            return conversionBuf.toString();
+        } catch( IOException ex ) {
+            ex.printStackTrace();
+            return null;
+        }
     }
 
     */
@@ -193,37 +187,40 @@
  * 
  */
 final class  ReadConvertor extends InputStreamReader {
-    // stream with flush() and close(). overriden.
-    private IntermediateInputStream iis;
-    
-    // Has a private, internal byte[8192]
     
     /** Create a converter.
      */
     public ReadConvertor( IntermediateInputStream in, String enc )
-	throws UnsupportedEncodingException
+        throws UnsupportedEncodingException
     {
-	super( in, enc );
-	iis=in;
+        super( in, enc );
     }
     
     /** Overriden - will do nothing but reset internal state.
      */
     public  final void close() throws IOException {
-	// NOTHING
-	// Calling super.close() would reset out and cb.
+        // NOTHING
+        // Calling super.close() would reset out and cb.
     }
     
     public  final int read(char cbuf[], int off, int len)
-	throws IOException
+        throws IOException
     {
-	// will do the conversion and call write on the output stream
-	return super.read( cbuf, off, len );
+        // will do the conversion and call write on the output stream
+        return super.read( cbuf, off, len );
     }
     
     /** Reset the buffer
      */
     public  final void recycle() {
+        try {
+            // Must clear super's buffer.
+            while (ready()) {
+                // InputStreamReader#skip(long) will allocate buffer to skip.
+                read();
+            }
+        } catch(IOException ioe){
+        }
     }
 }
 
@@ -241,16 +238,16 @@
     }
     
     public  final void close() throws IOException {
-	// shouldn't be called - we filter it out in writer
-	throw new IOException("close() called - shouldn't happen ");
+        // shouldn't be called - we filter it out in writer
+        throw new IOException("close() called - shouldn't happen ");
     }
     
     public  final  int read(byte cbuf[], int off, int len) throws IOException {
-	return bc.substract(cbuf, off, len);
+        return bc.substract(cbuf, off, len);
     }
     
     public  final int read() throws IOException {
-	return bc.substract();
+        return bc.substract();
     }
 
     // -------------------- Internal methods --------------------

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java Fri
Aug 29 21:17:45 2008
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.io.Serializable;
 import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicLong;
 
 /*
  * In a server it is very important to be able to operate on
@@ -97,10 +96,7 @@
 	8859_1, and this object is used mostly for servlets. 
     */
     public static final String DEFAULT_CHARACTER_ENCODING="ISO-8859-1";
-    
-    // Statistics: how many ByteChunks have we allocated 
-    public static AtomicLong allocatedByteChunks = new AtomicLong();
-    
+        
     // byte[]
     private byte[] buff;
 
@@ -125,12 +121,10 @@
      * Creates a new, uninitialized ByteChunk object.
      */
     public ByteChunk() {
-        BufferInfo.get().totalBChunks.incrementAndGet();
     }
 
     public ByteChunk( int initial ) {
-        BufferInfo.get().totalBChunks.incrementAndGet();
-        allocate( initial, -1 );
+	allocate( initial, -1 );
     }
 
     //--------------------
@@ -144,7 +138,8 @@
     
     /** 
      * Return a ByteBuffer wrapping the ByteChunk.
-     * The buffer position/limit are set for read.
+     * The buffer position/limit are set for reading out 
+     * of the buffer, or for sending the buffer to a channel. 
      * 
      * Reads from the ByteBuffer will not be reflected in the ByteChunk.
      * 
@@ -161,7 +156,8 @@
     
     /** 
      * Return a ByteBuffer wrapping the ByteChunk.
-     * The buffer position/limit are set for read.
+     * The buffer position/limit are set for write into
+     * the buffer, or for reading from a channel.
      * 
      * Writes to the ByteBuffer will not be reflected in the ByteChunk until
      * you call updateWriteByteBuffer()
@@ -212,8 +208,6 @@
 	isOutput=true;
 	if( buff==null || buff.length < initial ) {
 	    buff=new byte[initial];
-            BufferInfo.get().allocatedBChunksBytes.addAndGet(initial);
-            BufferInfo.get().allocatedBChunks.addAndGet(1);
 	}    
 	this.limit=limit;
 	start=0;
@@ -540,8 +534,6 @@
 	if( buff==null ) {
 	    if( desiredSize < 256 ) desiredSize=256; // take a minimum
 	    buff=new byte[desiredSize];
-            BufferInfo.get().allocatedBChunksBytes.addAndGet(desiredSize);
-            BufferInfo.get().allocatedBChunksLazy.addAndGet(1);
 	}
 	
 	// limit < buf.length ( the buffer is already big )
@@ -561,7 +553,7 @@
 		newSize > limit ) newSize=limit;
 	    tmp=new byte[newSize];
 	}
-        BufferInfo.get().growBChunks.addAndGet(newSize - buff.length);
+	
 	System.arraycopy(buff, start, tmp, 0, end-start);
 	buff = tmp;
 	tmp = null;
@@ -945,8 +937,7 @@
 
 
     /**
-     * Convert specified String to a byte array. This ONLY WORKS for ascii, UTF 
-     * chars will be truncated.
+     * Convert specified String to a byte array. This ONLY WORKS for ascii, UTF chars will
be truncated.
      * 
      * @param value to convert to byte array
      * @return the byte array value
@@ -968,13 +959,29 @@
 
     // --------- To make it easier to use - same-name methods with ByteBuffer
     public char charAt(int index) {
-      if (start + index > end) {
-        throw new ArrayIndexOutOfBoundsException(start + " " + 
-            index + " " + end);
-      }
-      return (char) buff[start + index];
+        if (start + index > end) {
+            throw new ArrayIndexOutOfBoundsException(start + " " + 
+                index + " " + end);
+          }
+          return (char) buff[start + index];
     }
 
+    public byte byteAt(int index) {
+        return buff[start + index];
+    }
+    
+    public int capacity() {
+        return buff.length;
+    }
+    
+    public void setCapacity(int max) {
+        if (max <= buff.length) {
+            // Ignore - could throw ex, or shrink
+        } else {
+            makeSpace(max - buff.length);
+        }
+    }
+    
     public int length() {
       return end - start;
     }

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java (original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java Fri
Aug 29 21:17:45 2008
@@ -79,12 +79,10 @@
      * Creates a new, uninitialized CharChunk object.
      */
     public CharChunk() {
-      BufferInfo.get().totalCChunks.incrementAndGet();
     }
 
     public CharChunk(int size) {
-      BufferInfo.get().totalCChunks.incrementAndGet();
-      allocate( size, -1 );
+        allocate( size, -1 );
     }
 
     // --------------------
@@ -122,8 +120,6 @@
 	isOutput=true;
 	if( buff==null || buff.length < initial ) {
 	    buff=new char[initial];
-            BufferInfo.get().allocatedCChunksBytes.addAndGet(initial);
-            BufferInfo.get().allocatedCChunks.addAndGet(1);	    
 	}
 	this.limit=limit;
 	start=0;
@@ -464,8 +460,6 @@
 	if( buff==null ) {
 	    if( desiredSize < 256 ) desiredSize=256; // take a minimum
 	    buff=new char[desiredSize];
-            BufferInfo.get().allocatedCChunksBytes.addAndGet(desiredSize);
-            BufferInfo.get().allocatedCChunksLazy.addAndGet(1);	    
 	}
 
 	// limit < buf.length ( the buffer is already big )
@@ -485,7 +479,6 @@
 		newSize > limit ) newSize=limit;
 	    tmp=new char[newSize];
 	}
-	BufferInfo.get().growBChunks.addAndGet(newSize - buff.length);
 	System.arraycopy(buff, start, tmp, start, end-start);
 	buff = tmp;
 	tmp = null;

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
(original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java
Fri Aug 29 21:17:45 2008
@@ -137,13 +137,13 @@
      * @param len the length of the bytes
      */
     public void setBytes(byte[] b, int off, int len) {
-      byteC.setBytes( b, off, len );
-      type=T_BYTES;
-      hasStrValue=false;
-      hasHashCode=false;
-      hasIntValue=false;
-      hasLongValue=false;
-      hasDateValue=false; 
+        byteC.setBytes( b, off, len );
+        type=T_BYTES;
+        hasStrValue=false;
+        hasHashCode=false;
+        hasIntValue=false;
+        hasLongValue=false;
+        hasDateValue=false; 
     }
 
     /** Set the encoding. If the object was constructed from bytes[]. any

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java
(original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java
Fri Aug 29 21:17:45 2008
@@ -364,7 +364,7 @@
     String next;
     MimeHeaders headers;
 
-    NamesEnumerator(MimeHeaders headers) {
+    public NamesEnumerator(MimeHeaders headers) {
         this.headers=headers;
         pos=0;
         size = headers.size();

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java
(original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java
Fri Aug 29 21:17:45 2008
@@ -135,6 +135,7 @@
     
     private static final String tspecials = ",; ";
     private static final String tspecials2 = "()<>@,;:\\\"/[]?={} \t";
+    private static final String tspecials2NoSlash = "()<>@,;:\\\"[]?={} \t";
 
     /*
      * Tests a string and returns true if the string counts as a
@@ -146,6 +147,11 @@
      *              token; <code>false</code> if it is not
      */
     public static boolean isToken(String value) {
+        return isToken(value,null);
+    }
+    
+    public static boolean isToken(String value, String literals) {
+        String tspecials = (literals==null?ServerCookie.tspecials:literals);
         if( value==null) return true;
         int len = value.length();
 
@@ -172,8 +178,12 @@
         return false;
     }
 
-
     public static boolean isToken2(String value) {
+        return isToken2(value,null);
+    }
+
+    public static boolean isToken2(String value, String literals) {
+        String tspecials2 = (literals==null?ServerCookie.tspecials2:literals);
         if( value==null) return true;
         int len = value.length();
 
@@ -255,7 +265,7 @@
         buf.append("=");
         // Servlet implementation does not check anything else
         
-        version = maybeQuote2(version, buf, value);
+        version = maybeQuote2(version, buf, value,true);
 
         // Add version 1 specific information
         if (version == 1) {
@@ -299,7 +309,11 @@
         // Path=path
         if (path!=null) {
             buf.append ("; Path=");
-            maybeQuote2(version, buf, path);
+            if (version==0) {
+                maybeQuote2(version, buf, path);
+            } else {
+                maybeQuote2(version, buf, path, ServerCookie.tspecials2NoSlash, false);
+            }
         }
 
         // Secure
@@ -337,6 +351,14 @@
      * @param value
      */
     public static int maybeQuote2 (int version, StringBuffer buf, String value) {
+        return maybeQuote2(version,buf,value,false);
+    }
+
+    public static int maybeQuote2 (int version, StringBuffer buf, String value, boolean allowVersionSwitch)
{
+        return maybeQuote2(version,buf,value,null,allowVersionSwitch);
+    }
+
+    public static int maybeQuote2 (int version, StringBuffer buf, String value, String literals,
boolean allowVersionSwitch) {
         if (value==null || value.length()==0) {
             buf.append("\"\"");
         }else if (containsCTL(value,version)) 
@@ -345,16 +367,16 @@
             buf.append('"');
             buf.append(escapeDoubleQuotes(value,1,value.length()-1));
             buf.append('"');
-        } else if ((!STRICT_SERVLET_COMPLIANCE) && version==0 && !isToken2(value))
{
+        } else if (allowVersionSwitch && (!STRICT_SERVLET_COMPLIANCE) &&
version==0 && !isToken2(value, literals)) {
             buf.append('"');
             buf.append(escapeDoubleQuotes(value,0,value.length()));
             buf.append('"');
             version = 1;
-        } else if (version==0 && !isToken(value)) {
+        } else if (version==0 && !isToken(value,literals)) {
             buf.append('"');
             buf.append(escapeDoubleQuotes(value,0,value.length()));
             buf.append('"');
-        } else if (version==1 && !isToken2(value)) {
+        } else if (version==1 && !isToken2(value,literals)) {
             buf.append('"');
             buf.append(escapeDoubleQuotes(value,0,value.length()));
             buf.append('"');

Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java?rev=690452&r1=690451&r2=690452&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java
(original)
+++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java
Fri Aug 29 21:17:45 2008
@@ -43,7 +43,7 @@
  * descriptor.</p>
  *
  * @author Craig R. McClanahan
- * @version $Revision: 610929 $ $Date: 2008-01-10 13:04:31 -0800 (Thu, 10 Jan 2008) $
+ * @version $Revision: 607483 $ $Date: 2007-12-29 14:45:21 -0800 (Sat, 29 Dec 2007) $
  */
 
 public class ManagedBean implements java.io.Serializable



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


Mime
View raw message