Author: costin
Date: Tue Mar 25 21:55:13 2008
New Revision: 641149
URL: http://svn.apache.org/viewvc?rev=641149&view=rev
Log:
Should build now, still missing some files
Removed:
tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/EchoAdapter.java
tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/file/Webdav2Servlet.java
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
Modified:
tomcat/sandbox/tomcat-lite/build.xml
tomcat/sandbox/tomcat-lite/coyote-nio/org/apache/coyote/http11/Http11NioProtocol.java
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.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
Modified: tomcat/sandbox/tomcat-lite/build.xml
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/build.xml?rev=641149&r1=641148&r2=641149&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-lite/build.xml (original)
+++ tomcat/sandbox/tomcat-lite/build.xml Tue Mar 25 21:55:13 2008
@@ -20,8 +20,9 @@
<!-- Used for 'download', to pack the dependent jars -->
<property name="tc.base" location="../.." />
- <property name="tc6.home" value="${tc.base}/tomcat6"/>
- <property name="tc6.classes" location="${tc6.home}/output/classes"/>
+ <property name="tc6.src" value="${tc.base}/tomcat6"/>
+ <property name="tc6.classes" location="${tc6.src}/output/classes"/>
+ <property name="tc6.home" location="${tc6.src}/output/build"/>
<property name="classes" location="output/classes"/>
<path id="runtime-deps" >
@@ -168,23 +169,10 @@
<target name="download"
description="Prepare the external deps dir, using a tomcat6 build dir.
Call this first">
<mkdir dir="external"/>
- <jar destfile="external/javax.annotation.jar">
- <fileset dir="${tc6.classes}" >
- <include name="javax/annotation/**"/>
- </fileset>
- </jar>
- <jar destfile="external/javax.servlet.jar" >
- <fileset dir="${tc6.classes}" >
- <include name="javax/servlet/*"/>
- <include name="javax/servlet/http/*"/>
- </fileset>
- </jar>
- <jar destfile="external/jasper.jar"
- manifest="resources/jasper.MF">
- <fileset dir="${tc6.classes}" >
- <include name="org/apache/jasper/**"/>
- </fileset>
- </jar>
+ <copy file="${tc6.home}/lib/servlet-api.jar"
+ todir="external" />
+ <copy file="${tc6.home}/lib/annotations-api.jar"
+ todir="external" />
</target>
</project>
Modified:
tomcat/sandbox/tomcat-lite/coyote-nio/org/apache/coyote/http11/Http11NioProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-nio/org/apache/coyote/http11/Http11NioProtocol.java?rev=641149&r1=641148&r2=641149&view=diff
==============================================================================
---
tomcat/sandbox/tomcat-lite/coyote-nio/org/apache/coyote/http11/Http11NioProtocol.java
(original)
+++
tomcat/sandbox/tomcat-lite/coyote-nio/org/apache/coyote/http11/Http11NioProtocol.java
Tue Mar 25 21:55:13 2008
@@ -39,7 +39,7 @@
import org.apache.tomcat.util.net.NioChannel;
import org.apache.tomcat.util.net.NioEndpoint;
import org.apache.tomcat.util.net.NioEndpoint.Handler;
-import org.apache.tomcat.util.net.jsse.JSSEImplementation;
+import org.apache.tomcat.util.net.SSLImplementation;
import org.apache.tomcat.util.net.SecureNioChannel;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.res.StringManager;
@@ -56,7 +56,7 @@
*/
public class Http11NioProtocol implements ProtocolHandler, MBeanRegistration
{
- protected JSSEImplementation sslImplementation = null;
+ protected SSLImplementation sslImplementation = null;
public Http11NioProtocol() {
cHandler = new Http11ConnectionHandler( this );
@@ -134,7 +134,7 @@
try {
ep.init();
- sslImplementation = new JSSEImplementation();
+ sslImplementation =
SSLImplementation.getInstance("org.apache.tomcat.util.net.jsse.JSSEImplementation");
} catch (Exception ex) {
log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
throw ex;
@@ -579,6 +579,9 @@
public boolean getSSLEnabled() { return ep.isSSLEnabled(); }
public void setSSLEnabled(boolean SSLEnabled) {
ep.setSSLEnabled(SSLEnabled); }
+ public NioEndpoint getEndpoint() {
+ return ep;
+ }
// -------------------- Connection handler --------------------
@@ -769,8 +772,8 @@
processor.setMaxKeepAliveRequests(proto.maxKeepAliveRequests);
processor.setTimeout(proto.timeout);
processor.setDisableUploadTimeout(proto.disableUploadTimeout);
- processor.setCompressionMinSize(proto.compressionMinSize);
processor.setCompression(proto.compression);
+ processor.setCompressionMinSize(proto.compressionMinSize);
processor.setNoCompressionUserAgents(proto.noCompressionUserAgents);
processor.setCompressableMimeTypes(proto.compressableMimeTypes);
processor.setRestrictedUserAgents(proto.restrictedUserAgents);
Modified:
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.java?rev=641149&r1=641148&r2=641149&view=diff
==============================================================================
---
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.java
(original)
+++
tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.java
Tue Mar 25 21:55:13 2008
@@ -741,8 +741,10 @@
String args0[], String args1[], Hashtable aliases) throws
Exception {
for (int i = 0; i < args.length; i++) {
String arg = args[i];
+ if (arg.startsWith("--"))
+ arg = arg.substring(2);
if (arg.startsWith("-"))
- arg = arg.substring(1);
+ arg = arg.substring(1);
if (aliases != null && aliases.get(arg) != null)
arg = (String) aliases.get(arg);
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=641149&r1=641148&r2=641149&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
Tue Mar 25 21:55:13 2008
@@ -19,6 +19,8 @@
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
@@ -61,7 +63,7 @@
* @author Costin Manolache
* @author Remy Maucherat
*/
-public final class ByteChunk implements Cloneable, Serializable {
+public final class ByteChunk implements Cloneable, Serializable, CharSequence {
/** Input interface, used when the buffer is emptiy
*
@@ -95,7 +97,10 @@
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;
@@ -114,6 +119,7 @@
private boolean isOutput=false;
private boolean optimizedWrite=true;
+ ByteBuffer bb = null;
/**
* Creates a new, uninitialized ByteChunk object.
@@ -133,6 +139,50 @@
return null;
}
}
+
+ /**
+ * Return a ByteBuffer wrapping the ByteChunk.
+ * The buffer position/limit are set for read.
+ *
+ * Reads from the ByteBuffer will not be reflected in the ByteChunk.
+ *
+ * @return
+ */
+ public ByteBuffer getReadByteBuffer() {
+ if (bb == null) {
+ bb = ByteBuffer.wrap(buff);
+ }
+ bb.position(start);
+ bb.limit(end);
+ return bb;
+ }
+
+ /**
+ * Return a ByteBuffer wrapping the ByteChunk.
+ * The buffer position/limit are set for read.
+ *
+ * Writes to the ByteBuffer will not be reflected in the ByteChunk until
+ * you call updateWriteByteBuffer()
+ *
+ * @return
+ */
+ public ByteBuffer getWriteByteBuffer() {
+ if (bb == null) {
+ bb = ByteBuffer.wrap(buff);
+ }
+ bb.position(end);
+ bb.limit(buff.length);
+ return bb;
+ }
+
+ public void updateWriteByteBuffer() {
+ end = bb.position();
+ }
+
+ public void updateReadByteBuffer() {
+ start = bb.position();
+ }
+
public boolean isNull() {
return ! isSet; // buff==null;
@@ -696,6 +746,10 @@
// -------------------- Hash code --------------------
+ public int hashCode() {
+ return hash();
+ }
+
// normal hash.
public int hash() {
return hashBytes( buff, start, end-start);
@@ -820,6 +874,25 @@
}
return result;
}
-
+
+ // --------- 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];
+ }
+
+ public int length() {
+ return end - start;
+ }
+
+ public CharSequence subSequence(int seqStart, int seqEnd) {
+ ByteChunk res = new ByteChunk();
+ if (seqEnd + start > end)
+ res.setBytes(buff, start + seqStart, start + seqEnd);
+ return res;
+ }
}
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=641149&r1=641148&r2=641149&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
Tue Mar 25 21:55:13 2008
@@ -628,6 +628,10 @@
// -------------------- Hash code --------------------
+ public int hashCode() {
+ return hash();
+ }
+
// normal hash.
public int hash() {
int code=0;
@@ -703,15 +707,9 @@
}
public CharSequence subSequence(int start, int end) {
- try {
- CharChunk result = (CharChunk) this.clone();
- result.setOffset(this.start + start);
- result.setEnd(this.start + end);
- return result;
- } catch (CloneNotSupportedException e) {
- // Cannot happen
- return null;
- }
+ CharChunk result = new CharChunk();
+ result.setChars(buff, this.start + start, end - start);
+ return result;
}
public int length() {
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=641149&r1=641148&r2=641149&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
Tue Mar 25 21:55:13 2008
@@ -21,6 +21,7 @@
import java.util.*;
import java.io.Serializable;
import java.io.IOException;
+import java.nio.ByteBuffer;
/**
* This class is used to represent a subarray of bytes in an HTTP message.
@@ -34,7 +35,7 @@
* @author James Todd [EMAIL PROTECTED]
* @author Costin Manolache
*/
-public final class MessageBytes implements Cloneable, Serializable {
+public final class MessageBytes implements Cloneable, Serializable,
CharSequence {
// primary type ( whatever is set as original value )
private int type = T_NULL;
@@ -118,6 +119,15 @@
hasDateValue=false;
}
+ public void setBytes(ByteBuffer bb, int off, int len) {
+ byteC.setBytes( bb.array(), off, len );
+ type=T_BYTES;
+ hasStrValue=false;
+ hasHashCode=false;
+ hasIntValue=false;
+ hasLongValue=false;
+ hasDateValue=false;
+ }
/**
* Sets the content to the specified subarray of bytes.
@@ -127,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
@@ -258,8 +268,10 @@
}
toString();
type=T_BYTES;
- byte bb[] = strValue.getBytes();
- byteC.setBytes(bb, 0, bb.length);
+ if (strValue != null) {
+ byte bb[] = strValue.getBytes();
+ byteC.setBytes(bb, 0, bb.length);
+ }
}
/** Convert to char[] and fill the CharChunk.
@@ -298,6 +310,16 @@
// -------------------- equals --------------------
+ public boolean equals(Object o) {
+ if (o instanceof String) {
+ return equals((String) o);
+ }
+ if (o instanceof MessageBytes) {
+ return equals((MessageBytes) o);
+ }
+ return o == this;
+ }
+
/**
* Compares the message bytes to the specified String object.
* @param s the String to compare
@@ -376,15 +398,15 @@
* @param s the string
*/
public boolean startsWith(String s) {
- switch (type) {
- case T_STR:
- return strValue.startsWith( s );
- case T_CHARS:
- return charC.startsWith( s );
- case T_BYTES:
- return byteC.startsWith( s );
- default:
- return false;
+ switch (type) {
+ case T_STR:
+ return strValue.startsWith( s );
+ case T_CHARS:
+ return charC.startsWith( s );
+ case T_BYTES:
+ return byteC.startsWith( s );
+ default:
+ return false;
}
}
@@ -732,5 +754,41 @@
public MessageBytes newInstance() {
return new MessageBytes();
}
+ }
+
+ public char charAt(int index) {
+ switch (type) {
+ case T_STR:
+ return strValue.charAt(index);
+ case T_CHARS:
+ return charC.charAt(index);
+ case T_BYTES:
+ return byteC.charAt(index);
+ default:
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ }
+
+ public int length() {
+ return getLength();
+ }
+
+ public CharSequence subSequence(int start, int end) {
+ MessageBytes result = new MessageBytes();
+ result.type = type;
+ switch (type) {
+ case T_STR:
+ result.strValue = strValue.substring(start, end);
+ break;
+ case T_CHARS:
+ result.charC = (CharChunk) charC.subSequence(start, end);
+ break;
+ case T_BYTES:
+ result.byteC = (ByteChunk) byteC.subSequence(start, end);
+ break;
+ default:
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ return result;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]