svn commit: r320981 - in /tomcat/build/tc5.5.x/resources: runtime.MF server-embed.xml web-embed.xml
Author: costin Date: Thu Oct 13 19:55:57 2005 New Revision: 320981 URL: http://svn.apache.org/viewcvs?rev=320981&view=rev Log: Add missing files to build single jar. server-embed and web-embed are trimmed down/minimal versions. web.xml doesn't include jasper compiler - only precompiled jsps are supported, or using jasper in the app web.xml Added: tomcat/build/tc5.5.x/resources/runtime.MF tomcat/build/tc5.5.x/resources/server-embed.xml tomcat/build/tc5.5.x/resources/web-embed.xml Added: tomcat/build/tc5.5.x/resources/runtime.MF URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/resources/runtime.MF?rev=320981&view=auto == --- tomcat/build/tc5.5.x/resources/runtime.MF (added) +++ tomcat/build/tc5.5.x/resources/runtime.MF Thu Oct 13 19:55:57 2005 @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.6.2 +Created-By: 1.5.0-b64 (Sun Microsystems Inc.) +Main-Class: org.apache.catalina.startup.Bootstrap + Added: tomcat/build/tc5.5.x/resources/server-embed.xml URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/resources/server-embed.xml?rev=320981&view=auto == --- tomcat/build/tc5.5.x/resources/server-embed.xml (added) +++ tomcat/build/tc5.5.x/resources/server-embed.xml Thu Oct 13 19:55:57 2005 @@ -0,0 +1,8 @@ + + + + + + + + Added: tomcat/build/tc5.5.x/resources/web-embed.xml URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/resources/web-embed.xml?rev=320981&view=auto == --- tomcat/build/tc5.5.x/resources/web-embed.xml (added) +++ tomcat/build/tc5.5.x/resources/web-embed.xml Thu Oct 13 19:55:57 2005 @@ -0,0 +1,629 @@ + +http://java.sun.com/xml/ns/j2ee"; +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; +xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; +version="2.4"> + +default + org.apache.catalina.servlets.DefaultServlet + +debug +0 + + +listings +true + +1 + + +invoker + + org.apache.catalina.servlets.InvokerServlet + +2 + + +default +/ + + +invoker +/servlet/* + + +abs +audio/x-mpeg + + +ai +application/postscript + + +aif +audio/x-aiff + + +aifc +audio/x-aiff + + +aiff +audio/x-aiff + + +aim +application/x-aim + + +art +image/x-jg + + +asf +video/x-ms-asf + + +asx +video/x-ms-asf + + +au +audio/basic + + +avi +video/x-msvideo + + +avx +video/x-rad-screenplay + + +bcpio +application/x-bcpio + + +bin +application/octet-stream + + +bmp +image/bmp + + +body +text/html + + +cdf +application/x-cdf + + +cer +application/x-x509-ca-cert + + +class +application/java + + +cpio +application/x-cpio + + +csh +application/x-csh + + +css +text/css + + +dib +image/bmp + + +doc +application/msword + + +dtd +application/xml-dtd + + +dv +video/x-dv + + +dvi +application/x-dvi + + +eps +application/postscript + + +etx +text/x-setext + + +exe +application/octet-stream + + +gif +image/gif + + +gtar +application/x-gtar + + +gz +application/x-gzip + + +hdf +application/x-hdf + + +hqx +application/mac-binhex40 + + +htc +text/x-component + + +htm +text/html + + +html +text/html + + +hqx +application/mac-binhex40 + + +ief +image/ief + + +jad +text/vnd.sun.j2me.app-descriptor + + +jar +application/java-archive + + +java +text/plain + + +jnlp +application/x-java-jnlp-file + + +jpe +image/jpeg + + +jpeg +image/jpeg + + +jpg +image/jpeg + + +js +text/javascript + +
svn commit: r321299 - /tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java
Author: costin Date: Fri Oct 14 23:43:41 2005 New Revision: 321299 URL: http://svn.apache.org/viewcvs?rev=321299&view=rev Log: Added a couple of comments. Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=321299&r1=321298&r2=321299&view=diff == --- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/ByteChunk.java Fri Oct 14 23:43:41 2005 @@ -33,6 +33,8 @@ * to be able to parse the request without converting to string. */ +// TODO: This class could either extend ByteBuffer, or better a ByteBuffer inside +// this way it could provide the search/etc on ByteBuffer, as a helper. /** * This class is used to represent a chunk of bytes, and @@ -40,6 +42,19 @@ * * The buffer can be modified and used for both input and output. * + * There are 2 modes: The chunk can be associated with a sink - ByteInputChannel or ByteOutputChannel, + * which will be used when the buffer is empty ( on input ) or filled ( on output ). + * For output, it can also grow. This operating mode is selected by calling setLimit() or + * allocate(initial, limit) with limit != -1. + * + * Various search and append method are defined - similar with String and StringBuffer, but + * operating on bytes. + * + * This is important because it allows processing the http headers directly on the received bytes, + * without converting to chars and Strings until the strings are needed. In addition, the charset + * is determined later, from headers or user code. + * + * * @author [EMAIL PROTECTED] * @author James Todd [EMAIL PROTECTED] * @author Costin Manolache @@ -47,7 +62,10 @@ */ public final class ByteChunk implements Cloneable, Serializable { -// Input interface, used when the buffer is emptied. +/** Input interface, used when the buffer is emptiy + * + * Same as java.nio.channel.ReadableByteChannel + */ public static interface ByteInputChannel { /** * Read new bytes ( usually the internal conversion buffer ). @@ -57,7 +75,9 @@ public int realReadBytes(byte cbuf[], int off, int len) throws IOException; } -// Output interface, used when the buffer is filled. + +/** Same as java.nio.channel.WrittableByteChannel. + */ public static interface ByteOutputChannel { /** * Send the bytes ( usually the internal conversion buffer ). @@ -105,7 +125,7 @@ } // -public ByteChunk getClone() { +public ByteChunk getClone() { try { return (ByteChunk)this.clone(); } catch( Exception ex) { @@ -251,6 +271,11 @@ } // Adding data to the buffer +/** Append a char, by casting it to byte. This IS NOT intended for unicode. + * + * @param c + * @throws IOException + */ public void append( char c ) throws IOException { @@ -392,6 +417,11 @@ } +/** Send the buffer to the sink. Called by append() when the limit is reached. + * You can also call it explicitely to force the data to be written. + * + * @throws IOException + */ public void flushBuffer() throws IOException { @@ -777,7 +807,7 @@ /** - * Convert specified String to a byte array. + * 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r321300 - in /tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader: Loader.java Module.java ModuleClassLoader.java Repository.java RepositoryClassLoader.java
Author: costin Date: Fri Oct 14 23:45:43 2005 New Revision: 321300 URL: http://svn.apache.org/viewcvs?rev=321300&view=rev Log: More refactoring ( this package is not used in any existing code AFAIK, please let me know if I'm wrong ). This code is based on tomcat loader, but modified to make it more flexible and support reloading of tomcat components. Added: tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/RepositoryClassLoader.java Modified: tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Loader.java tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Module.java tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/ModuleClassLoader.java tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Repository.java Modified: tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Loader.java URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Loader.java?rev=321300&r1=321299&r2=321300&view=diff == --- tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Loader.java (original) +++ tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Loader.java Fri Oct 14 23:45:43 2005 @@ -854,7 +854,7 @@ } void notifyModuleStop(Module module) { -listener.moduleStop(module); +if( listener!=null ) listener.moduleStop(module); } /** Add a module listener. Modified: tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Module.java URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Module.java?rev=321300&r1=321299&r2=321300&view=diff == --- tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Module.java (original) +++ tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/Module.java Fri Oct 14 23:45:43 2005 @@ -167,6 +167,8 @@ ("Already started"); started = true; +log("start()"); + // Construct a class loader based on our current repositories list try { Modified: tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/ModuleClassLoader.java URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/ModuleClassLoader.java?rev=321300&r1=321299&r2=321300&view=diff == --- tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/ModuleClassLoader.java (original) +++ tomcat/connectors/trunk/util/loader/org/apache/tomcat/util/loader/ModuleClassLoader.java Fri Oct 14 23:45:43 2005 @@ -191,13 +191,16 @@ } private boolean dirCheck(File dir ) { -log("Checking " + dir ); +//log("Checking " + dir ); File subd[]=dir.listFiles(); for( int i=0; i< subd.length; i++ ) { long lm=subd[i].lastModified(); -if( lm > lastModified ) return true; +if( lm > lastModified ) { +log("Modified file: " + dir + " " + subd[i] + " " + lm + " " + lastModified); +return true; +} if( subd[i].isDirectory() ) { -if( dirCheck(subd[i]) ) return true; +return dirCheck(subd[i]); } } return false; @@ -215,10 +218,13 @@ for (int i = 0; i lastModified ) return true; +if( lm > lastModified ) { +log( "Modified file: " + f + " " + lm + " " + lastModified); +return true; +} // assume dirs are used only for debug and small if( f.isDirectory() ) { -if( dirCheck(f) ) return true; +return dirCheck(f); } } } @@ -242,7 +248,14 @@ * @exception ClassNotFoundException if the class was not found */ public Class findClass(String name) throws ClassNotFoundException { - +return findClass2(name, true); +} + +public Class findClass2(String name, boolean del2repo) throws ClassNotFoundException { +if( del2repo ) { +return ((RepositoryClassLoader)repository.getClassLoader()).findClass(name); +} // else + Class clazz = null; try { @@ -309,6 +322,13 @@ * @param name Name of the resource to be found */ public URL findResource(final String name) { +return findResource2( name, true); +} + +public URL find
svn commit: r321301 - /tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java
Author: costin Date: Fri Oct 14 23:56:28 2005 New Revision: 321301 URL: http://svn.apache.org/viewcvs?rev=321301&view=rev Log: Add few more comments, and a special case dealing with invalid shutdown ports - if -1 or -2 are specified, don't open any shutdown port, instead rely on the embedding app. This is only intended for 'runtime' - i.e. embeded case, where there is no reason to have a shutdown port for tomcat. It shouldn't hurt any existing use case tough. If you have a better suggestion, please let me know - I can easily replace this with something equivalent. Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java?rev=321301&r1=321300&r2=321301&view=diff == --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java Fri Oct 14 23:56:28 2005 @@ -179,6 +179,7 @@ */ protected PropertyChangeSupport support = new PropertyChangeSupport(this); +private boolean stopAwait = false; // - Properties @@ -331,12 +332,31 @@ } +public void stopAwait() { +stopAwait=true; +} /** * Wait until a proper shutdown command is received, then return. + * This keeps the main thread alive - the thread pool listening for http + * connections is daemon threads. */ public void await() { - +// Negative values - don't wait on port - tomcat is embedded or we just don't like ports +if( port == -2 ) { +// undocumented yet - for embedding apps that are around, alive. +return; +} +if( port==-1 ) { +while( true ) { +try { +Thread.sleep( 10 ); +} catch( InterruptedException ex ) { +} +if( stopAwait ) return; +} +} + // Set up a server socket to wait on ServerSocket serverSocket = null; try { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r326345 - /tomcat/build/tc5.5.x/build.xml
Author: costin Date: Tue Oct 18 19:52:21 2005 New Revision: 326345 URL: http://svn.apache.org/viewcvs?rev=326345&view=rev Log: Remove naming from runtime Modified: tomcat/build/tc5.5.x/build.xml Modified: tomcat/build/tc5.5.x/build.xml URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/build.xml?rev=326345&r1=326344&r2=326345&view=diff == --- tomcat/build/tc5.5.x/build.xml (original) +++ tomcat/build/tc5.5.x/build.xml Tue Oct 18 19:52:21 2005 @@ -1140,7 +1140,7 @@ - + @@ -1150,23 +1150,20 @@ description="Build single jar tomcat"> - - + + - - + - - @@ -1186,6 +1183,8 @@ + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r329043 - /tomcat/connectors/trunk/jni/native/os/unix/system.c
Author: costin Date: Thu Oct 27 19:32:35 2005 New Revision: 329043 URL: http://svn.apache.org/viewcvs?rev=329043&view=rev Log: On some systems, LOG_WARN doesn't exist - it is called LOG_WARNING. ( for example - current versions of Suse, Redhat ) Modified: tomcat/connectors/trunk/jni/native/os/unix/system.c Modified: tomcat/connectors/trunk/jni/native/os/unix/system.c URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/os/unix/system.c?rev=329043&r1=329042&r2=329043&view=diff == --- tomcat/connectors/trunk/jni/native/os/unix/system.c (original) +++ tomcat/connectors/trunk/jni/native/os/unix/system.c Thu Oct 27 19:32:35 2005 @@ -38,6 +38,10 @@ #include #include +#ifndef LOG_WARN +#define LOG_WARN LOG_WARNING +#endif + #if defined(sun) #define MAX_PROC_PATH_LEN 64 #define MAX_CPUS 512 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r329053 - in /tomcat/sandbox/java: ./ org/ org/apache/ org/apache/commons/ org/apache/commons/logging/
Author: costin Date: Thu Oct 27 19:55:08 2005 New Revision: 329053 URL: http://svn.apache.org/viewcvs?rev=329053&view=rev Log: Implementation of commons-logging that doesn't use any discovery or tricks, just plain java.util.logging. There is a trick actually - at startup it'll try to load a different handler ( without 2-lines logs ) and a different config ( from classpath like log4j ). I'll probably remove this later, but I can't stand the default handler and behavior Added: tomcat/sandbox/java/ tomcat/sandbox/java/org/ tomcat/sandbox/java/org/apache/ tomcat/sandbox/java/org/apache/commons/ tomcat/sandbox/java/org/apache/commons/logging/ tomcat/sandbox/java/org/apache/commons/logging/DirectJDKLog.java tomcat/sandbox/java/org/apache/commons/logging/Log.java tomcat/sandbox/java/org/apache/commons/logging/LogConfigurationException.java tomcat/sandbox/java/org/apache/commons/logging/LogFactory.java Added: tomcat/sandbox/java/org/apache/commons/logging/DirectJDKLog.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/commons/logging/DirectJDKLog.java?rev=329053&view=auto == --- tomcat/sandbox/java/org/apache/commons/logging/DirectJDKLog.java (added) +++ tomcat/sandbox/java/org/apache/commons/logging/DirectJDKLog.java Thu Oct 27 19:55:08 2005 @@ -0,0 +1,185 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2004 Costin Manolache + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.logging; + +import java.util.logging.ConsoleHandler; +import java.util.logging.Formatter; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + + +/** + * Hardcoded java.util.logging commons-logging implementation. + * + * In addition, it curr + * + */ +class DirectJDKLog implements Log { +// no reason to hide this - but good reasons to not hide +public Logger logger; + +/** Alternate config reader and console format + */ +private static final String SIMPLE_FMT="org.apache.tomcat.util.log.JdkLoggerFormatter"; +private static final String SIMPLE_CFG="org.apache.tomcat.util.log.JdkLoggerConfig"; + +static { +if( System.getProperty("java.util.logging.config.class") ==null && +System.getProperty("java.util.logging.config.file") ==null ) { +// default configuration - it sucks. Let's override at least the +// formatter for the console +try { +Class.forName(SIMPLE_CFG).newInstance(); +} catch( Throwable t ) { +} +try { +Formatter fmt=(Formatter)Class.forName(SIMPLE_FMT).newInstance(); +// it is also possible that the user modifed jre/lib/logging.properties - +// but that's really stupid in most cases +Logger root=Logger.getLogger(""); +Handler handlers[]=root.getHandlers(); +for( int i=0; i< handlers.length; i++ ) { +// I only care about console - that's what's used in default config anyway +if( handlers[i] instanceof ConsoleHandler ) { +handlers[i].setFormatter(fmt); +} +} +} catch( Throwable t ) { +// maybe it wasn't included - the ugly default will be used. +t.printStackTrace(); +} + +} else { +System.out.println(System.getProperties()); +} +} + +public DirectJDKLog(String name ) { +logger=Logger.getLogger(name); +} + +public final boolean isErrorEnabled() { +return logger.isLoggable(Level.SEVERE); +} + +public final boolean isWarnEnabled() { +return logger.isLoggable(Level.WARNING); +} + +public final boolean isInfoEnabled() { +return logger.isLoggable(Level.INFO); +} + +public final boolean isDebugEnabled() { +return logger.isLoggable(Level.FINE); +} + +public final boolean isFatalEnabled() { +return logger.isLoggable(Level.SEVERE); +} +
svn commit: r329054 - in /tomcat/sandbox/java/org/apache/tomcat: ./ util/ util/log/ util/log/JdkLoggerConfig.java util/log/JdkLoggerFormatter.java
Author: costin Date: Thu Oct 27 19:56:34 2005 New Revision: 329054 URL: http://svn.apache.org/viewcvs?rev=329054&view=rev Log: Handler and config for java.util.logging. Added: tomcat/sandbox/java/org/apache/tomcat/ tomcat/sandbox/java/org/apache/tomcat/util/ tomcat/sandbox/java/org/apache/tomcat/util/log/ tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerConfig.java tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java Added: tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerConfig.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerConfig.java?rev=329054&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerConfig.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerConfig.java Thu Oct 27 19:56:34 2005 @@ -0,0 +1,108 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2004 Costin Manolache + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.log; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.logging.LogManager; + +/** + */ +public class JdkLoggerConfig { + +public JdkLoggerConfig() { +InputStream is=getConfig( "logging" ); +if( is!=null ) { +try { +LogManager.getLogManager().readConfiguration(is); +} catch (SecurityException e) { +e.printStackTrace(); +} catch (IOException e) { +e.printStackTrace(); +} +} +} + +/** Locate a config stream: + * + * Uses: + * - logging.configuration system property + * - ./logging.properties file + * - conf/logging.properties + * - logging.properties in classpath + * + * @return + */ +public static InputStream getConfig(String base) { +//String base="logging"; // "log4j" +// Initialize: +// 1. Find config file name +String confF=System.getProperty(base + ".configuration"); +if( confF!=null ) { +// Check if it is a path +} else { +confF=base + ".properties"; +} + +// URL +try { +URL url=new URL( confF ); +InputStream is=url.openStream(); +if( is!=null ) return is; +} catch( Throwable t ) { + +} + +// 2. Try to get the config from a file ( or conf/ ) +File f=new File( confF ); +if( ! f.exists() ) { +f=new File( "conf/" + confF ); +} + +if( f.exists() ) { +try { +return new FileInputStream( f ); +} catch (FileNotFoundException e) { +// ignore +} +} + +// 3. Load it from CLASSPATH +InputStream is=JdkLoggerConfig.class.getResourceAsStream( confF ); + +//No thread class loader +if( is!= null ) return is; + +f=new File( System.getProperty("java.home")); +f=new File( f, "lib/logging.properties"); +if( f.exists() ) { +try { +return new FileInputStream(f); +} catch (FileNotFoundException e) { +//e.printStackTrace(); +} +} +System.err.println("default logging doesn't exists" + f); + +return null; +} +} Added: tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java?rev=329054&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java Thu Oct 27 19:56:34 2005 @@ -0,0 +1,109 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2004 Costin Manolache + * + * Licensed under the Apache License, Version 2.0 (the "License&qu
svn commit: r329055 - /tomcat/sandbox/README.txt
Author: costin Date: Thu Oct 27 20:01:20 2005 New Revision: 329055 URL: http://svn.apache.org/viewcvs?rev=329055&view=rev Log: A small comment on source organization. Modified: tomcat/sandbox/README.txt Modified: tomcat/sandbox/README.txt URL: http://svn.apache.org/viewcvs/tomcat/sandbox/README.txt?rev=329055&r1=329054&r2=329055&view=diff == --- tomcat/sandbox/README.txt (original) +++ tomcat/sandbox/README.txt Thu Oct 27 20:01:20 2005 @@ -33,6 +33,16 @@ svn mkdir https://svn.apache.org/repos/asf/tomcat/sandbox/component/branches svn mkdir https://svn.apache.org/repos/asf/tomcat/sandbox/component/tags +Alternatively, you can use the java/ directory. If possible: +1. create a new package ( or few ) for each module +2. if you have an external dependency for an optional component - create a new package. +3. Update the top level build.xml file with targets for your module - use patterns instead +of exclude. + +The single tree may help increase visibility of the source code. We are in 2005 ( or more ), build tools +and IDEs have very good support for include/exclude patterns, we have tools to find dependencies between +packages, and we have a single community, so we don't need fragmented source trees and more, at least in +sandbox. Releases - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r329852 - in /tomcat/sandbox/java/org/apache/tomcat/util/buf/res: ./ LocalStrings.properties LocalStrings_es.properties LocalStrings_fr.properties LocalStrings_ja.properties
Author: costin Date: Mon Oct 31 08:38:34 2005 New Revision: 329852 URL: http://svn.apache.org/viewcvs?rev=329852&view=rev Log: Forgot to copy res - without it it doesn't work. Added: tomcat/sandbox/java/org/apache/tomcat/util/buf/res/ tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings.properties tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties Added: tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings.properties URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings.properties?rev=329852&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings.properties (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings.properties Mon Oct 31 08:38:34 2005 @@ -0,0 +1,3 @@ +hexUtil.bad=Bad hexadecimal digit +hexUtil.odd=Odd number of hexadecimal digits +httpDate.pe=invalid date format: {0} Added: tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties?rev=329852&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties Mon Oct 31 08:38:34 2005 @@ -0,0 +1,4 @@ +hexUtil.bad=Dígito hexadecimal incorrecto +hexUtil.odd=Número de dígitos hexadecimales incorrecto +httpDate.pe=formato de fecha no válido: {0} + Added: tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties?rev=329852&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties Mon Oct 31 08:38:34 2005 @@ -0,0 +1,3 @@ +hexUtil.bad=Mauvais digit hexadécimal +hexUtil.odd=Nombre impair de digits hexadécimaux +httpDate.pe=Format de date invalide: {0} Added: tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties?rev=329852&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties Mon Oct 31 08:38:34 2005 @@ -0,0 +1,3 @@ +hexUtil.bad=\u7121\u52b9\u306a16\u9032\u6570\u5024\u3067\u3059 +hexUtil.odd=\u5947\u6570\u6841\u306e16\u9032\u6570\u5024\u3067\u3059 +httpDate.pe=\u7121\u52b9\u306a\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059: {0} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r329853 - /tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java
Author: costin Date: Mon Oct 31 08:39:42 2005 New Revision: 329853 URL: http://svn.apache.org/viewcvs?rev=329853&view=rev Log: First step of the refactoring. Replaced byte[], int start, int end with a ByteBuffer. Replaced all the code using the byte[] with the equivalent. Compiles - but I haven't tested it, that would be step 2. Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=329853&r1=329852&r2=329853&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Mon Oct 31 08:39:42 2005 @@ -18,6 +18,10 @@ import java.io.IOException; import java.io.Serializable; +import java.nio.ByteBuffer; + +import sun.security.krb5.internal.crypto.b; +import sun.security.krb5.internal.crypto.t; /* * In a server it is very important to be able to operate on @@ -33,9 +37,6 @@ * to be able to parse the request without converting to string. */ -// TODO: This class could either extend ByteBuffer, or better a ByteBuffer inside -// this way it could provide the search/etc on ByteBuffer, as a helper. - /** * This class is used to represent a chunk of bytes, and * utilities to manipulate byte[]. @@ -65,6 +66,8 @@ /** Input interface, used when the buffer is emptiy * * Same as java.nio.channel.ReadableByteChannel + * It is used in InputBuffer class in connector. + * @deprecated Use RedableByteChannel */ public static interface ByteInputChannel { /** @@ -77,6 +80,8 @@ } /** Same as java.nio.channel.WrittableByteChannel. + * + * @deprecated use WrittableByteChannel */ public static interface ByteOutputChannel { /** @@ -95,16 +100,19 @@ */ public static final String DEFAULT_CHARACTER_ENCODING="ISO-8859-1"; -// byte[] -private byte[] buff; +private ByteBuffer bb; + +// old style - while I'm updating +//private byte[] buff; -private int start=0; -private int end; +//private int start=0; // bb.getPosition() +//private int end; // bb.getLimit() private String enc; -private boolean isSet=false; // XXX - +// true if null. Is this used ?? +private boolean isSet=false; + // How much can it grow, when data is added private int limit=-1; @@ -125,6 +133,15 @@ } // + +public void setByteBuffer(ByteBuffer buf) { +bb=buf; +} + +public ByteBuffer getByteBuffer() { +return bb; +} + public ByteChunk getClone() { try { return (ByteChunk)this.clone(); @@ -133,6 +150,9 @@ } } +/** @deprecated The buffer shouldn't be null - track this on the + * MessageBytes. + */ public boolean isNull() { return ! isSet; // buff==null; } @@ -143,25 +163,32 @@ public void recycle() { // buff = null; enc=null; - start=0; - end=0; + //start=0; + //end=0; isSet=false; +if( bb!=null ) bb.clear(); } public void reset() { - buff=null; +// buff=null; +bb=null; } // Setup public void allocate( int initial, int limit ) { isOutput=true; - if( buff==null || buff.length < initial ) { - buff=new byte[initial]; - } +if( bb==null || bb.capacity() < initial ) { +bb=ByteBuffer.allocate( initial ); +} + +// if( buff==null || buff.length < initial ) { +// buff=new byte[initial]; +// } + this.limit=limit; - start=0; - end=0; + //start=0; + //end=0; isSet=true; } @@ -171,12 +198,15 @@ * @param b the ascii bytes * @param off the start offset of the bytes * @param len the length of the bytes + * @deprecated use getByteBuffer().wrap( b, off, len ) */ public void setBytes(byte[] b, int off, int len) { -buff = b; -start = off; -end = start+ len; +//buff = b; +//start = off; +//end = start+ len; isSet=true; + +bb=ByteBuffer.wrap(b, off, len); } public void setOptimizedWrite(boolean optimizedWrite) { @@ -186,6 +216,7 @@ public void setEncoding( String enc ) { this.enc=enc; } + public String getEncoding() { if (enc == null) enc=DEFAULT_CHARACTER_ENCODING; @@ -194,6 +225,7 @@ /** * Returns the message bytes. + * @deprecated use getBuffer() ( or better
svn commit: r330199 - /tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java
Author: costin Date: Tue Nov 1 22:39:17 2005 New Revision: 330199 URL: http://svn.apache.org/viewcvs?rev=330199&view=rev Log: Well, NIO ByteBuffer is the most horrible interface in java. Whoever invented the flip() interface - and a buffer where you can't know where it starts and where it ends and where is the data - should be ashamed... The only way we can use the buffer is by keeping track of start and end as before, anything that uses position() or limit() will never know if it's reading or writting or if the buffer has flipped. The use of ByteBuffer is still a good thing - if you ignore the stupid interface, as is the only way to work with direct and mapped byte[], and maybe in a smarter VM get some buffers that are not relocated. It is also usefull because it can work with the usefull parts of nio - like charset and channels. Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=330199&r1=330198&r2=330199&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Tue Nov 1 22:39:17 2005 @@ -20,9 +20,6 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import sun.security.krb5.internal.crypto.b; -import sun.security.krb5.internal.crypto.t; - /* * In a server it is very important to be able to operate on * the original byte[] without converting everything to chars. @@ -37,6 +34,9 @@ * to be able to parse the request without converting to string. */ +// TODO: This class could either extend ByteBuffer, or better a ByteBuffer inside +// this way it could provide the search/etc on ByteBuffer, as a helper. + /** * This class is used to represent a chunk of bytes, and * utilities to manipulate byte[]. @@ -66,8 +66,6 @@ /** Input interface, used when the buffer is emptiy * * Same as java.nio.channel.ReadableByteChannel - * It is used in InputBuffer class in connector. - * @deprecated Use RedableByteChannel */ public static interface ByteInputChannel { /** @@ -80,8 +78,6 @@ } /** Same as java.nio.channel.WrittableByteChannel. - * - * @deprecated use WrittableByteChannel */ public static interface ByteOutputChannel { /** @@ -100,19 +96,17 @@ */ public static final String DEFAULT_CHARACTER_ENCODING="ISO-8859-1"; +// byte[] +//private byte[] buff; private ByteBuffer bb; -// old style - while I'm updating -//private byte[] buff; - -//private int start=0; // bb.getPosition() -//private int end; // bb.getLimit() +private int start=0; +private int end; private String enc; -// true if null. Is this used ?? -private boolean isSet=false; - +private boolean isSet=false; // XXX + // How much can it grow, when data is added private int limit=-1; @@ -133,15 +127,6 @@ } // - -public void setByteBuffer(ByteBuffer buf) { -bb=buf; -} - -public ByteBuffer getByteBuffer() { -return bb; -} - public ByteChunk getClone() { try { return (ByteChunk)this.clone(); @@ -150,9 +135,6 @@ } } -/** @deprecated The buffer shouldn't be null - track this on the - * MessageBytes. - */ public boolean isNull() { return ! isSet; // buff==null; } @@ -163,32 +145,26 @@ public void recycle() { // buff = null; enc=null; - //start=0; - //end=0; + start=0; + end=0; isSet=false; -if( bb!=null ) bb.clear(); } public void reset() { -// buff=null; -bb=null; + bb=null; } // Setup public void allocate( int initial, int limit ) { isOutput=true; -if( bb==null || bb.capacity() < initial ) { -bb=ByteBuffer.allocate( initial ); -} - -// if( buff==null || buff.length < initial ) { -// buff=new byte[initial]; -// } - + if( bb==null || bb.capacity() < initial ) { + //buff=new byte[initial]; +bb=ByteBuffer.allocate(initial); + } this.limit=limit; - //start=0; - //end=0; + start=0; + end=0; isSet=true; } @@ -198,15 +174,13 @@ * @param b the ascii bytes * @param off the start offset of the bytes * @param len the length of the bytes - * @deprecated use getByteBuffer().wrap( b, off, len ) */ public void setBytes(byte[] b, int off,
svn commit: r331062 - in /tomcat/sandbox/java/org/apache/coyote: ./ adapters/ standalone/
Author: costin Date: Sat Nov 5 19:13:06 2005 New Revision: 331062 URL: http://svn.apache.org/viewcvs?rev=331062&view=rev Log: Code for testing ( and using ) coyote standalone. The adapters are very simple, more as example. The goal is to have a minimal http connector, and play with nio and other apis in a simpler environment About MessageWriter and MessageReader - they are copies of Catalina/connector/OutputBuffer and InputBuffer. Renamed to avoid confusion. Long term, they should be part of o.a.coyote package, there is no dep on catalina and are usefull in in connector. Added: tomcat/sandbox/java/org/apache/coyote/ tomcat/sandbox/java/org/apache/coyote/adapters/ tomcat/sandbox/java/org/apache/coyote/adapters/Counters.java tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java tomcat/sandbox/java/org/apache/coyote/adapters/HelloWorldAdapter.java tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java tomcat/sandbox/java/org/apache/coyote/adapters/Mapper.java tomcat/sandbox/java/org/apache/coyote/standalone/ tomcat/sandbox/java/org/apache/coyote/standalone/ClientAbortException.java tomcat/sandbox/java/org/apache/coyote/standalone/Main.java tomcat/sandbox/java/org/apache/coyote/standalone/MessageReader.java tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java Added: tomcat/sandbox/java/org/apache/coyote/adapters/Counters.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/adapters/Counters.java?rev=331062&view=auto == --- tomcat/sandbox/java/org/apache/coyote/adapters/Counters.java (added) +++ tomcat/sandbox/java/org/apache/coyote/adapters/Counters.java Sat Nov 5 19:13:06 2005 @@ -0,0 +1,78 @@ +package org.apache.coyote.adapters; + +import java.util.List; +import java.util.ArrayList; + +import org.apache.coyote.Adapter; +import org.apache.coyote.Request; +import org.apache.coyote.Response; + +/** + * Used to collect statistics to evaluate performance of the coyote layer. + * + */ +public class Counters implements Adapter { + +// per thread +public static class CountData { +public long time; +public long requests; +public int exceptions; +} + +// quick hack - need to move the per-thread code from tomcat +List counters=new ArrayList(); +ThreadLocal tl=new ThreadLocal(); + +Adapter next; + +public Counters() { +} + +public void setNext( Adapter adapter ) { +next=adapter; +} + +public Adapter getNext( ) { +return next; +} + +public void service(Request req, final Response res) throws Exception { +long t0=System.currentTimeMillis(); +CountData cnt=(CountData)tl.get(); +if( cnt == null ) { +cnt=new CountData(); +counters.add( cnt ); +tl.set( cnt ); +// TODO: deal with thread death +} + +cnt.requests++; +try { +next.service(req,res); +} catch( Exception ex ) { +cnt.exceptions++; +throw ex; +} finally { +long t1=System.currentTimeMillis(); +cnt.time+=( t1-t0); +} + +} + +/** Returns statistics for the server. + * TODO: make it per thread, agregate all threads + * + * @return + */ +public CountData getCounts() { +CountData total=new CountData(); +for( int i=0; i< counters.size(); i++ ) { +CountData cd=((CountData)counters.get(i)); +total.requests+= cd.requests; +total.time+=cd.time; +total.exceptions+=cd.exceptions; +} +return total; +} +} \ No newline at end of file Added: tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java?rev=331062&view=auto == --- tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java (added) +++ tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java Sat Nov 5 19:13:06 2005 @@ -0,0 +1,127 @@ +package org.apache.coyote.adapters; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.coyote.Adapter; +import org.apache.coyote.Request; +import org.apache.coyote.Response; +import org.apache.coyote.standalone.MessageWriter; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.buf.C2BConverter; + +/** + * Serve a static file. This is the traditional method, a separate adapter could + * use Sendfile. + * + * No fancy things. Not sure if it should have d
svn commit: r331237 - /tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java
Author: costin Date: Mon Nov 7 00:04:21 2005 New Revision: 331237 URL: http://svn.apache.org/viewcvs?rev=331237&view=rev Log: Move UEncoder to nio. Deprecate most of the methods - they don't seem to be in use in 5.5 and are pretty bad ( Writer ). In fact - the entire class could be cleaned up and replaced, maybe with one method in MessageBytes. Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java?rev=331237&r1=331236&r2=331237&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/UEncoder.java Mon Nov 7 00:04:21 2005 @@ -19,6 +19,10 @@ import java.io.CharArrayWriter; import java.io.IOException; import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetEncoder; import java.util.BitSet; /** Efficient implementation for encoders. @@ -39,51 +43,73 @@ // Not static - the set may differ ( it's better than adding // an extra check for "/", "+", etc private BitSet safeChars=null; -private C2BConverter c2b=null; -private ByteChunk bb=null; +private CharsetEncoder c2b=null; +//private C2BConverter c2b=null; +private ByteBuffer bb=null; private String encoding="UTF8"; private static final int debug=0; + +private CharBuffer cb; public UEncoder() { initSafeChars(); } +// Doesn't seem to be used. Even if it would - it may need additional +// work to reset it. public void setEncoding( String s ) { encoding=s; } +/** Characters that should not be encoded. + * Typically "/". + * + * @param c + */ public void addSafeCharacter( char c ) { safeChars.set( c ); } /** URL Encode string, using a specified encoding. + * + * Doesn't appear to be used outside * * @param buf The writer * @param s string to be encoded * @throws IOException If an I/O error occurs + * @deprecated Shouldn't be public - requires writer, should be simpler */ public void urlEncode( Writer buf, String s ) throws IOException { if( c2b==null ) { - bb=new ByteChunk(16); // small enough. - c2b=new C2BConverter( bb, encoding ); + bb=ByteBuffer.allocate(16); // small enough. + c2b=Charset.forName("UTF8").newEncoder(); +//new C2BConverter( bb, encoding ); + cb = CharBuffer.allocate(4); } - for (int i = 0; i < s.length(); i++) { +for (int i = 0; i < s.length(); i++) { int c = (int) s.charAt(i); if( safeChars.get( c ) ) { - if( debug > 0 ) log("Safe: " + (char)c); + //if( debug > 0 ) log("Safe: " + (char)c); buf.write((char)c); } else { - if( debug > 0 ) log("Unsafe: " + (char)c); - c2b.convert( (char)c ); + //if( debug > 0 ) log("Unsafe: " + (char)c); +cb.append((char)c); +cb.flip(); +c2b.encode(cb, bb, true); + //c2b.convert( (char)c ); // "surrogate" - UTF is _not_ 16 bit, but 21 // ( while UCS is 31 ). Amazing... - if (c >= 0xD800 && c <= 0xDBFF) { + /* + * I think this is going to be handled by + * c2b. + * +if (c >= 0xD800 && c <= 0xDBFF) { if ( (i+1) < s.length()) { int d = (int) s.charAt(i+1); if (d >= 0xDC00 && d <= 0xDFFF) { @@ -93,17 +119,23 @@ } } } +*/ - c2b.flushBuffer(); + c2b.flush(bb); - urlEncode( buf, bb.getBuffer(), bb.getOffset(), - bb.getLength() ); - bb.recycle(); + urlEncode( buf, bb.array(), bb.arrayOffset(), + bb.position() ); + bb.clear(); +cb.clear(); +c2b.reset(); + } } } /** + * Doesn't appear to be used outside. + * @deprecated shouldn't be public, bad API */ public void urlEncode( Writer buf, byte bytes[], int off, int len) throws IOException @@ -1
svn commit: r331238 - in /tomcat/sandbox/test: ./ org/ org/apache/ org/apache/tomcat/ org/apache/tomcat/util/ org/apache/tomcat/util/buf/ org/apache/tomcat/util/buf/UEncoderTest.java org/apache/tomcat
Author: costin Date: Mon Nov 7 00:05:25 2005 New Revision: 331238 URL: http://svn.apache.org/viewcvs?rev=331238&view=rev Log: A simple test case - extremely incomplete, but usefull to track the nio conversion. Added: tomcat/sandbox/test/ tomcat/sandbox/test/org/ tomcat/sandbox/test/org/apache/ tomcat/sandbox/test/org/apache/tomcat/ tomcat/sandbox/test/org/apache/tomcat/util/ tomcat/sandbox/test/org/apache/tomcat/util/buf/ tomcat/sandbox/test/org/apache/tomcat/util/buf/UEncoderTest.java tomcat/sandbox/test/org/apache/tomcat/util/nio/ Added: tomcat/sandbox/test/org/apache/tomcat/util/buf/UEncoderTest.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/test/org/apache/tomcat/util/buf/UEncoderTest.java?rev=331238&view=auto == --- tomcat/sandbox/test/org/apache/tomcat/util/buf/UEncoderTest.java (added) +++ tomcat/sandbox/test/org/apache/tomcat/util/buf/UEncoderTest.java Mon Nov 7 00:05:25 2005 @@ -0,0 +1,40 @@ +/* + */ +package org.apache.tomcat.util.buf; + +import junit.framework.TestCase; + +public class UEncoderTest extends TestCase { +UEncoder enc=new UEncoder(); + +public static void main(String[] args) { +} + + +/* + * + * Test method for 'org.apache.tomcat.util.buf.UEncoder.encodeURL(String)' + * TODO: find the relevant rfc and apache tests and add more + */ +public void testEncodeURL() { + +String eurl1=enc.encodeURL("test"); +assertEquals("test", eurl1); + +eurl1=enc.encodeURL("/test"); +assertEquals("%2ftest", eurl1); + +// safe ranges +eurl1=enc.encodeURL("test$-_."); +assertEquals("test$-_.", eurl1); + +eurl1=enc.encodeURL("test$-_.!*'(),"); +assertEquals("test$-_.!*'(),", eurl1); + +eurl1=enc.encodeURL("//test"); +assertEquals("%2f%2ftest", eurl1); + + +} + +} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332735 - /tomcat/connectors/trunk/.project
Author: costin Date: Fri Nov 11 22:00:03 2005 New Revision: 332735 URL: http://svn.apache.org/viewcvs?rev=332735&view=rev Log: Lower cap - so eclipse checkout will create a dir that is lower cap - matching how the dir is called in the tree. Modified: tomcat/connectors/trunk/.project Modified: tomcat/connectors/trunk/.project URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/.project?rev=332735&r1=332734&r2=332735&view=diff == --- tomcat/connectors/trunk/.project (original) +++ tomcat/connectors/trunk/.project Fri Nov 11 22:00:03 2005 @@ -1,6 +1,6 @@ - Connectors + connectors - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332736 - /tomcat/container/tc5.5.x/.project
Author: costin Date: Fri Nov 11 22:00:53 2005 New Revision: 332736 URL: http://svn.apache.org/viewcvs?rev=332736&view=rev Log: Same, lower cap name Modified: tomcat/container/tc5.5.x/.project Modified: tomcat/container/tc5.5.x/.project URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/.project?rev=332736&r1=332735&r2=332736&view=diff == --- tomcat/container/tc5.5.x/.project (original) +++ tomcat/container/tc5.5.x/.project Fri Nov 11 22:00:53 2005 @@ -1,6 +1,6 @@ - Container + container - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332738 - /tomcat/build/tc5.5.x/.project
Author: costin Date: Fri Nov 11 22:53:36 2005 New Revision: 332738 URL: http://svn.apache.org/viewcvs?rev=332738&view=rev Log: Add a project here as well, for checkout to work. The only solution I found so far to use eclipse and svn is to do a checkout from the repostiory - 'share project' or import existing project - or any other thing - fails. This seems to kind-of-work for me. BTW - I can't even see the current/ How is everyone using eclipse with svn ?? Added: tomcat/build/tc5.5.x/.project Added: tomcat/build/tc5.5.x/.project URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/.project?rev=332738&view=auto == --- tomcat/build/tc5.5.x/.project (added) +++ tomcat/build/tc5.5.x/.project Fri Nov 11 22:53:36 2005 @@ -0,0 +1,17 @@ + + + build + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332739 - /tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project
Author: costin Date: Fri Nov 11 23:58:55 2005 New Revision: 332739 URL: http://svn.apache.org/viewcvs?rev=332739&view=rev Log: Rename to match the name in svn and ant files Modified: tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project Modified: tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project URL: http://svn.apache.org/viewcvs/tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project?rev=332739&r1=332738&r2=332739&view=diff == --- tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project (original) +++ tomcat/servletapi/servlet2.4-jsp2.0-tc5.x/.project Fri Nov 11 23:58:55 2005 @@ -1,6 +1,6 @@ - ServletAPI + servletapi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332741 - /tomcat/connectors/trunk/.classpath
Author: costin Date: Sat Nov 12 00:04:03 2005 New Revision: 332741 URL: http://svn.apache.org/viewcvs?rev=332741&view=rev Log: PureTLS is not normally donwloaded by "ant download", it is optional - let's exclude it from eclipse project so it's easier for people to get started. Modified: tomcat/connectors/trunk/.classpath Modified: tomcat/connectors/trunk/.classpath URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/.classpath?rev=332741&r1=332740&r2=332741&view=diff == --- tomcat/connectors/trunk/.classpath (original) +++ tomcat/connectors/trunk/.classpath Sat Nov 12 00:04:03 2005 @@ -5,14 +5,13 @@ - + - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332742 - /tomcat/container/tc5.5.x/.classpath
Author: costin Date: Sat Nov 12 00:05:31 2005 New Revision: 332742 URL: http://svn.apache.org/viewcvs?rev=332742&view=rev Log: Activation and mail are not typically available, require manual download. To make it easier for users - let's remove them by default. Renamed the dependencies to match the project names Modified: tomcat/container/tc5.5.x/.classpath Modified: tomcat/container/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/.classpath?rev=332742&r1=332741&r2=332742&view=diff == --- tomcat/container/tc5.5.x/.classpath (original) +++ tomcat/container/tc5.5.x/.classpath Sat Nov 12 00:05:31 2005 @@ -1,6 +1,6 @@ - + @@ -10,10 +10,9 @@ - - + @@ -25,7 +24,7 @@ - - + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332806 - in /tomcat/jasper/tc5.5.x: .classpath .project
Author: costin Date: Sat Nov 12 10:07:58 2005 New Revision: 332806 URL: http://svn.apache.org/viewcvs?rev=332806&view=rev Log: Another change - sorry if I mess up everything, but the svn plugin is really frustrating and I think it is important to have a consistent environment when working in eclise and in ant/CLI. Added: tomcat/jasper/tc5.5.x/.classpath tomcat/jasper/tc5.5.x/.project Added: tomcat/jasper/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/.classpath?rev=332806&view=auto == --- tomcat/jasper/tc5.5.x/.classpath (added) +++ tomcat/jasper/tc5.5.x/.classpath Sat Nov 12 10:07:58 2005 @@ -0,0 +1,11 @@ + + + + + + + + + + + Added: tomcat/jasper/tc5.5.x/.project URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/.project?rev=332806&view=auto == --- tomcat/jasper/tc5.5.x/.project (added) +++ tomcat/jasper/tc5.5.x/.project Sat Nov 12 10:07:58 2005 @@ -0,0 +1,17 @@ + + + jasper + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332808 - /tomcat/jasper/tc5.5.x/.classpath
Author: costin Date: Sat Nov 12 10:20:20 2005 New Revision: 332808 URL: http://svn.apache.org/viewcvs?rev=332808&view=rev Log: Small fix to depend on servletapi Modified: tomcat/jasper/tc5.5.x/.classpath Modified: tomcat/jasper/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/.classpath?rev=332808&r1=332807&r2=332808&view=diff == --- tomcat/jasper/tc5.5.x/.classpath (original) +++ tomcat/jasper/tc5.5.x/.classpath Sat Nov 12 10:20:20 2005 @@ -2,10 +2,10 @@ - + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332811 - in /tomcat/container/tc5.5.x: .classpath Tomcat5.5.launch
Author: costin Date: Sat Nov 12 10:24:05 2005 New Revision: 332811 URL: http://svn.apache.org/viewcvs?rev=332811&view=rev Log: Add dep on build ( so resources is visible ). Add a launcher to start tomcat. It doesn't work completely - some dtds are not found. It would work if I would depend on the servlet.jar in repository. Added: tomcat/container/tc5.5.x/Tomcat5.5.launch Modified: tomcat/container/tc5.5.x/.classpath Modified: tomcat/container/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/.classpath?rev=332811&r1=332810&r2=332811&view=diff == --- tomcat/container/tc5.5.x/.classpath (original) +++ tomcat/container/tc5.5.x/.classpath Sat Nov 12 10:24:05 2005 @@ -26,5 +26,6 @@ + Added: tomcat/container/tc5.5.x/Tomcat5.5.launch URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/Tomcat5.5.launch?rev=332811&view=auto == --- tomcat/container/tc5.5.x/Tomcat5.5.launch (added) +++ tomcat/container/tc5.5.x/Tomcat5.5.launch Sat Nov 12 10:24:05 2005 @@ -0,0 +1,12 @@ + + + + + + + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332865 - /tomcat/jasper/tc5.5.x/jasper2/.project
Author: costin Date: Sat Nov 12 16:58:32 2005 New Revision: 332865 URL: http://svn.apache.org/viewcvs?rev=332865&view=rev Log: Rename to match the dir ( well, not the dir in svn - but the local one that build.xml expects ) Modified: tomcat/jasper/tc5.5.x/jasper2/.project Modified: tomcat/jasper/tc5.5.x/jasper2/.project URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/jasper2/.project?rev=332865&r1=332864&r2=332865&view=diff == --- tomcat/jasper/tc5.5.x/jasper2/.project (original) +++ tomcat/jasper/tc5.5.x/jasper2/.project Sat Nov 12 16:58:32 2005 @@ -1,6 +1,6 @@ - Jasper + jasper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332866 - /tomcat/jasper/tc5.5.x/.project
Author: costin Date: Sat Nov 12 16:58:53 2005 New Revision: 332866 URL: http://svn.apache.org/viewcvs?rev=332866&view=rev Log: This is no longer needed. Removed: tomcat/jasper/tc5.5.x/.project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332867 - /tomcat/jasper/tc5.5.x/jasper2/.classpath
Author: costin Date: Sat Nov 12 17:03:40 2005 New Revision: 332867 URL: http://svn.apache.org/viewcvs?rev=332867&view=rev Log: As I mentioned, the launcher doesn't work with the dir struct in servletapi And most people won't modify servletapi anyway - so it is easier to just use the repository/, and not even checkout servletapi ( unless you are in the expert group, etc ). It's also faster. Modified: tomcat/jasper/tc5.5.x/jasper2/.classpath Modified: tomcat/jasper/tc5.5.x/jasper2/.classpath URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/jasper2/.classpath?rev=332867&r1=332866&r2=332867&view=diff == --- tomcat/jasper/tc5.5.x/jasper2/.classpath (original) +++ tomcat/jasper/tc5.5.x/jasper2/.classpath Sat Nov 12 17:03:40 2005 @@ -2,10 +2,11 @@ - + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332868 - /tomcat/container/tc5.5.x/.classpath
Author: costin Date: Sat Nov 12 17:04:30 2005 New Revision: 332868 URL: http://svn.apache.org/viewcvs?rev=332868&view=rev Log: Same - use the libs instead of servletapi Modified: tomcat/container/tc5.5.x/.classpath Modified: tomcat/container/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/.classpath?rev=332868&r1=332867&r2=332868&view=diff == --- tomcat/container/tc5.5.x/.classpath (original) +++ tomcat/container/tc5.5.x/.classpath Sat Nov 12 17:04:30 2005 @@ -25,7 +25,8 @@ - + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332869 - /tomcat/build/tc5.5.x/.classpath
Author: costin Date: Sat Nov 12 17:06:05 2005 New Revision: 332869 URL: http://svn.apache.org/viewcvs?rev=332869&view=rev Log: Add a .classpath - only include resources. This is needed if you want to debug and run tomcat in eclipse. BTW - hotswapping is really GREAT. Added: tomcat/build/tc5.5.x/.classpath Added: tomcat/build/tc5.5.x/.classpath URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/.classpath?rev=332869&view=auto == --- tomcat/build/tc5.5.x/.classpath (added) +++ tomcat/build/tc5.5.x/.classpath Sat Nov 12 17:06:05 2005 @@ -0,0 +1,6 @@ + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332916 - in /tomcat/sandbox/java/org/apache/tomcat/servlets: ./ jsp/ jsp/JspProxyServlet.java
Author: costin Date: Sat Nov 12 23:02:43 2005 New Revision: 332916 URL: http://svn.apache.org/viewcvs?rev=332916&view=rev Log: An experimental ( like all sandbox ) redirector for jasper, so we can include jsp in web-embed.xml, and it could work if jasper is found. Later can be extended to load jasper from a different jar. Added: tomcat/sandbox/java/org/apache/tomcat/servlets/ tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/ tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java Added: tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java?rev=332916&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java Sat Nov 12 23:02:43 2005 @@ -0,0 +1,40 @@ +package org.apache.tomcat.servlets.jsp; + +import java.io.IOException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class JspProxyServlet extends HttpServlet { +HttpServlet realJspServlet; + +protected void service(HttpServletRequest arg0, HttpServletResponse arg1) +throws ServletException, IOException +{ +if( realJspServlet!=null ) { +realJspServlet.service(arg0, arg1); +return; +} +arg1.setStatus(404); +} + +public void init(ServletConfig arg0) throws ServletException { +super.init(arg0); +try { +Class jspC = Class.forName("org.apache.jasper.servlet.JspServlet"); +realJspServlet=(HttpServlet)jspC.newInstance(); +realJspServlet.init(arg0); +} catch (ClassNotFoundException e) { +// it's ok - no jsp +log("No JSP servlet"); +} catch (Throwable e ) { +e.printStackTrace(); +log("No JSP servlet"); +} +} + + +} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332917 - in /tomcat/sandbox: .classpath java/server-embed.xml java/web-embed.xml
Author: costin Date: Sat Nov 12 23:03:17 2005 New Revision: 332917 URL: http://svn.apache.org/viewcvs?rev=332917&view=rev Log: Fix classpath, move web-embed and server-embed from build/ Added: tomcat/sandbox/.classpath tomcat/sandbox/java/server-embed.xml tomcat/sandbox/java/web-embed.xml Added: tomcat/sandbox/.classpath URL: http://svn.apache.org/viewcvs/tomcat/sandbox/.classpath?rev=332917&view=auto == --- tomcat/sandbox/.classpath (added) +++ tomcat/sandbox/.classpath Sat Nov 12 23:03:17 2005 @@ -0,0 +1,11 @@ + + + + + + + + + + + Added: tomcat/sandbox/java/server-embed.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/server-embed.xml?rev=332917&view=auto == --- tomcat/sandbox/java/server-embed.xml (added) +++ tomcat/sandbox/java/server-embed.xml Sat Nov 12 23:03:17 2005 @@ -0,0 +1,8 @@ + + + + + + + + Added: tomcat/sandbox/java/web-embed.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/web-embed.xml?rev=332917&view=auto == --- tomcat/sandbox/java/web-embed.xml (added) +++ tomcat/sandbox/java/web-embed.xml Sat Nov 12 23:03:17 2005 @@ -0,0 +1,644 @@ + +http://java.sun.com/xml/ns/j2ee"; +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; +xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; +version="2.4"> + +default + org.apache.catalina.servlets.DefaultServlet + +debug +0 + + +listings +true + +1 + + +invoker + + org.apache.catalina.servlets.InvokerServlet + +2 + + +jsp + + org.apache.tomcat.servlets.jsp.JspProxyServlet + +3 + + +default +/ + + +jsp +*.jsp + + +jsp +*.jspx + + +invoker +/servlet/* + + +abs +audio/x-mpeg + + +ai +application/postscript + + +aif +audio/x-aiff + + +aifc +audio/x-aiff + + +aiff +audio/x-aiff + + +aim +application/x-aim + + +art +image/x-jg + + +asf +video/x-ms-asf + + +asx +video/x-ms-asf + + +au +audio/basic + + +avi +video/x-msvideo + + +avx +video/x-rad-screenplay + + +bcpio +application/x-bcpio + + +bin +application/octet-stream + + +bmp +image/bmp + + +body +text/html + + +cdf +application/x-cdf + + +cer +application/x-x509-ca-cert + + +class +application/java + + +cpio +application/x-cpio + + +csh +application/x-csh + + +css +text/css + + +dib +image/bmp + + +doc +application/msword + + +dtd +application/xml-dtd + + +dv +video/x-dv + + +dvi +application/x-dvi + + +eps +application/postscript + + +etx +text/x-setext + + +exe +application/octet-stream + + +gif +image/gif + + +gtar +application/x-gtar + + +gz +application/x-gzip + + +hdf +application/x-hdf + + +hqx +application/mac-binhex40 + + +htc +text/x-component + + +htm +text/html + + +html +text/html + + +hqx +application/mac-binhex40 + + +ief +image/ief + + +jad +text/vnd.sun.j2me.app-descriptor + + +jar +application/java-archive + + +java +text/plain + + +jnlp +application/x-java-jnlp-file + + +jpe +image/jpeg + + +jpeg +image/jpeg + + +jpg +image/jpeg + + +js +text/javascript + + +jsf +text/plain + + +jspf +text/plain + + +kar +audio/x-midi + + +latex +application/x-latex + + +m3u +audio/x-mpeg
svn commit: r332919 - in /tomcat/build/tc5.5.x/resources: runtime.MF server-embed.xml web-embed.xml
Author: costin Date: Sat Nov 12 23:06:00 2005 New Revision: 332919 URL: http://svn.apache.org/viewcvs?rev=332919&view=rev Log: Moved to sandbox Removed: tomcat/build/tc5.5.x/resources/runtime.MF tomcat/build/tc5.5.x/resources/server-embed.xml tomcat/build/tc5.5.x/resources/web-embed.xml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332927 - in /tomcat/build/tc5.5.x: build.properties.default build.xml
Author: costin Date: Sat Nov 12 23:19:12 2005 New Revision: 332927 URL: http://svn.apache.org/viewcvs?rev=332927&view=rev Log: Removed ( moved to sandbox ) the single-jar option. Added download for rhino. Modified: tomcat/build/tc5.5.x/build.properties.default tomcat/build/tc5.5.x/build.xml Modified: tomcat/build/tc5.5.x/build.properties.default URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/build.properties.default?rev=332927&r1=332926&r2=332927&view=diff == --- tomcat/build/tc5.5.x/build.properties.default (original) +++ tomcat/build/tc5.5.x/build.properties.default Sat Nov 12 23:19:12 2005 @@ -204,6 +204,11 @@ junit.loc=${base-sf.loc}/junit/junit3.8.1.zip +# - Rhino -- +rhino.home=${base.path}/rhino1_6R2 +rhino.jar=${rhino.home}/js.jar +rhino.loc=http://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R2.zip + # - NSIS, version 2.0 or later - nsis.home=${base.path}/nsis-2.0 nsis.exe=${nsis.home}/makensis.exe Modified: tomcat/build/tc5.5.x/build.xml URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/build.xml?rev=332927&r1=332926&r2=332927&view=diff == --- tomcat/build/tc5.5.x/build.xml (original) +++ tomcat/build/tc5.5.x/build.xml Sat Nov 12 23:19:12 2005 @@ -1159,134 +1159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -2069,6 +1947,7 @@ + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332930 - in /tomcat/sandbox: .project build.xml resources/
Author: costin Date: Sat Nov 12 23:23:22 2005 New Revision: 332930 URL: http://svn.apache.org/viewcvs?rev=332930&view=rev Log: Moved stuff from build/ The build.xml file is not following exactly same rules and using same dirs as eclipse. Added: tomcat/sandbox/.project tomcat/sandbox/build.xml tomcat/sandbox/resources/ Added: tomcat/sandbox/.project URL: http://svn.apache.org/viewcvs/tomcat/sandbox/.project?rev=332930&view=auto == --- tomcat/sandbox/.project (added) +++ tomcat/sandbox/.project Sat Nov 12 23:23:22 2005 @@ -0,0 +1,17 @@ + + + sandbox + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + Added: tomcat/sandbox/build.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/build.xml?rev=332930&view=auto == --- tomcat/sandbox/build.xml (added) +++ tomcat/sandbox/build.xml Sat Nov 12 23:23:22 2005 @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332931 - /tomcat/sandbox/resources/runtime.MF
Author: costin Date: Sat Nov 12 23:23:42 2005 New Revision: 332931 URL: http://svn.apache.org/viewcvs?rev=332931&view=rev Log: moved the manifest as well Added: tomcat/sandbox/resources/runtime.MF Added: tomcat/sandbox/resources/runtime.MF URL: http://svn.apache.org/viewcvs/tomcat/sandbox/resources/runtime.MF?rev=332931&view=auto == --- tomcat/sandbox/resources/runtime.MF (added) +++ tomcat/sandbox/resources/runtime.MF Sat Nov 12 23:23:42 2005 @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.6.2 +Created-By: 1.5.0-b64 (Sun Microsystems Inc.) +Main-Class: org.apache.catalina.startup.Bootstrap + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332933 - /tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java
Author: costin Date: Sat Nov 12 23:24:41 2005 New Revision: 332933 URL: http://svn.apache.org/viewcvs?rev=332933&view=rev Log: Use the real mapper. Added: tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java Added: tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java?rev=332933&view=auto == --- tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java (added) +++ tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java Sat Nov 12 23:24:41 2005 @@ -0,0 +1,81 @@ +package org.apache.coyote.adapters; + +import java.util.Enumeration; +import java.util.Hashtable; + +import org.apache.coyote.Adapter; +import org.apache.coyote.Request; +import org.apache.coyote.Response; +import org.apache.coyote.http11.Http11BaseProtocol; +import org.apache.coyote.standalone.MessageWriter; +import org.apache.tomcat.util.http.mapper.Mapper; +import org.apache.tomcat.util.loader.Loader; +import org.apache.tomcat.util.loader.Repository; + +/** + * + */ +public class MapperAdapter implements Adapter { + +public Mapper mapper=new Mapper(); + +// TODO: add extension mappings +// Key = prefix, one level only, value= class name of Adapter +// key starts with a / and has no other / ( /foo - but not /foo/bar ) +Hashtable prefixMap=new Hashtable(); + +String fileAdapterCN="org.apache.coyote.adapters.FileAdapter"; +Adapter defaultAdapter=new FileAdapter(); + +public MapperAdapter() { +} + +public void service(Request req, final Response res) +throws Exception { +try { +String uri=req.requestURI().toString(); +if( uri.equals("/") ) uri="index.html"; +String ctx=""; +String local=uri; +if( uri.length() > 1 ) { +int idx=uri.indexOf('/', 1); +if( idx > 0 ) { +ctx=uri.substring(0, idx); +local=uri.substring( idx ); +} +} +Adapter h=(Adapter)prefixMap.get( ctx ); +if( h != null ) { +h.service( req, res ); +} else { +defaultAdapter.service( req, res ); +} +} catch( Throwable t ) { +t.printStackTrace(); +} + +//out.flushBuffer(); +//out.getByteChunk().flushBuffer(); - part of res.finish() +// final processing +MessageWriter.getWriter(req, res, 0).flush(); +res.finish(); + +req.recycle(); +res.recycle(); + +} + + +public void addAdapter( String prefix, Adapter adapter ) { +prefixMap.put(prefix, adapter); +} + +public void setDefaultAdapter(Adapter adapter) { +defaultAdapter=adapter; +} + +public Adapter getDefaultAdapter() { +return defaultAdapter; +} + +} \ No newline at end of file - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332935 - in /tomcat/sandbox/java/org/apache/coyote: adapters/JsAdapter.java standalone/Main.java
Author: costin Date: Sat Nov 12 23:25:39 2005 New Revision: 332935 URL: http://svn.apache.org/viewcvs?rev=332935&view=rev Log: Use the real mapper, remove old unused code Modified: tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java tomcat/sandbox/java/org/apache/coyote/standalone/Main.java Modified: tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java?rev=332935&r1=332934&r2=332935&view=diff == --- tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java (original) +++ tomcat/sandbox/java/org/apache/coyote/adapters/JsAdapter.java Sat Nov 12 23:25:39 2005 @@ -149,7 +149,7 @@ ScriptableObject.putProperty(mainScope, "server", jsOut); Counters ct = (Counters) proto.getAdapter(); -Mapper mp = (Mapper) ct.getNext(); +MapperAdapter mp = (MapperAdapter) ct.getNext(); FileAdapter fa = (FileAdapter) mp.getDefaultAdapter(); jsOut = Context.javaToJS(ct, mainScope); Modified: tomcat/sandbox/java/org/apache/coyote/standalone/Main.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/standalone/Main.java?rev=332935&r1=332934&r2=332935&view=diff == --- tomcat/sandbox/java/org/apache/coyote/standalone/Main.java (original) +++ tomcat/sandbox/java/org/apache/coyote/standalone/Main.java Sat Nov 12 23:25:39 2005 @@ -1,9 +1,15 @@ package org.apache.coyote.standalone; +import java.util.Enumeration; +import java.util.Hashtable; + +import org.apache.coyote.Adapter; import org.apache.coyote.adapters.Counters; import org.apache.coyote.adapters.HelloWorldAdapter; -import org.apache.coyote.adapters.Mapper; +import org.apache.coyote.adapters.MapperAdapter; import org.apache.coyote.http11.Http11BaseProtocol; +import org.apache.tomcat.util.loader.Loader; +import org.apache.tomcat.util.loader.Repository; /** @@ -13,7 +19,7 @@ public class Main { protected Http11BaseProtocol proto; -protected Mapper mainAdapter; +protected MapperAdapter mainAdapter; public Main() { } @@ -25,7 +31,7 @@ public void init() { proto = new Http11BaseProtocol(); -mainAdapter = new Mapper(); +mainAdapter = new MapperAdapter(); mainAdapter.addAdapter("/hello", new HelloWorldAdapter()); Counters cnt=new Counters(); @@ -55,6 +61,52 @@ } } + +/** Load the handler table. Just a hack, I'll find a better solution + */ +public void initHandlers() { + +Hashtable prefixMap=new Hashtable(); +Enumeration keys=System.getProperties().keys(); + +Loader loader=null; +if( loader == null ) { +// Not started from loader, we are embedded - create the loader, so we +// can do reloading. +//LoaderProperties.setPropertiesFile(""); +try { +loader=new Loader(); +ClassLoader myL=this.getClass().getClassLoader(); +loader.setParentClassLoader( myL ); +loader.init(); +} catch( Throwable t ) { +t.printStackTrace(); +} +} + +Repository sR=loader.getRepository("shared"); +// Construct handlers. Handlers will be created, they can get the protocol +// if they need additional init + +while( keys.hasMoreElements()) { +String n=(String)keys.nextElement(); +if( n.startsWith("handler.")) { +String cls=System.getProperty( n ); +String map=n.substring(8); +Adapter hC=null; +try { +// use the loader's server common repository +Class c=sR.getClassLoader().loadClass(cls); +//Class c=Class.forName(cls); +hC=(Adapter)c.newInstance(); +prefixMap.put( map, hC ); +} catch( Throwable t ) { +t.printStackTrace(); +} +} +} +} + // --- Main - public static void main( String args[]) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332936 - /tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java
Author: costin Date: Sat Nov 12 23:26:28 2005 New Revision: 332936 URL: http://svn.apache.org/viewcvs?rev=332936&view=rev Log: Better layout Modified: tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java?rev=332936&r1=332935&r2=332936&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java Sat Nov 12 23:26:28 2005 @@ -69,12 +69,6 @@ // pad to 8 to make it more readable for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); } -// Append the name of the log instance if so configured -buf.append(name); - -// pad to 20 chars -for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); } - // Append a readable representation of the log level. switch(level) { case LOG_LEVEL_TRACE: buf.append(" T "); break; @@ -86,7 +80,13 @@ default: buf.append(" "); } + +// Append the name of the log instance if so configured +buf.append(name); +// pad to 20 chars +for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); } + // Append the message buf.append(message); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r332938 - in /tomcat/sandbox: build.xml resources/coyote-http11.MF
Author: costin Date: Sat Nov 12 23:36:11 2005 New Revision: 332938 URL: http://svn.apache.org/viewcvs?rev=332938&view=rev Log: Finish up - build all 3 'standalones' using same model Added: tomcat/sandbox/resources/coyote-http11.MF (with props) Modified: tomcat/sandbox/build.xml Modified: tomcat/sandbox/build.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/build.xml?rev=332938&r1=332937&r2=332938&view=diff == --- tomcat/sandbox/build.xml (original) +++ tomcat/sandbox/build.xml Sat Nov 12 23:36:11 2005 @@ -201,10 +201,11 @@ + description="Build single jar tomcat" depends="compile"> + @@ -238,6 +239,7 @@ + @@ -282,44 +284,31 @@ This is only the http connector, for testing/experimental purposes. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + Added: tomcat/sandbox/resources/coyote-http11.MF URL: http://svn.apache.org/viewcvs/tomcat/sandbox/resources/coyote-http11.MF?rev=332938&view=auto == --- tomcat/sandbox/resources/coyote-http11.MF (added) +++ tomcat/sandbox/resources/coyote-http11.MF Sat Nov 12 23:36:11 2005 @@ -0,0 +1,3 @@ +Manifest-version: 1.0 +Main-Class: org.apache.coyote.standalone.Main +Class-Path: js.jar Propchange: tomcat/sandbox/resources/coyote-http11.MF -- svn:executable = * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r343977 - /tomcat/sandbox/build.xml
Author: costin Date: Sun Nov 13 14:05:16 2005 New Revision: 343977 URL: http://svn.apache.org/viewcvs?rev=343977&view=rev Log: Moved download for rhino. Modified: tomcat/sandbox/build.xml Modified: tomcat/sandbox/build.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/build.xml?rev=343977&r1=343976&r2=343977&view=diff == --- tomcat/sandbox/build.xml (original) +++ tomcat/sandbox/build.xml Sun Nov 13 14:05:16 2005 @@ -10,7 +10,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -34,7 +34,7 @@ +value="${jasper-compiler-jdt.home}/jasper-compiler-jdt.jar"/> @@ -43,7 +43,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -104,13 +104,13 @@ - - - - - - + + + + + + - - - - - - + + + + + + @@ -144,7 +144,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -184,7 +184,7 @@ - + @@ -199,116 +199,146 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - +description="Build single jar tomcat" depends="compile"> + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r343978 - /tomcat/build/tc5.5.x/build.xml
Author: costin Date: Sun Nov 13 14:05:40 2005 New Revision: 343978 URL: http://svn.apache.org/viewcvs?rev=343978&view=rev Log: Moved download for rhino to sandbox Modified: tomcat/build/tc5.5.x/build.xml Modified: tomcat/build/tc5.5.x/build.xml URL: http://svn.apache.org/viewcvs/tomcat/build/tc5.5.x/build.xml?rev=343978&r1=343977&r2=343978&view=diff == --- tomcat/build/tc5.5.x/build.xml (original) +++ tomcat/build/tc5.5.x/build.xml Sun Nov 13 14:05:40 2005 @@ -1856,12 +1856,6 @@ - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345653 [2/2] - in /tomcat/sandbox/java/org/apache/tomcat/util/net: ./ res/
Added: tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java?rev=345653&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java Sat Nov 19 08:50:47 2005 @@ -0,0 +1,127 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.net; + +import java.io.IOException; + +/* SSLSupport + + Interface for SSL-specific functions + + @author EKR +*/ + +public interface SSLSupport { +/** + * The Request attribute key for the cipher suite. + */ +public static final String CIPHER_SUITE_KEY = "javax.servlet.request.cipher_suite"; + +/** + * The Request attribute key for the key size. + */ +public static final String KEY_SIZE_KEY = "javax.servlet.request.key_size"; + +/** + * The Request attribute key for the client certificate chain. + */ +public static final String CERTIFICATE_KEY = "javax.servlet.request.X509Certificate"; + +/** + * The Request attribute key for the session id. + * This one is a Tomcat extension to the Servlet spec. + */ +public static final String SESSION_ID_KEY = "javax.servlet.request.ssl_session"; + +/** + * A mapping table to determine the number of effective bits in the key + * when using a cipher suite containing the specified cipher name. The + * underlying data came from the TLS Specification (RFC 2246), Appendix C. + */ + static final CipherData ciphers[] = { +new CipherData("_WITH_NULL_", 0), +new CipherData("_WITH_IDEA_CBC_", 128), +new CipherData("_WITH_RC2_CBC_40_", 40), +new CipherData("_WITH_RC4_40_", 40), +new CipherData("_WITH_RC4_128_", 128), +new CipherData("_WITH_DES40_CBC_", 40), +new CipherData("_WITH_DES_CBC_", 56), +new CipherData("_WITH_3DES_EDE_CBC_", 168) +}; + +/** + * The cipher suite being used on this connection. + */ +public String getCipherSuite() throws IOException; + +/** + * The client certificate chain (if any). + */ +public Object[] getPeerCertificateChain() +throws IOException; + +/** + * The client certificate chain (if any). + * @param force If true, then re-negotiate the + * connection if necessary. + */ +public Object[] getPeerCertificateChain(boolean force) +throws IOException; + +/** + * Get the keysize. + * + * What we're supposed to put here is ill-defined by the + * Servlet spec (S 4.7 again). There are at least 4 potential + * values that might go here: + * + * (a) The size of the encryption key + * (b) The size of the MAC key + * (c) The size of the key-exchange key + * (d) The size of the signature key used by the server + * + * Unfortunately, all of these values are nonsensical. + **/ +public Integer getKeySize() +throws IOException; + +/** + * The current session Id. + */ +public String getSessionId() +throws IOException; +/** + * Simple data class that represents the cipher being used, along with the + * corresponding effective key size. The specified phrase must appear in the + * name of the cipher suite to be recognized. + */ + +final class CipherData { + +public String phrase = null; + +public int keySize = 0; + +public CipherData(String phrase, int keySize) { +this.phrase = phrase; +this.keySize = keySize; +} + +} + +} + Added: tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java?rev=345653&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java Sat Nov 19 08:50:47 2005 @@ -0,0 +1,172 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Ve
svn commit: r345659 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: AprEndpoint.java SSLImplementation.java TcpConnection.java
Author: costin Date: Sat Nov 19 09:44:11 2005 New Revision: 345659 URL: http://svn.apache.org/viewcvs?rev=345659&view=rev Log: - remove the hardcoded dependency between SSLImplementation and jsse. - add support for the native socket, in addition to Socket. A better solution may be to add a AprSocket class - this will allow Apr to be used in more places. - AprEndpoint extends PoolTcpConnection, use TcpConnectionHandler instead if Handler. This will allow coyote.http11.Apr* to extend the http classes and remove most of the duplicated code. Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=345659&r1=345658&r2=345659&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java Sat Nov 19 09:44:11 2005 @@ -53,7 +53,7 @@ * @author Mladen Turk * @author Remy Maucherat */ -public class AprEndpoint { +public class AprEndpoint extends PoolTcpEndpoint { // -- Constants @@ -65,6 +65,7 @@ StringManager.getManager("org.apache.tomcat.util.net.res"); +// where is this used ? /** * The Request attribute key for the cipher suite. */ @@ -239,6 +240,10 @@ public void setHandler(Handler handler ) { this.handler = handler; } public Handler getHandler() { return handler; } +protected TcpConnectionHandler chandler = null; +public void setHandler(TcpConnectionHandler chandler ) { this.chandler = chandler; } +public TcpConnectionHandler getTcpConnectionHandler() { return chandler; } + /** * Allows the server developer to specify the backlog that @@ -1192,6 +1197,7 @@ public void run() { // Process requests until we receive a shutdown signal +TcpConnection tcpCon=new TcpConnection(); while (running) { // Wait for the next socket to be assigned @@ -1200,12 +1206,20 @@ continue; // Process the request from this socket -if (!handler.process(socket)) { +if (handler != null && !handler.process(socket)) { // Close socket and pool Socket.destroy(socket); socket = 0; +} else { +if (chandler != null ) { +tcpCon.setNativeSocket(socket); +chandler.processConnection(tcpCon, null); +// TODO: Close socket and pool - what would be the +// return false case ? +//Socket.destroy(socket); +//socket = 0; +} } - // Finish up this request recycleWorkerThread(this); Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java?rev=345659&r1=345658&r2=345659&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java Sat Nov 19 09:44:11 2005 @@ -65,10 +65,12 @@ try { // Workaround for the J2SE 1.4.x classloading problem (under Solaris). // Class.forName(..) fails without creating class using new. - // This is an ugly workaround. - if( JSSEImplementationClass.equals(className) ) { - return new org.apache.tomcat.util.net.jsse.JSSEImplementation(); - } + // This is an ugly workaround. +// This also breaks compiling tomcat without SSL support, and is +// just wrong. Better fix - fix Class.forName. + //if( JSSEImplementationClass.equals(className) ) { + //return new org.apache.tomcat.util.net.jsse.JSSEImplementation(); + //} Class clazz=Class.forName(className); return (SSLImplementation)clazz.newInstance(); } catch (Exception e){ Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java?rev=345659&r1=345658&r2=345659&view=diff
svn commit: r345660 - in /tomcat/sandbox/java/org/apache/coyote/standalone: Main.java MessageWriter.java
Author: costin Date: Sat Nov 19 09:46:43 2005 New Revision: 345660 URL: http://svn.apache.org/viewcvs?rev=345660&view=rev Log: Few comments and small changes to expose the mapper. Modified: tomcat/sandbox/java/org/apache/coyote/standalone/Main.java tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java Modified: tomcat/sandbox/java/org/apache/coyote/standalone/Main.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/standalone/Main.java?rev=345660&r1=345659&r2=345660&view=diff == --- tomcat/sandbox/java/org/apache/coyote/standalone/Main.java (original) +++ tomcat/sandbox/java/org/apache/coyote/standalone/Main.java Sat Nov 19 09:46:43 2005 @@ -8,6 +8,7 @@ import org.apache.coyote.adapters.HelloWorldAdapter; import org.apache.coyote.adapters.MapperAdapter; import org.apache.coyote.http11.Http11BaseProtocol; +import org.apache.tomcat.util.http.mapper.Mapper; import org.apache.tomcat.util.loader.Loader; import org.apache.tomcat.util.loader.Repository; @@ -41,11 +42,18 @@ proto.setAdapter(cnt); } +public MapperAdapter getMapper() { +return mainAdapter; +} + /** */ public void run() { init(); - +start(); +} + +public void start() { if( proto.getPort() == 0 ) proto.setPort(8800); Modified: tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java?rev=345660&r1=345659&r2=345660&view=diff == --- tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java (original) +++ tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java Sat Nov 19 09:46:43 2005 @@ -116,13 +116,15 @@ /** - * Byte chunk used to output bytes. + * Byte chunk used to output bytes. This is just used to wrap the byte[] + * to match the coyote OutputBuffer interface */ private ByteChunk outputChunk = new ByteChunk(); /** - * Encoding to use. + * Encoding to use. + * TODO: isn't it redundant ? enc, gotEnc, conv plus the enc in the bb */ private String enc; @@ -134,13 +136,14 @@ /** - * List of encoders. + * List of encoders. The writer is reused - the encoder mapping + * avoids creating expensive objects. In future it'll contain nio.Charsets */ protected HashMap encoders = new HashMap(); /** - * Current char to byte converter. + * Current char to byte converter. TODO: replace with Charset */ protected C2BConverter conv; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345662 - /tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java
Author: costin Date: Sat Nov 19 09:52:07 2005 New Revision: 345662 URL: http://svn.apache.org/viewcvs?rev=345662&view=rev Log: Remove duplicated methods. Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=345662&r1=345661&r2=345662&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java Sat Nov 19 09:52:07 2005 @@ -37,7 +37,7 @@ * * @author mailto:[EMAIL PROTECTED]">Remy Maucherat */ -public class InternalAprInputBuffer implements InputBuffer { +public class InternalAprInputBuffer extends InternalInputBuffer { // -- Constants @@ -51,28 +51,12 @@ */ public InternalAprInputBuffer(Request request, int headerBufferSize, long readTimeout) { +super(request, headerBufferSize); -this.request = request; -headers = request.getMimeHeaders(); - -headerBuffer1 = new byte[headerBufferSize]; -headerBuffer2 = new byte[headerBufferSize]; -bodyBuffer = new byte[headerBufferSize]; -buf = headerBuffer1; bbuf = ByteBuffer.allocateDirect(headerBufferSize); -headerBuffer = new char[headerBufferSize]; -ascbuf = headerBuffer; - inputStreamInputBuffer = new SocketInputBuffer(); -filterLibrary = new InputFilter[0]; -activeFilters = new InputFilter[0]; -lastActiveFilter = -1; - -parsingHeader = true; -swallowInput = true; - this.readTimeout = readTimeout * 1000; } @@ -80,91 +64,9 @@ // -- Variables - -/** - * The string manager for this package. - */ -protected static StringManager sm = -StringManager.getManager(Constants.Package); - - -// - Instance Variables - - -/** - * Associated Coyote request. - */ -protected Request request; - - -/** - * Headers of the associated request. - */ -protected MimeHeaders headers; - - -/** - * State. - */ -protected boolean parsingHeader; - - -/** - * Swallow input ? (in the case of an expectation) - */ -protected boolean swallowInput; - - -/** - * Pointer to the current read buffer. - */ -protected byte[] buf; - - -/** - * Pointer to the US-ASCII header buffer. - */ -protected char[] ascbuf; - - -/** - * Last valid byte. - */ -protected int lastValid; - - -/** - * Position in the buffer. - */ -protected int pos; - - -/** - * HTTP header buffer no 1. - */ -protected byte[] headerBuffer1; - - -/** - * HTTP header buffer no 2. - */ -protected byte[] headerBuffer2; - - -/** - * HTTP body buffer. - */ -protected byte[] bodyBuffer; - - -/** - * US-ASCII header buffer. - */ -protected char[] headerBuffer; - - /** * Direct byte buffer used to perform actual reading. + * Used instead of super.inputStream */ protected ByteBuffer bbuf; @@ -176,31 +78,6 @@ /** - * Underlying input buffer. - */ -protected InputBuffer inputStreamInputBuffer; - - -/** - * Filter library. - * Note: Filter[0] is always the "chunked" filter. - */ -protected InputFilter[] filterLibrary; - - -/** - * Active filters (in order). - */ -protected InputFilter[] activeFilters; - - -/** - * Index of the last active filter. - */ -protected int lastActiveFilter; - - -/** * The socket timeout used when reading the first block of the request * header. */ @@ -227,75 +104,6 @@ } -/** - * Add an input filter to the filter library. - */ -public void addFilter(InputFilter filter) { - -InputFilter[] newFilterLibrary = -new InputFilter[filterLibrary.length + 1]; -for (int i = 0; i < filterLibrary.length; i++) { -newFilterLibrary[i] = filterLibrary[i]; -} -newFilterLibrary[filterLibrary.length] = filter; -filterLibrary = newFilterLibrary; - -activeFilters = new InputFilter[filterLibrary.length]; - -} - - -/** - * Get filters. - */ -public InputFilter[] getFilters() { - -return filterLibrary; - -} - - -/** - * Clear filters. - */ -public void clearFilters() { - -filterLibrary = new InputFilt
svn commit: r345700 - /tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Author: costin Date: Sat Nov 19 17:23:40 2005 New Revision: 345700 URL: http://svn.apache.org/viewcvs?rev=345700&view=rev Log: Remove duplicated methods. Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=345700&r1=345699&r2=345700&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Sat Nov 19 17:23:40 2005 @@ -36,8 +36,7 @@ * * @author mailto:[EMAIL PROTECTED]">Remy Maucherat */ -public class InternalAprOutputBuffer -implements OutputBuffer { +public class InternalAprOutputBuffer extends InternalOutputBuffer { // -- Constants @@ -50,7 +49,7 @@ * Default constructor. */ public InternalAprOutputBuffer(Response response) { -this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); +super(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); } @@ -58,117 +57,24 @@ * Alternate constructor. */ public InternalAprOutputBuffer(Response response, int headerBufferSize) { - -this.response = response; -headers = response.getMimeHeaders(); - -headerBuffer = new byte[headerBufferSize]; -buf = headerBuffer; +super( response, headerBufferSize); bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500); outputStreamOutputBuffer = new SocketOutputBuffer(); -filterLibrary = new OutputFilter[0]; -activeFilters = new OutputFilter[0]; -lastActiveFilter = -1; - -committed = false; -finished = false; - // Cause loading of HttpMessages HttpMessages.getMessage(200); - } - -// -- Variables - - -/** - * The string manager for this package. - */ -protected static StringManager sm = -StringManager.getManager(Constants.Package); - - // - Instance Variables - - -/** - * Associated Coyote response. - */ -protected Response response; - - -/** - * Headers of the associated request. - */ -protected MimeHeaders headers; - - -/** - * Committed flag. - */ -protected boolean committed; - - -/** - * Finished flag. - */ -protected boolean finished; - - /** - * Pointer to the current read buffer. - */ -protected byte[] buf; - - -/** - * Position in the buffer. - */ -protected int pos; - - -/** - * HTTP header buffer. - */ -protected byte[] headerBuffer; - - -/** - * Underlying socket. + * Underlying socket. - instead of outputStream */ protected long socket; -/** - * Underlying output buffer. - */ -protected OutputBuffer outputStreamOutputBuffer; - - -/** - * Filter library. - * Note: Filter[0] is always the "chunked" filter. - */ -protected OutputFilter[] filterLibrary; - - -/** - * Active filter (which is actually the top of the pipeline). - */ -protected OutputFilter[] activeFilters; - - -/** - * Index of the last active filter. - */ -protected int lastActiveFilter; - - -/** +/** instead of socketBuffer * Direct byte buffer used for writing. */ protected ByteBuffer bbuf = null; @@ -193,76 +99,6 @@ return socket; } - -/** - * Set the socket buffer size. - */ -public void setSocketBuffer(int socketBufferSize) { -// FIXME: Remove -} - - -/** - * Add an output filter to the filter library. - */ -public void addFilter(OutputFilter filter) { - -OutputFilter[] newFilterLibrary = -new OutputFilter[filterLibrary.length + 1]; -for (int i = 0; i < filterLibrary.length; i++) { -newFilterLibrary[i] = filterLibrary[i]; -} -newFilterLibrary[filterLibrary.length] = filter; -filterLibrary = newFilterLibrary; - -activeFilters = new OutputFilter[filterLibrary.length]; - -} - - -/** - * Get filters. - */ -public OutputFilter[] getFilters() { - -return filterLibrary; - -} - - -/** - * Clear filters. - */ -public void clearFilters() { - -filterLibrary = new OutputFilter[0]; -lastActiveFilter = -1; - -} - - -/** - * Add an output filter to the filter library. - */ -public void addActiveFilter(OutputFilter filter) {
svn commit: r345716 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11AprProcessor.java Http11BaseProtocol.java Http11Processor.java InternalAprInputBuffer.java InternalAprOutputBuffer.java In
Author: costin Date: Sat Nov 19 20:45:01 2005 New Revision: 345716 URL: http://svn.apache.org/viewcvs?rev=345716&view=rev Log: Few minor cleanups ( imports, indentation ), add a parameter to parseRequestLine to match the apr version, expose the thread pool ( for standalone ). Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalInputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=345716&r1=345715&r2=345716&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java Sat Nov 19 20:45:01 2005 @@ -62,7 +62,7 @@ * * @author Remy Maucherat */ -public class Http11AprProcessor implements ActionHook { +public class Http11AprProcessor extends Http11Processor implements ActionHook { /** Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java?rev=345716&r1=345715&r2=345716&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java Sat Nov 19 20:45:01 2005 @@ -264,9 +264,17 @@ setAttribute("strategy", strategy); } - public String getStrategy() { + public String getStrategy() { return ep.getStrategy(); - } + } + +/** Access to the thread pool. + * + * @return tp the internal thread pool used by the protocol + */ + public ThreadPool getThreadPool() { +return tp; + } // Tcp setup Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java?rev=345716&r1=345715&r2=345716&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java Sat Nov 19 20:45:01 2005 @@ -823,7 +823,7 @@ if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) { socket.setSoTimeout(soTimeout); } -inputBuffer.parseRequestLine(); +inputBuffer.parseRequestLine(false); request.setStartTime(System.currentTimeMillis()); thrA.setParam( threadPool, request.requestURI() ); keptAlive = true; Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=345716&r1=345715&r2=345716&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java Sat Nov 19 20:45:01 2005 @@ -17,19 +17,15 @@ package org.apache.coyote.http11; -import java.io.IOException; import java.io.EOFException; +import java.io.IOException; import java.nio.ByteBuffer; +import org.apache.coyote.InputBuffer; +import org.apache.coyote.Request; import org.apache.tomcat.jni.Socket; import org.apache.tomcat.jni.Status; import org.apache.tomcat.util.buf.ByteChunk; -import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.MimeHeaders; -import org.apache.tomcat.util.res.StringManager; - -import org.apache.coyote.InputBuffer; -import org.apache.coyote.Request; /** * Implementation of InputBuffer which provides HTTP request header parsing as Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=345716&r1=345715&r2=345716&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original) +++ tomcat/sandbox/j
svn commit: r345721 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11AprProtocol.java Http11BaseProtocol.java
Author: costin Date: Sat Nov 19 21:21:53 2005 New Revision: 345721 URL: http://svn.apache.org/viewcvs?rev=345721&view=rev Log: Remove duplicated code Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=345721&r1=345720&r2=345721&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java Sat Nov 19 21:21:53 2005 @@ -45,71 +45,24 @@ * @author Remy Maucherat * @author Costin Manolache */ -public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration +public class Http11AprProtocol extends Http11BaseProtocol implements ProtocolHandler, MBeanRegistration { public Http11AprProtocol() { +ep=new AprEndpoint(); cHandler = new Http11ConnectionHandler( this ); setSoLinger(Constants.DEFAULT_CONNECTION_LINGER); setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT); +// this line is different from super. //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT); setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY); } -/** - * The string manager for this package. - */ -protected static StringManager sm = -StringManager.getManager(Constants.Package); - -/** Pass config info - */ -public void setAttribute( String name, Object value ) { -if( log.isTraceEnabled()) -log.trace(sm.getString("http11protocol.setattribute", name, value)); - -attributes.put(name, value); -} - -public Object getAttribute( String key ) { -if( log.isTraceEnabled()) -log.trace(sm.getString("http11protocol.getattribute", key)); -return attributes.get(key); -} - -public Iterator getAttributeNames() { -return attributes.keySet().iterator(); -} - -/** - * Set a property. - */ -public void setProperty(String name, String value) { -setAttribute(name, value); -} - -/** - * Get a property - */ -public String getProperty(String name) { -return (String)getAttribute(name); -} - -/** The adapter, used to call the connector - */ -public void setAdapter(Adapter adapter) { -this.adapter=adapter; -} - -public Adapter getAdapter() { -return adapter; -} - /** Start the protocol */ public void init() throws Exception { ep.setName(getName()); -ep.setHandler(cHandler); +ep.setHandler((AprEndpoint.Handler)cHandler); try { ep.init(); @@ -151,28 +104,6 @@ log.info(sm.getString("http11protocol.start", getName())); } -public void pause() throws Exception { -try { -ep.pause(); -} catch (Exception ex) { -log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex); -throw ex; -} -if(log.isInfoEnabled()) -log.info(sm.getString("http11protocol.pause", getName())); -} - -public void resume() throws Exception { -try { -ep.resume(); -} catch (Exception ex) { -log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex); -throw ex; -} -if(log.isInfoEnabled()) -log.info(sm.getString("http11protocol.resume", getName())); -} - public void destroy() throws Exception { if(log.isInfoEnabled()) log.info(sm.getString("http11protocol.stop", getName())); @@ -185,70 +116,6 @@ // Properties protected AprEndpoint ep=new AprEndpoint(); -protected boolean secure; - -protected Hashtable attributes = new Hashtable(); - -private int maxKeepAliveRequests=100; // as in Apache HTTPD server -private int timeout = 30; // 5 minutes as in Apache HTTPD server -private int maxSavePostSize = 4 * 1024; -private int maxHttpHeaderSize = 4 * 1024; -private int socketCloseDelay=-1; -private boolean disableUploadTimeout = true; -private int socketBuffer = 9000; -private Adapter adapter; -private Http11ConnectionHandler cHandler; - -/** - * Compression value. - */ -private String compression = "off"; -private String noCompressionUserAgents = null; -private String restrictedUserAgents = null; -private String compressableMimeTypes = "text/html,text/xml,text/plain"; -private int compressionMinSize=
svn commit: r345722 - in /tomcat/sandbox/java/org/apache/coyote/http11: InternalAprOutputBuffer.java InternalOutputBuffer.java
Author: costin Date: Sat Nov 19 21:22:24 2005 New Revision: 345722 URL: http://svn.apache.org/viewcvs?rev=345722&view=rev Log: Some extra checks Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=345722&r1=345721&r2=345722&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Sat Nov 19 21:22:24 2005 @@ -44,7 +44,7 @@ * Default constructor. */ public InternalAprOutputBuffer(Response response) { -super(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); +this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); } @@ -60,6 +60,7 @@ // Cause loading of HttpMessages HttpMessages.getMessage(200); +socketBuffer=null; } // - Instance Variables Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java?rev=345722&r1=345721&r2=345722&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java Sat Nov 19 21:22:24 2005 @@ -207,7 +207,8 @@ * Set the socket buffer size. */ public void setSocketBuffer(int socketBufferSize) { - + +if( socketBuffer == null ) return; if (socketBufferSize > 500) { useSocketBuffer = true; socketBuffer.allocate(socketBufferSize, socketBufferSize); @@ -300,7 +301,7 @@ } // Flush the current buffer -if (useSocketBuffer) { +if (useSocketBuffer && socketBuffer != null ) { socketBuffer.flushBuffer(); } @@ -331,7 +332,9 @@ // Recycle Request object response.recycle(); -socketBuffer.recycle(); +if( socketBuffer != null ) { +socketBuffer.recycle(); +} outputStream = null; buf = headerBuffer; @@ -353,7 +356,10 @@ // Recycle Request object response.recycle(); -socketBuffer.recycle(); +// this is not used in apr +if( socketBuffer != null ) { +socketBuffer.recycle(); +} // Determine the header buffer used for next request buf = headerBuffer; @@ -395,7 +401,7 @@ if (lastActiveFilter != -1) activeFilters[lastActiveFilter].end(); -if (useSocketBuffer) { +if (useSocketBuffer && socketBuffer != null ) { socketBuffer.flushBuffer(); } @@ -455,6 +461,8 @@ } // End the response status line +// This was missing in APR ! +// Why is this needed if (System.getSecurityManager() != null){ AccessController.doPrivileged( new PrivilegedAction(){ @@ -472,7 +480,7 @@ } -private String getMessage(final int message){ +protected String getMessage(final int message){ if (System.getSecurityManager() != null){ return (String)AccessController.doPrivileged( new PrivilegedAction(){ @@ -598,7 +606,7 @@ if (pos > 0) { // Sending the response header buffer -if (useSocketBuffer) { +if (useSocketBuffer && socketBuffer != null) { socketBuffer.append(buf, 0, pos); } else { outputStream.write(buf, 0, pos); @@ -765,7 +773,7 @@ public int doWrite(ByteChunk chunk, Response res) throws IOException { -if (useSocketBuffer) { +if (useSocketBuffer && socketBuffer != null ) { socketBuffer.append(chunk.getBuffer(), chunk.getStart(), chunk.getLength()); } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r345767 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11AprProcessor.java Http11Processor.java InternalAprInputBuffer.java InternalInputBuffer.java
Author: costin Date: Sun Nov 20 10:19:56 2005 New Revision: 345767 URL: http://svn.apache.org/viewcvs?rev=345767&view=rev Log: Remove even more dups. It seems the apr and non-apr were not actually in sync, there are at least 2 places where extra SecurityManager magic was used in non-apr. Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalInputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=345767&r1=345766&r2=345767&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java Sun Nov 20 10:19:56 2005 @@ -19,12 +19,11 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InterruptedIOException; -import java.net.InetAddress; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; import java.util.StringTokenizer; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; import org.apache.coyote.ActionCode; import org.apache.coyote.ActionHook; @@ -32,6 +31,7 @@ import org.apache.coyote.Request; import org.apache.coyote.RequestInfo; import org.apache.coyote.Response; +import org.apache.coyote.http11.filters.BufferedInputFilter; import org.apache.coyote.http11.filters.ChunkedInputFilter; import org.apache.coyote.http11.filters.ChunkedOutputFilter; import org.apache.coyote.http11.filters.GzipOutputFilter; @@ -40,7 +40,6 @@ import org.apache.coyote.http11.filters.SavedRequestInputFilter; import org.apache.coyote.http11.filters.VoidInputFilter; import org.apache.coyote.http11.filters.VoidOutputFilter; -import org.apache.coyote.http11.filters.BufferedInputFilter; import org.apache.tomcat.jni.Address; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.jni.SSLSocket; @@ -64,20 +63,7 @@ */ public class Http11AprProcessor extends Http11Processor implements ActionHook { - -/** - * Logger. - */ -protected static org.apache.commons.logging.Log log -= org.apache.commons.logging.LogFactory.getLog(Http11AprProcessor.class); - -/** - * The string manager for this package. - */ -protected static StringManager sm = -StringManager.getManager(Constants.Package); - - + // --- Constructors @@ -92,643 +78,52 @@ } inputBuffer = new InternalAprInputBuffer(request, headerBufferSize, readTimeout); -request.setInputBuffer(inputBuffer); - -response = new Response(); -response.setHook(this); -outputBuffer = new InternalAprOutputBuffer(response, headerBufferSize); -response.setOutputBuffer(outputBuffer); -request.setResponse(response); - -ssl = !"off".equalsIgnoreCase(endpoint.getSSLEngine()); - -initializeFilters(); - -// Cause loading of HexUtils -int foo = HexUtils.DEC[0]; - -// Cause loading of FastHttpDateFormat -FastHttpDateFormat.getCurrentDate(); - -} - - -// - Instance Variables - - -/** - * Associated adapter. - */ -protected Adapter adapter = null; - - -/** - * Request object. - */ -protected Request request = null; - - -/** - * Response object. - */ -protected Response response = null; - - -/** - * Input. - */ -protected InternalAprInputBuffer inputBuffer = null; - - -/** - * Output. - */ -protected InternalAprOutputBuffer outputBuffer = null; - - -/** - * State flag. - */ -protected boolean started = false; - - -/** - * Error flag. - */ -protected boolean error = false; - - -/** - * Keep-alive. - */ -protected boolean keepAlive = true; - - -/** - * HTTP/1.1 flag. - */ -protected boolean http11 = true; - - -/** - * HTTP/0.9 flag. - */ -protected boolean http09 = false; - - -/** - * Sendfile data. - */ -protected AprEndpoint.SendfileData sendfileData = null; - - -/** - * Content delimitator for the request (if false, the connection will - * be closed at the end of the request). - */ -protected boolean contentDelimitation = true; - - -/** - * Is there an expectation ? - */ -protected boolean expectation = false; -
svn commit: r348655 - /tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
Author: costin Date: Wed Nov 23 21:20:50 2005 New Revision: 348655 URL: http://svn.apache.org/viewcvs?rev=348655&view=rev Log: Refactoring - leave only the core methods, no ThreadPool or specific code. Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java?rev=348655&r1=348654&r2=348655&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java Wed Nov 23 21:20:50 2005 @@ -17,21 +17,17 @@ package org.apache.tomcat.util.net; import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.BindException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; -import java.security.AccessControlException; -import java.util.Stack; -import java.util.Vector; +import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.threads.ThreadPool; -import org.apache.tomcat.util.threads.ThreadPoolRunnable; +import org.apache.tomcat.util.threads.ThreadPool.ThreadPoolListener; /* Similar with MPM module in Apache2.0. Handles all the details related with "tcp server" functionality - thread management, accept policy, etc. @@ -60,98 +56,123 @@ static Log log=LogFactory.getLog(PoolTcpEndpoint.class ); -private StringManager sm = +protected StringManager sm = StringManager.getManager("org.apache.tomcat.util.net.res"); -private static final int BACKLOG = 100; -private static final int TIMEOUT = 1000; +protected static final int BACKLOG = 100; +protected static final int TIMEOUT = 1000; -private final Object threadSync = new Object(); +protected int backlog = BACKLOG; +protected int serverTimeout = TIMEOUT; -private int backlog = BACKLOG; -private int serverTimeout = TIMEOUT; +protected InetAddress inet; +protected int port; -private InetAddress inet; -private int port; +protected ServerSocket serverSocket; -private ServerSocketFactory factory; -private ServerSocket serverSocket; - -private volatile boolean running = false; -private volatile boolean paused = false; -private boolean initialized = false; -private boolean reinitializing = false; -static final int debug=0; +protected volatile boolean running = false; +protected volatile boolean paused = false; +protected boolean initialized = false; +protected boolean reinitializing = false; protected boolean tcpNoDelay=false; protected int linger=100; protected int socketTimeout=-1; -private boolean lf = true; - // -- Leader follower fields TcpConnectionHandler handler; -ThreadPoolRunnable listener; -ThreadPool tp; +// -- Master slave fields +protected int curThreads = 0; +protected int maxThreads = 20; +protected int maxSpareThreads = 20; +protected int minSpareThreads = 20; +protected String type; + +protected String name = "EP"; // base name for threads -// -- Master slave fields +protected int threadPriority; -/* The background thread. */ -private Thread thread = null; -/* Available processors. */ -private Stack workerThreads = new Stack(); -private int curThreads = 0; -private int maxThreads = 20; -/* All processors which have been created. */ -private Vector created = new Vector(); +protected boolean daemon = true; +private ArrayList listeners = new ArrayList(); public PoolTcpEndpoint() { - tp = new ThreadPool(); } -public PoolTcpEndpoint( ThreadPool tp ) { -this.tp=tp; +public static PoolTcpEndpoint getEndpoint(String type) { +String cn = null; +if( "apr".equals( type )) { +cn = "org.apache.tomcat.util.net.AprEndpoint"; +} +if( "lf".equals( type )) { +cn = "org.apache.tomcat.util.net.LeaderFollowerEndpoint"; +} +if( "acc".equals( type )) { +cn = "org.apache.tomcat.util.net.AcceptorEndpoint"; +} +if( "ms".equals( type )) { +cn = "org.apache.tomcat.util.net.MasterSlaveEndpoint"; +} +PoolTcpEndpoint res = null; +if( cn != null ) { +try { +Class c = Class.forName( cn ); +res = (PoolTcpEndpoint)c.
svn commit: r348656 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: LeaderFollowerEndpoint.java MasterSlaveEndpoint.java
Author: costin Date: Wed Nov 23 21:22:10 2005 New Revision: 348656 URL: http://svn.apache.org/viewcvs?rev=348656&view=rev Log: Moved all the functionality from PoolTcpEndpoint in 2 separate classes. It was a mess, impossible to understand what thread is created and how. As a result, MasterSlave seems to not be actually using ThreadPools - only LeaderFollower. Added: tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveEndpoint.java Added: tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java?rev=348656&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java Wed Nov 23 21:22:10 2005 @@ -0,0 +1,386 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.net; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.BindException; +import java.net.Socket; +import java.net.SocketException; +import java.security.AccessControlException; +import java.util.Stack; + +import org.apache.tomcat.util.threads.ThreadPool; +import org.apache.tomcat.util.threads.ThreadPoolRunnable; + +/* Similar with MPM module in Apache2.0. Handles all the details related with + "tcp server" functionality - thread management, accept policy, etc. + It should do nothing more - as soon as it get a socket ( and all socket options + are set, etc), it just handle the stream to ConnectionHandler.processConnection. (costin) +*/ + + + +/** + * Handle incoming TCP connections. + * + * Each thread in the pool accepts, then process a request. A spare thread + * will take over the accept. + * + * TODO: can we have all threads in the pool blocked on accept ? + * + * @author James Duncan Davidson [EMAIL PROTECTED] + * @author Jason Hunter [EMAIL PROTECTED] + * @author James Todd [EMAIL PROTECTED] + * @author [EMAIL PROTECTED] + * @author Gal Shachor [EMAIL PROTECTED] + * @author Yoav Shapira <[EMAIL PROTECTED]> + */ +public class LeaderFollowerEndpoint extends PoolTcpEndpoint { // implements Endpoint { + +private final Object threadSync = new Object(); + +private ServerSocketFactory factory; + + +// -- Leader follower fields + + +TcpConnectionHandler handler; +ThreadPoolRunnable listener; +ThreadPool tp; + + +// -- Master slave fields + +/* The background thread. */ +//private Thread thread = null; +/* Available processors. */ +private Stack workerThreads = new Stack(); + + +public LeaderFollowerEndpoint() { + tp = new ThreadPool(); +} + +public LeaderFollowerEndpoint( ThreadPool tp ) { +this.tp=tp; +} + +// Configuration + +public void setMaxThreads(int maxThreads) { + if( maxThreads > 0) + tp.setMaxThreads(maxThreads); +} + +public int getMaxThreads() { +return tp.getMaxThreads(); +} + +public void setMaxSpareThreads(int maxThreads) { + if(maxThreads > 0) + tp.setMaxSpareThreads(maxThreads); +} + +public int getMaxSpareThreads() { +return tp.getMaxSpareThreads(); +} + +public void setMinSpareThreads(int minThreads) { + if(minThreads > 0) + tp.setMinSpareThreads(minThreads); +} + +public int getMinSpareThreads() { +return tp.getMinSpareThreads(); +} + +public void setThreadPriority(int threadPriority) { + tp.setThreadPriority(threadPriority); +} + +public int getThreadPriority() { + return tp.getThreadPriority(); +} + +public void setServerSocketFactory( ServerSocketFactory factory ) { + this.factory=factory; +} + + ServerSocketFactory getServerSocketFactory() { + return factory; + } + + public String getStrategy() { +return "lf"; + } + +public void setStrategy(String strategy) { +} + +public int getCurrentThreadsBusy() { +return curThreads - workerThreads.s
svn commit: r348657 - /tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java
Author: costin Date: Wed Nov 23 21:24:26 2005 New Revision: 348657 URL: http://svn.apache.org/viewcvs?rev=348657&view=rev Log: New Endpoint - as simple as possible, no 'spare threads' or recycling. This is a good fit for embedded - where footprint is more important and you don't expect huge loads. It also makes it easy to organize the code. Note that all the SSL code is gone too ( both here and in base class ) - so same approach as Apr could be taken. Instead of having SslImpl and all the other classes, that will be specific to the endpoint. Added: tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Added: tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java?rev=348657&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Wed Nov 23 21:24:26 2005 @@ -0,0 +1,379 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.net; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.BindException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.security.AccessControlException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Very simple endpoint - no thread pool, no recycling, etc. + * + * Relies the JVM thread pool, if any. + * + * Used for embedded use cases, where you wouldn't expect a huge load, and + * memory is important ( no caching or keeping around objects ). + * + * Note that ServerSocket and the whole SSL machinery is also gone - instead + * use a subclass that extends this and knows about ssl. We may add it back, but + * needs to be fixed. + * + * @author Costin Manolache ( [EMAIL PROTECTED] ) + */ +public class SimpleEndpoint extends PoolTcpEndpoint { + +static Log log=LogFactory.getLog(SimpleEndpoint.class ); + +private final Object threadSync = new Object(); + +/* The background thread. */ +private Thread thread = null; + +public SimpleEndpoint() { +} + + +// Public methods + +public void initEndpoint() throws IOException, InstantiationException { +try { +if(serverSocket==null) { +try { +if (inet == null) { +serverSocket = new ServerSocket(port, backlog); +} else { +serverSocket = new ServerSocket(port, backlog, inet); +} +} catch ( BindException be ) { +throw new BindException(be.getMessage() + ":" + port); +} +} +if( serverTimeout >= 0 ) +serverSocket.setSoTimeout( serverTimeout ); + +thread = new Thread(this, "SimpleEP"); +thread.setDaemon(daemon); +if( getThreadPriority() > 0 ) { +thread.setPriority(getThreadPriority()); +} +thread.setDaemon(true); +thread.start(); + +} catch( IOException ex ) { +throw ex; +} +initialized = true; +} + +public void startEndpoint() throws IOException, InstantiationException { +if (!initialized) { +initEndpoint(); +} +running = true; +paused = false; + +} + +public void pauseEndpoint() { +if (running && !paused) { +paused = true; +unlockAccept(); +} +} + +public void resumeEndpoint() { +if (running) { +paused = false; +} +} + +public void stopEndpoint() { +if (running) { +running = false; +if (serverSocket != null) { +closeServerSocket(); +} +initialized=false ; +} +} + +protected void closeServerSocket() { +if (!paused) +unlockAccept(); +try { +if( serve
svn commit: r348659 - /tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java
Author: costin Date: Wed Nov 23 21:27:02 2005 New Revision: 348659 URL: http://svn.apache.org/viewcvs?rev=348659&view=rev Log: New endpoint - it's a long time since I had this planned, now I got the chance. I think this is the _RIGHT_ way to do the pool and threading - not run any benchmark, but I have a feeling it will be good ( in particular on MP machines !). Each thread is accepting - the kernel decides who gets to process the request ( may accept at the same time on multiple CPUs AFAIK ) - no thread switching or lock or anything. I'll use this as a base for the NIO stuff Added: tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java Added: tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java?rev=348659&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java Wed Nov 23 21:27:02 2005 @@ -0,0 +1,164 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.net; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tomcat.util.threads.ThreadWithAttributes; + + +/** All threads blocked in accept(). New thread created on demand. + * No use of ThreadPool or ServerSocketFactory. + * + * + */ +public class AcceptorEndpoint extends SimpleEndpoint { + +private final Object threadSync = new Object(); + +// -- Leader follower fields + +// -- Master slave fields + +/* The background thread. */ +private Thread thread = null; + +// active acceptors +private int acceptors=0; + +public AcceptorEndpoint() { +} + +// Configuration + +public String getStrategy() { +return "ms"; +} + +public void setStrategy(String strategy) { +} + +public int getCurrentThreadsBusy() { +return curThreads; +} + +// Public methods + +public void startEndpoint() throws IOException, InstantiationException { +if (!initialized) { +initEndpoint(); +} +if( maxSpareThreads == minSpareThreads ) { +maxSpareThreads = minSpareThreads + 4; +} +running = true; +paused = false; +checkSpares(); +} + + +// -- Master Slave Methods + + + +/** Block in accept. If spares is low, create more spares. + * If spares is high - terminate this thread. Checks before + * and after running the connection handler. + */ +class AcceptorThread implements Runnable { +private TcpConnection con = new TcpConnection(); + +public void run() { +Object[] threadData = getConnectionHandler().init(); +while( running ) { +// Loop if endpoint is paused +if( checkSpares() ) { +return; +} + +while (paused) { +try { +Thread.sleep(1000); +} catch (InterruptedException e) { +// Ignore +} +} + +Socket socket = acceptSocket(); + +workerStart(this); + +// Process the request from this socket +processSocket(socket, con, threadData); + +// Finish up this request +workerDone(this); + +if( checkSpares() ) { +return; +} +} + +acceptors--; // we're done +synchronized (threadSync) { +threadSync.notifyAll(); +} +} +} + +public void workerDone(Runnable workerThread) { +curThreads--; +} + +void workerStart( Runnable r ) { +curThreads++; +} + +void newAcceptor() { +acceptors++; +Thread
svn commit: r348662 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: AprEndpoint.java LeaderFollowerWorkerThread.java MasterSlaveWorkerThread.java
Author: costin Date: Wed Nov 23 21:30:33 2005 New Revision: 348662 URL: http://svn.apache.org/viewcvs?rev=348662&view=rev Log: Various fixes to put things in sync Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveWorkerThread.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=348662&r1=348661&r2=348662&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Nov 23 21:30:33 2005 @@ -180,7 +180,7 @@ * SSL context. */ protected long sslContext = 0; - + // - Properties @@ -213,8 +213,13 @@ * Size of the sendfile (= concurrent files which can be served). */ protected int sendfileSize = 256; -public void setSendfileSize(int sendfileSize) { this.sendfileSize = sendfileSize; } -public int getSendfileSize() { return sendfileSize; } +public void setSendfileSize(int sendfileSize) { +this.sendfileSize = sendfileSize; +if( sendfile != null ) sendfile.setSendfileSize(sendfileSize); +} +public int getSendfileSize() { +return sendfileSize; +} /** @@ -276,7 +281,9 @@ */ protected int soTimeout = -1; public int getSoTimeout() { return soTimeout; } -public void setSoTimeout(int soTimeout) { this.soTimeout = soTimeout; } +public void setSoTimeout(int soTimeout) { +this.soTimeout = soTimeout; +} /** @@ -293,7 +300,9 @@ */ protected int pollTime = 5000; public int getPollTime() { return pollTime; } -public void setPollTime(int pollTime) { this.pollTime = pollTime; } +public void setPollTime(int pollTime) { +this.pollTime = pollTime; +} /** @@ -332,8 +341,7 @@ /** * Number of sendfile sockets. */ -protected int sendfileCount = 0; -public int getSendfileCount() { return sendfileCount; } +public int getSendfileCount() { return sendfile.getSendfileCount(); } /** @@ -647,7 +655,8 @@ // Start sendfile thread if (useSendfile) { -sendfile = new Sendfile(); +sendfile = new Sendfile(this, serverSockPool); +sendfile.setSendfileSize(getSendfileSize()); sendfile.init(); sendfileThread = new Thread(sendfile, getName() + "-Sendfile"); sendfileThread.setPriority(getThreadPriority()); @@ -1226,9 +1235,7 @@ } // Tell threadStop() we have shut ourselves down successfully -synchronized (this) { -threadSync.notifyAll(); -} +threadSyncNotify(); } @@ -1246,6 +1253,12 @@ } +// TODO: theradEnd event, etc +public void threadSyncNotify() { +synchronized (this) { +threadSync.notifyAll(); +} +} // --- SendfileData Inner Class @@ -1276,7 +1289,7 @@ /** * Sendfile class. */ -public class Sendfile implements Runnable { +public static class Sendfile implements Runnable { protected long sendfilePollset = 0; protected long pool = 0; @@ -1285,6 +1298,23 @@ protected ArrayList addS; +protected int sendfileCount = 0; +public int getSendfileCount() { return sendfileCount; } + +AprEndpoint ep; +protected long serverSockPool = 0; + + +protected int sendfileSize = 256; +public void setSendfileSize(int sendfileSize) { this.sendfileSize = sendfileSize; } +public int getSendfileSize() { return sendfileSize; } + +public Sendfile( AprEndpoint ep, long serverSockPool ) { +this.ep = ep; +this.serverSockPool = serverSockPool; +} + + /** * Create the sendfile poller. With some versions of APR, the maximum poller size will * be 62 (reocmpiling APR is necessary to remove this limitation). @@ -1292,13 +1322,13 @@ protected void init() { pool = Pool.create(serverSockPool); try { -sendfilePollset = Poll.create(sendfileSize, pool, 0, soTimeout * 1000); +sendfilePollset = Poll.create(sendfileSize, pool, 0, ep.getSoTimeout() * 1000); } catch (Error e) { if (Status.APR_STATUS_IS_EINVAL(e.getError())) { try {
svn commit: r348663 - in /tomcat/sandbox/java/org/apache/tomcat/util/buf: B2CConverter.java ByteChunk.java C2BConverter.java MessageBytes.java TimeStamp.java UDecoder.java UTF8Decoder.java
Author: costin Date: Wed Nov 23 21:31:25 2005 New Revision: 348663 URL: http://svn.apache.org/viewcvs?rev=348663&view=rev Log: Various fixes and deprecations Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/B2CConverter.java tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java tomcat/sandbox/java/org/apache/tomcat/util/buf/C2BConverter.java tomcat/sandbox/java/org/apache/tomcat/util/buf/MessageBytes.java tomcat/sandbox/java/org/apache/tomcat/util/buf/TimeStamp.java tomcat/sandbox/java/org/apache/tomcat/util/buf/UDecoder.java tomcat/sandbox/java/org/apache/tomcat/util/buf/UTF8Decoder.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/B2CConverter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=348663&r1=348662&r2=348663&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/B2CConverter.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/B2CConverter.java Wed Nov 23 21:31:25 2005 @@ -32,6 +32,8 @@ * Not used in the current code, the performance gain is not very big * in the current case ( since String is created anyway ), but it will * be used in a later version or after the remaining optimizations. + * + * @deprecated use CharsetDecoder using the ByteBuffer */ public class B2CConverter { Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=348663&r1=348662&r2=348663&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Wed Nov 23 21:31:25 2005 @@ -688,6 +688,12 @@ if( bb.get(i) != first ) continue; // found first char, now look for a match int myPos=i+1; + +// not enough chars to have a match +if( i + srcLen >= end ) { +break; +} + for( int srcPos=srcOff + 1; srcPos< srcEnd; ) { if( bb.get(myPos++) != src.charAt( srcPos++ )) break; @@ -815,6 +821,7 @@ * * @param value to convert to byte array * @return the byte array value + * @deprecated WRONG, if ascii is all you need - rename the method ! */ public static final byte[] convertToBytes(String value) { byte[] result = new byte[value.length()]; Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/C2BConverter.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/C2BConverter.java?rev=348663&r1=348662&r2=348663&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/C2BConverter.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/C2BConverter.java Wed Nov 23 21:31:25 2005 @@ -27,6 +27,7 @@ * to recycle all the objects that are used. It is compatible with JDK1.1 and up, * ( nio is better, but it's not available even in 1.2 or 1.3 ) * + * @deprecated Use CharsetEncoder on the ByteBuffer */ public final class C2BConverter { @@ -48,19 +49,23 @@ } /** Create a converter + * Not used. */ public C2BConverter(String encoding) throws IOException { this( new ByteChunk(1024), encoding ); } +// Not used public ByteChunk getByteChunk() { return bb; } +// not used public String getEncoding() { return enc; } +// internal use only public void setByteChunk(ByteChunk bb) { this.bb=bb; ios.setByteChunk( bb ); @@ -97,7 +102,7 @@ public final void convert(MessageBytes mb ) throws IOException { int type=mb.getType(); if( type==MessageBytes.T_BYTES ) -return; +return; // why ? ByteChunk orig=bb; setByteChunk( mb.getByteChunk()); bb.recycle(); Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/MessageBytes.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/MessageBytes.java?rev=348663&r1=348662&r2=348663&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/MessageBytes.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/MessageBytes.java Wed Nov 23 21:31:25 2005 @@ -27,7 +27,16 @@ * delayed and cached. Everything is recyclable. * * The object can represent a byte[], a char[], or a (sub) String. All - * operations can be made in case sensitive mode or not. + * operations can be made in case sensitive
svn commit: r348665 - /tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java
Author: costin Date: Wed Nov 23 21:34:19 2005 New Revision: 348665 URL: http://svn.apache.org/viewcvs?rev=348665&view=rev Log: Another experiment - this class uses NIO to get the socket from Xinetd ( I'll also try with launchd ). This allows starting tomcat on-demand, from xinetd/lauchd. Work in progress, I also want to shutdown when idle for too long. This is also targeted to embeded/desktop use. Added: tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java Added: tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java?rev=348665&view=auto == --- tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java (added) +++ tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java Wed Nov 23 21:34:19 2005 @@ -0,0 +1,69 @@ +package org.apache.coyote.standalone; + +import java.io.IOException; +import java.nio.channels.Channel; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.spi.SelectorProvider; +import java.util.Timer; +import java.util.TimerTask; + + +/** + * Used to run tomcat or coyote on demand or on port 80 ( no JNI code needed, + * just (x)inetd, launchd or other simple C wrappers ). This is intended for + * simple configurations, with a single endpoint. + * + * The target for this mode are people running tomcat on their desktop + * machines, either as personal web server or as interface to some applications, + * or as developers. It avoids the need to have tomcat taking memory all the + * time - it starts on demand, when you need it, and stops itself when it's + * idle too long. + * + */ +public class MainInetd extends Main { +Timer timer=new Timer(true); // daemon thread + +public MainInetd() { +} + + +/** + */ +public void run() { +init(); +SelectorProvider sp=SelectorProvider.provider(); + +// check every 5 minutes +timer.scheduleAtFixedRate( new IdleCheck(), 30, 30); +try { +Channel ch=sp.inheritedChannel(); +if(ch!=null ) { +System.err.println("Inherited: " + ch.getClass().getName()); +ServerSocketChannel ssc=(ServerSocketChannel)ch; +proto.getEndpoint().setServerSocket( ssc.socket() ); +} +} catch (IOException e) { +e.printStackTrace(); +} + + + +start(); +} + +class IdleCheck extends TimerTask { + +public void run() { + +} + +} + +// --- Main - +public static void main( String args[]) { +MainInetd sa=new MainInetd(); +sa.run(); +} + + +} \ No newline at end of file - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r348666 - /tomcat/sandbox/java/org/apache/coyote/standalone/Main.java
Author: costin Date: Wed Nov 23 21:35:15 2005 New Revision: 348666 URL: http://svn.apache.org/viewcvs?rev=348666&view=rev Log: Few fixes to match the new changes Modified: tomcat/sandbox/java/org/apache/coyote/standalone/Main.java Modified: tomcat/sandbox/java/org/apache/coyote/standalone/Main.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/standalone/Main.java?rev=348666&r1=348665&r2=348666&view=diff == --- tomcat/sandbox/java/org/apache/coyote/standalone/Main.java (original) +++ tomcat/sandbox/java/org/apache/coyote/standalone/Main.java Wed Nov 23 21:35:15 2005 @@ -29,6 +29,13 @@ return proto; } +/** + */ +public void run() { +init(); +start(); +} + public void init() { proto = new Http11BaseProtocol(); @@ -46,25 +53,20 @@ return mainAdapter; } -/** - */ -public void run() { -init(); -start(); -} - public void start() { -if( proto.getPort() == 0 ) +if( proto.getPort() == 0 && +proto.getEndpoint().getServerSocket() == null) { proto.setPort(8800); +} try { proto.init(); -proto.getThreadPool().setDaemon(false); +proto.getEndpoint().setDaemon(false); proto.start(); -} catch (Exception e) { +} catch (Throwable e) { e.printStackTrace(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r348667 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11BaseProtocol.java Http11Processor.java Http11Protocol.java
Author: costin Date: Wed Nov 23 21:36:28 2005 New Revision: 348667 URL: http://svn.apache.org/viewcvs?rev=348667&view=rev Log: Updates to match the changes in endpoint ( and deprecation /removal of ThreadPool ) Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java?rev=348667&r1=348666&r2=348667&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java Wed Nov 23 21:36:28 2005 @@ -31,7 +31,6 @@ import org.apache.coyote.Adapter; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.RequestGroupInfo; -import org.apache.coyote.RequestInfo; import org.apache.tomcat.util.net.PoolTcpEndpoint; import org.apache.tomcat.util.net.SSLImplementation; import org.apache.tomcat.util.net.SSLSupport; @@ -39,8 +38,6 @@ import org.apache.tomcat.util.net.TcpConnection; import org.apache.tomcat.util.net.TcpConnectionHandler; import org.apache.tomcat.util.res.StringManager; -import org.apache.tomcat.util.threads.ThreadPool; -import org.apache.tomcat.util.threads.ThreadWithAttributes; /** @@ -188,8 +185,9 @@ } // Properties -protected ThreadPool tp=ThreadPool.createThreadPool(true); -protected PoolTcpEndpoint ep=new PoolTcpEndpoint(tp); +// +protected PoolTcpEndpoint ep= PoolTcpEndpoint.getEndpoint("acc"); + protected boolean secure; protected ServerSocketFactory socketFactory; @@ -267,13 +265,9 @@ public String getStrategy() { return ep.getStrategy(); } - -/** Access to the thread pool. - * - * @return tp the internal thread pool used by the protocol - */ - public ThreadPool getThreadPool() { -return tp; + + public PoolTcpEndpoint getEndpoint() { + return ep; } // Tcp setup @@ -577,15 +571,6 @@ return server; } - -private static ServerSocketFactory string2SocketFactory( String val) -throws ClassNotFoundException, IllegalAccessException, -InstantiationException -{ -Class chC=Class.forName( val ); -return (ServerSocketFactory)chC.newInstance(); -} - public int getTimeout() { return timeout; } @@ -607,12 +592,12 @@ public static final int THREAD_DATA_PROCESSOR=1; public static final int THREAD_DATA_OBJECT_NAME=2; -static class Http11ConnectionHandler implements TcpConnectionHandler { +public static class Http11ConnectionHandler implements TcpConnectionHandler { Http11BaseProtocol proto; static int count=0; -RequestGroupInfo global=new RequestGroupInfo(); +public RequestGroupInfo global=new RequestGroupInfo(); -Http11ConnectionHandler( Http11BaseProtocol proto ) { +public Http11ConnectionHandler( Http11BaseProtocol proto ) { this.proto=proto; } @@ -628,7 +613,6 @@ Http11Processor processor = new Http11Processor(proto.maxHttpHeaderSize); processor.setAdapter( proto.adapter ); -processor.setThreadPool( proto.tp ); processor.setEndpoint( proto.ep ); processor.setMaxKeepAliveRequests( proto.maxKeepAliveRequests ); processor.setTimeout( proto.timeout ); @@ -733,24 +717,9 @@ */ private void checkSocketFactory() throws Exception { if (secure) { -try { -// The SSL setup code has been moved into -// SSLImplementation since SocketFactory doesn't -// provide a wide enough interface -sslImplementation = -SSLImplementation.getInstance(sslImplementationName); -socketFactory = sslImplementation.getServerSocketFactory(); -ep.setServerSocketFactory(socketFactory); -} catch (ClassNotFoundException e){ -throw e; -} -} else if (socketFactoryName != null) { -try { -socketFactory = string2SocketFactory(socketFactoryName); -ep.setServerSocketFactory(socketFactory); -} catch(Exception sfex) { -throw sfex; -} +ep.setSSLSupport( secure, sslImplementationName ); +} else { +ep.setSSLSupport( secure, socketFactoryName ); } } Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.j
svn commit: r348668 - in /tomcat/sandbox/java/org/apache/coyote/http11: ./ apr/
Author: costin Date: Wed Nov 23 21:39:36 2005 New Revision: 348668 URL: http://svn.apache.org/viewcvs?rev=348668&view=rev Log: Move the apr stuff to a separate package, to avoid confusion. I plan to try few changes ( i.e. replace direct C-style calls with a higher-level APR, implementing subset of nio/java.net ), but I also want to test the original connectors - this way I can have both Added: tomcat/sandbox/java/org/apache/coyote/http11/apr/ tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java - copied, changed from r345767, tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProtocol.java - copied, changed from r345721, tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/apr/InternalAprInputBuffer.java - copied, changed from r345767, tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/apr/InternalAprOutputBuffer.java - copied, changed from r345722, tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Removed: tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/InternalAprInputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Added: tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java?rev=348668&view=auto == --- tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java (added) +++ tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java Wed Nov 23 21:39:36 2005 @@ -0,0 +1,402 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.coyote.http11.apr; + +import java.net.InetAddress; +import java.net.URLEncoder; + +import org.apache.coyote.ActionCode; +import org.apache.coyote.ActionHook; +import org.apache.coyote.ProtocolHandler; +import org.apache.coyote.RequestGroupInfo; +import org.apache.coyote.http11.Constants; +import org.apache.coyote.http11.Http11BaseProtocol; +import org.apache.tomcat.util.net.AprEndpoint; +import org.apache.tomcat.util.net.AprEndpoint.Handler; + + +/** + * Abstract the protocol implementation, including threading, etc. + * Processor is single threaded and specific to stream-based protocols, + * will not fit Jk protocols like JNI. + * + * @author Remy Maucherat + * @author Costin Manolache + */ +public class Http11AprBaseProtocol extends Http11BaseProtocol implements ProtocolHandler +{ +public Http11AprBaseProtocol() { +ep=new AprEndpoint(); +cHandler = new AprHttp11ConnectionHandler( this ); +setSoLinger(Constants.DEFAULT_CONNECTION_LINGER); +setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT); +// this line is different from super. +//setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT); +setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY); +} + + +/** Start the protocol + */ +public void init() throws Exception { +ep.setName(getName()); +ep.setHandler((AprEndpoint.Handler)cHandler); + +try { +ep.init(); +} catch (Exception ex) { +log.error(sm.getString("http11protocol.endpoint.initerror"), ex); +throw ex; +} +if(log.isInfoEnabled()) +log.info(sm.getString("http11protocol.init", getName())); + +} + +public void start() throws Exception { +try { +ep.start(); +} catch (Exception ex) { +log.error(sm.getString("http11protocol.endpoint.starterror"), ex); +throw ex; +} +if(log.isInfoEnabled()) +log.info(sm.getString("http11protocol.start", getName())); +} + +public void destroy() throws Exception { +if(log.isInfoEnabled()) +log.info(
svn commit: r348669 - /tomcat/sandbox/Tomcat5.5.launch
Author: costin Date: Wed Nov 23 21:41:45 2005 New Revision: 348669 URL: http://svn.apache.org/viewcvs?rev=348669&view=rev Log: Eclipse launcher, for use to debug inside eclipse. Added: tomcat/sandbox/Tomcat5.5.launch Added: tomcat/sandbox/Tomcat5.5.launch URL: http://svn.apache.org/viewcvs/tomcat/sandbox/Tomcat5.5.launch?rev=348669&view=auto == --- tomcat/sandbox/Tomcat5.5.launch (added) +++ tomcat/sandbox/Tomcat5.5.launch Wed Nov 23 21:41:45 2005 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r348670 - /tomcat/sandbox/.classpath
Author: costin Date: Wed Nov 23 21:42:50 2005 New Revision: 348670 URL: http://svn.apache.org/viewcvs?rev=348670&view=rev Log: Add modeler Modified: tomcat/sandbox/.classpath Modified: tomcat/sandbox/.classpath URL: http://svn.apache.org/viewcvs/tomcat/sandbox/.classpath?rev=348670&r1=348669&r2=348670&view=diff == --- tomcat/sandbox/.classpath (original) +++ tomcat/sandbox/.classpath Wed Nov 23 21:42:50 2005 @@ -7,5 +7,6 @@ + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r348672 - in /tomcat/sandbox: .classpath build.xml java/org/apache/tomcat/util/net/AcceptorEndpoint.java
Author: costin Date: Wed Nov 23 22:21:32 2005 New Revision: 348672 URL: http://svn.apache.org/viewcvs?rev=348672&view=rev Log: Few fixes and adjustments Modified: tomcat/sandbox/.classpath tomcat/sandbox/build.xml tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java Modified: tomcat/sandbox/.classpath URL: http://svn.apache.org/viewcvs/tomcat/sandbox/.classpath?rev=348672&r1=348671&r2=348672&view=diff == --- tomcat/sandbox/.classpath (original) +++ tomcat/sandbox/.classpath Wed Nov 23 22:21:32 2005 @@ -8,5 +8,5 @@ - + Modified: tomcat/sandbox/build.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/build.xml?rev=348672&r1=348671&r2=348672&view=diff == --- tomcat/sandbox/build.xml (original) +++ tomcat/sandbox/build.xml Wed Nov 23 22:21:32 2005 @@ -11,6 +11,8 @@ + + @@ -113,7 +115,7 @@ - @@ -126,6 +128,7 @@ + @@ -139,7 +142,7 @@ - @@ -147,22 +150,24 @@ - + - + @@ -179,7 +184,7 @@ - @@ -195,7 +200,7 @@ - + @@ -208,9 +213,23 @@ + + + + + + + + + + + + + + @@ -284,27 +303,51 @@ This is only the http connector, for testing/experimental purposes. --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java?rev=348672&r1=348671&r2=348672&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java Wed Nov 23 22:21:32 2005 @@ -121,6 +121,10 @@ } } +public void run() { +// nothing +} + public void workerDone(Runnable workerThread) { curThreads--; } @@ -132,7 +136,9 @@ void newAcceptor() { acceptors++; Thread t=new ThreadWithAttributes( this, new AcceptorThread()); -t.setPriority(threadPriority); +if( threadPriority > 0 ) { +t.setPriority(threadPriority); +} t.setDaemon(daemon); threadStart( t ); t.start(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r348673 - in /tomcat/sandbox/bin: ./ jam_http11.sh jam_tomcat.sh tomcatInetd.sh
Author: costin Date: Wed Nov 23 22:22:58 2005 New Revision: 348673 URL: http://svn.apache.org/viewcvs?rev=348673&view=rev Log: Few script files for simple tests. Using jamvm - just for fun :-) ( it actually works pretty well ) Added: tomcat/sandbox/bin/ tomcat/sandbox/bin/jam_http11.sh (with props) tomcat/sandbox/bin/jam_tomcat.sh (with props) tomcat/sandbox/bin/tomcatInetd.sh (with props) Added: tomcat/sandbox/bin/jam_http11.sh URL: http://svn.apache.org/viewcvs/tomcat/sandbox/bin/jam_http11.sh?rev=348673&view=auto == --- tomcat/sandbox/bin/jam_http11.sh (added) +++ tomcat/sandbox/bin/jam_http11.sh Wed Nov 23 22:22:58 2005 @@ -0,0 +1,7 @@ +#!/bin/sh + +# run from sandbox dir + +BASE=`pwd`/.. +jamvm -cp $BASE/sandbox/runtime/tomcat-http11.jar:$BASE/repository/rhino1_6R2/js.jar org.apache.coyote.adapters.JsAdapter + Propchange: tomcat/sandbox/bin/jam_http11.sh -- svn:executable = * Added: tomcat/sandbox/bin/jam_tomcat.sh URL: http://svn.apache.org/viewcvs/tomcat/sandbox/bin/jam_tomcat.sh?rev=348673&view=auto == --- tomcat/sandbox/bin/jam_tomcat.sh (added) +++ tomcat/sandbox/bin/jam_tomcat.sh Wed Nov 23 22:22:58 2005 @@ -0,0 +1,3 @@ + +BASE=.. +jamvm -Xms32M -cp $BASE/runtime/tomcat-all-runtime.jar:$BASE/repository/mx4j-3.0.1/lib/mx4j.jar org.apache.catalina.startup.Bootstrap start Propchange: tomcat/sandbox/bin/jam_tomcat.sh -- svn:executable = * Added: tomcat/sandbox/bin/tomcatInetd.sh URL: http://svn.apache.org/viewcvs/tomcat/sandbox/bin/tomcatInetd.sh?rev=348673&view=auto == --- tomcat/sandbox/bin/tomcatInetd.sh (added) +++ tomcat/sandbox/bin/tomcatInetd.sh Wed Nov 23 22:22:58 2005 @@ -0,0 +1,8 @@ +#!/bin/sh + +. $HOME/.bashrc + +$BASE=`pwd`/../.. +export CLASSPATH=$BASE/sandbox/classes:$BASE/connectors/bin +cd $BASE/sandbox +exec sudo -u costin java org.apache.coyote.standalone.MainInetd >/tmp/tc.log 2>&1 Propchange: tomcat/sandbox/bin/tomcatInetd.sh -- svn:executable = * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r349082 - in /tomcat/sandbox/java/org/apache/tomcat/util/threads: ./ res/
Author: costin Date: Fri Nov 25 21:39:20 2005 New Revision: 349082 URL: http://svn.apache.org/viewcvs?rev=349082&view=rev Log: Add threads ( without Reaper and Expirer, not used or needed ) Added: tomcat/sandbox/java/org/apache/tomcat/util/threads/ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java tomcat/sandbox/java/org/apache/tomcat/util/threads/res/ tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings.properties tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_es.properties tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties Added: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=349082&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Fri Nov 25 21:39:20 2005 @@ -0,0 +1,838 @@ +/* + * Copyright 1999-2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.threads; + +import java.util.*; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; + +/** + * A thread pool that is trying to copy the apache process management. + * + * Should we remove this in favor of Doug Lea's thread package? + * + * @author Gal Shachor + * @author Yoav Shapira <[EMAIL PROTECTED]> + */ +public class ThreadPool { + +private static Log log = LogFactory.getLog(ThreadPool.class); + +private static StringManager sm = +StringManager.getManager("org.apache.tomcat.util.threads.res"); + +private static boolean logfull=true; + +/* + * Default values ... + */ +public static final int MAX_THREADS = 200; +public static final int MAX_THREADS_MIN = 10; +public static final int MAX_SPARE_THREADS = 50; +public static final int MIN_SPARE_THREADS = 4; +public static final int WORK_WAIT_TIMEOUT = 60*1000; + +/* + * Where the threads are held. + */ +protected ControlRunnable[] pool = null; + +/* + * A monitor thread that monitors the pool for idel threads. + */ +protected MonitorRunnable monitor; + + +/* + * Max number of threads that you can open in the pool. + */ +protected int maxThreads; + +/* + * Min number of idel threads that you can leave in the pool. + */ +protected int minSpareThreads; + +/* + * Max number of idel threads that you can leave in the pool. + */ +protected int maxSpareThreads; + +/* + * Number of threads in the pool. + */ +protected int currentThreadCount; + +/* + * Number of busy threads in the pool. + */ +protected int currentThreadsBusy; + +/* + * Flag that the pool should terminate all the threads and stop. + */ +protected boolean stopThePool; + +/* Flag to control if the main thread is 'daemon' */ +protected boolean isDaemon=true; + +/** The threads that are part of the pool. + * Key is Thread, value is the ControlRunnable + */ +protected Hashtable threads=new Hashtable(); + +protected Vector listeners=new Vector(); + +/** Name of the threadpool + */ +protected String name = "TP"; + +/** + * Sequence. + */ +protected int sequence = 1; + +/** + * Thread priority. + */ +protected int threadPriority = Thread.NORM_PRIORITY; + + +/** + * Constructor. + */ +public ThreadPool() { +maxThreads = MAX_THREADS; +maxSpareThreads = MAX_SPARE_THREADS; +minSpareThreads = MIN_SPARE_THREADS; +currentThreadCount = 0; +currentThreadsBusy = 0; +stopThePool = false; +} + + +/** Create a ThreadPool instance. + * + * @param jmx UNUSED + * @return ThreadPool instance. If JMX support is requested, you need to +
svn commit: r349084 - in /tomcat/sandbox/java/org/apache/tomcat/util/threads: ThreadPool.java ThreadPoolRunnable.java ThreadWithAttributes.java
Author: costin Date: Fri Nov 25 21:41:43 2005 New Revision: 349084 URL: http://svn.apache.org/viewcvs?rev=349084&view=rev Log: A small change to allow access to the 'param' field in ThreadWithAttributes. This allows passing a param to the thread - like a socket for example Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=349084&r1=349083&r2=349084&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Fri Nov 25 21:41:43 2005 @@ -301,14 +301,15 @@ * Executes a given Runnable on a thread in the pool, block if needed. */ public void runIt(ThreadPoolRunnable r) { -if(null == r) { -throw new NullPointerException(); -} - ControlRunnable c = findControlRunnable(); c.runIt(r); } +public void runIt(ThreadPoolRunnable r, Object param) { +ControlRunnable c = findControlRunnable(); +c.runIt(r, param); +} + private ControlRunnable findControlRunnable() { ControlRunnable c=null; @@ -728,6 +729,11 @@ p.removeThread(Thread.currentThread()); } } + +public synchronized void runIt(ThreadPoolRunnable toRun) { +runIt( toRun, null); +} + /** Run a task * * @param toRun @@ -746,13 +752,11 @@ * * @param toRun */ -public synchronized void runIt(ThreadPoolRunnable toRun) { +public synchronized void runIt(ThreadPoolRunnable toRun, +Object param) { this.toRun = toRun; - // Do not re-init, the whole idea is to run init only once per - // thread - the pool is supposed to run a single task, that is - // initialized once. -// noThData = true; shouldRun = true; +t.setParam(p, param); this.notify(); } Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java?rev=349084&r1=349083&r2=349084&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java Fri Nov 25 21:41:43 2005 @@ -18,6 +18,7 @@ /** Implemented if you want to run a piece of code inside a thread pool. + * You can also use Runnable + ThreadLocal or ThreadWithAttributes. */ public interface ThreadPoolRunnable { // XXX use notes or a hashtable-like Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java?rev=349084&r1=349083&r2=349084&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java Fri Nov 25 21:41:43 2005 @@ -27,7 +27,8 @@ * JDK < 1.4 ). * * The main use is to store 'state' for monitoring ( like "processing - * request 'GET /' "). + * request 'GET /' "), and to simplify information passing between threads. + * */ public class ThreadWithAttributes extends Thread { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r349085 - /tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java
Author: costin Date: Fri Nov 25 21:43:33 2005 New Revision: 349085 URL: http://svn.apache.org/viewcvs?rev=349085&view=rev Log: The nio endpoint. Uses the thread pool. Only accept is implemented - the polling of keep alive needs merging some code in the http11protocol. Added: tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java Added: tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=349085&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java Fri Nov 25 21:43:33 2005 @@ -0,0 +1,316 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.net; + +import java.io.IOException; +import java.net.BindException; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketAddress; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.SelectableChannel; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.util.Iterator; +import java.util.Set; + +import org.apache.tomcat.util.threads.ThreadPool; +import org.apache.tomcat.util.threads.ThreadPoolRunnable; +import org.apache.tomcat.util.threads.ThreadWithAttributes; + + +/** All threads blocked in accept(). New thread created on demand. + * No use of ThreadPool or ServerSocketFactory. + * + * + */ +public class NioEndpoint extends SimpleEndpoint { + +private final Object threadSync = new Object(); + +// active acceptors +private int acceptors=0; + +ThreadPool tp; + +public NioEndpoint() { +tp=new ThreadPool(); +tp.setMinSpareThreads(2); +tp.setMaxSpareThreads(8); +} + +// Configuration +// Thread pool + +public void setMaxThreads(int maxThreads) { +if( maxThreads > 0) +tp.setMaxThreads(maxThreads); +} + +public int getMaxThreads() { +return tp.getMaxThreads(); +} + +public void setMaxSpareThreads(int maxThreads) { +if(maxThreads > 0) +tp.setMaxSpareThreads(maxThreads); +} + +public int getMaxSpareThreads() { +return tp.getMaxSpareThreads(); +} + +public void setMinSpareThreads(int minThreads) { +if(minThreads > 0) +tp.setMinSpareThreads(minThreads); +} + +public int getMinSpareThreads() { +return tp.getMinSpareThreads(); +} + +public void setThreadPriority(int threadPriority) { + tp.setThreadPriority(threadPriority); +} + +public int getThreadPriority() { + return tp.getThreadPriority(); +} + +public void setDaemon(boolean b) { +daemon=b; +tp.setDaemon( b ); +} + +public boolean getDaemon() { +return tp.getDaemon(); +} + +public String getName() { +return tp.getName(); +} + +public void setName(String name) { +tp.setName(name); +} + + +// -- +public String getStrategy() { +return "nio"; +} + +public int getCurrentThreadsBusy() { +return curThreads; +} + +// Public methods + +public void initEndpoint() throws IOException, InstantiationException { +try { +if(serverSocket==null) { +try { +ServerSocketChannel ssc=ServerSocketChannel.open(); +serverSocket = ssc.socket(); +SocketAddress sa = null; +if (inet == null) { +sa = new InetSocketAddress( port ); +} else { +sa = new InetSocketAddress(inet, port); +} +serverSocket.bind( sa , backlog); +} catch ( BindException be ) { +throw new BindException(be.getMessage() + ":" + port); +
svn commit: r351608 - in /tomcat/sandbox/java/org/apache/tomcat/standalone: ./ Tomcat.java
Author: costin Date: Thu Dec 1 22:07:50 2005 New Revision: 351608 URL: http://svn.apache.org/viewcvs?rev=351608&view=rev Log: I'm sure there are other good examples on starting tomcat without server.xml, I just wanted to have a simple and minimal one I can use here. Added: tomcat/sandbox/java/org/apache/tomcat/standalone/ tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java Added: tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java?rev=351608&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java Thu Dec 1 22:07:50 2005 @@ -0,0 +1,74 @@ +/* + */ +package org.apache.tomcat.standalone; + +import java.io.File; +import java.io.IOException; + +import org.apache.catalina.connector.Connector; +import org.apache.catalina.core.StandardEngine; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.core.StandardServer; +import org.apache.catalina.core.StandardService; +import org.apache.catalina.startup.HostConfig; + +public class Tomcat { + +public static void main( String args[] ) { +try { +startTomcat(); +} catch (Exception e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} +} + +private static void startTomcat() throws Exception { +String catalinaHome = System.getProperty("catalina.home"); +if(catalinaHome==null) { +catalinaHome=System.getProperty("user.dir"); +File home = new File(catalinaHome); +if (!home.isAbsolute()) { +try { +catalinaHome = home.getCanonicalPath(); +} catch (IOException e) { +catalinaHome = home.getAbsolutePath(); +} +} +System.setProperty("catalina.home", catalinaHome); +} + +if( System.getProperty("catalina.base") == null ) { +System.setProperty("catalina.base", catalinaHome); +} +System.setProperty("catalina.useNaming", "false"); + +StandardServer server = new StandardServer(); +server.setPort( -1 ); +//tc.setServer( server ); + +StandardService service = new StandardService(); +server.addService( service ); + +Connector connector = new Connector("HTTP/1.1"); +service.addConnector( connector ); +connector.setPort( 8000 ); + +StandardEngine eng = new StandardEngine(); +eng.setName( "default" ); +eng.setDefaultHost("localhost"); +service.setContainer(eng); + +StandardHost host = new StandardHost(); +host.setName( "localhost"); +host.setAppBase("webapps"); +HostConfig hconfig = new HostConfig(); +host.addLifecycleListener( hconfig ); + +eng.addChild( host ); + +server.initialize(); + +server.start(); +} +} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r351609 - /tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java
Author: costin Date: Thu Dec 1 22:16:57 2005 New Revision: 351609 URL: http://svn.apache.org/viewcvs?rev=351609&view=rev Log: Cut&paste the jsp->class mangling code, so runtime can execute precompiled ( or cached ) jsps. JspServlet depends on compiler and a lot of stuff - with this the only dep is jasper-runtime.jar and commons-el.jar ( and jsp-api.jar ). Modified: tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java Modified: tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java?rev=351609&r1=351608&r2=351609&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java Thu Dec 1 22:16:57 2005 @@ -1,6 +1,8 @@ package org.apache.tomcat.servlets.jsp; import java.io.IOException; +import java.util.HashMap; +import java.util.Vector; import javax.servlet.ServletConfig; import javax.servlet.ServletException; @@ -8,17 +10,65 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +/** If jasper is found, it'll just forward the calls to jasper jsp servlet. + * + * If jasper is not found - i.e. runtime without jasper compiler - it'll + * compute the mangled class name ( same code as jasper ) + * and invoke the jsp servlet directly. + * + * @author Costin Manolache + */ public class JspProxyServlet extends HttpServlet { HttpServlet realJspServlet; +static HashMap jsps=new HashMap(); -protected void service(HttpServletRequest arg0, HttpServletResponse arg1) +protected void service(HttpServletRequest req, HttpServletResponse arg1) throws ServletException, IOException { if( realJspServlet!=null ) { -realJspServlet.service(arg0, arg1); +realJspServlet.service(req, arg1); return; } -arg1.setStatus(404); + +String jspUri=null; + +String jspFile = (String)req.getAttribute("org.apache.catalina.jsp_file"); +if (jspFile != null) { +// JSP is specified via in declaration +jspUri = jspFile; +} else { +// RequestDispatcher.include() +jspUri = (String)req.getAttribute("javax.servlet.include.servlet_path"); +if (jspUri != null) { +String pathInfo = (String)req.getAttribute("javax.servlet.include.path_info"); +if (pathInfo != null) { +jspUri += pathInfo; +} +} else { +jspUri = req.getServletPath(); +String pathInfo = req.getPathInfo(); +if (pathInfo != null) { +jspUri += pathInfo; +} +} +} + +String mangledClass = getClassName( jspFile ); + +System.err.println("Class: " + mangledClass ); + +// TODO: if class not found - invoke some external jspc +HttpServlet jsp = (HttpServlet)jsps.get( mangledClass ); +if( jsp == null ) { +try { +Class sC=Class.forName( mangledClass ); +jsp=(HttpServlet)sC.newInstance(); +} catch( Throwable t ) { +t.printStackTrace(); +arg1.setStatus(404); +} +} +jsp.service( req, arg1); } public void init(ServletConfig arg0) throws ServletException { @@ -36,5 +86,125 @@ } } - -} +private String getClassName( String jspUri ) { +int iSep = jspUri.lastIndexOf('/') + 1; +String className = makeJavaIdentifier(jspUri.substring(iSep)); +String basePackageName = JSP_PACKAGE_NAME; + +iSep--; +String derivedPackageName = (iSep > 0) ? +makeJavaPackage(jspUri.substring(1,iSep)) : ""; + +if (derivedPackageName.length() == 0) { +return basePackageName + "." + className; +} +return basePackageName + '.' + derivedPackageName + "." + className; +} + +// - Copied from jasper --- + +public static final String JSP_PACKAGE_NAME = "org.apache.jsp"; + +public static final String makeJavaIdentifier(String identifier) { +StringBuffer modifiedIdentifier = +new StringBuffer(identifier.length()); +if (!Character.isJavaIdentifierStart(identifier.charAt(0))) { +modifiedIdentifier.append('_'); +} +for (int i = 0; i < identifier.length(); i++) { +char ch = identifier.char
svn commit: r365816 - /tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
Author: costin Date: Tue Jan 3 20:10:57 2006 New Revision: 365816 URL: http://svn.apache.org/viewcvs?rev=365816&view=rev Log: Since this is sandbox, let's see if we can get rid of the monitor thread, and instead do the same checks on each worker thread, before and after a task is performed. Also expose the controller, to make it a bit more flexible and avoid wrappings Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=365816&r1=365815&r2=365816&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Tue Jan 3 20:10:57 2006 @@ -45,7 +45,6 @@ public static final int MAX_THREADS_MIN = 10; public static final int MAX_SPARE_THREADS = 50; public static final int MIN_SPARE_THREADS = 4; -public static final int WORK_WAIT_TIMEOUT = 60*1000; /* * Where the threads are held. @@ -53,12 +52,6 @@ protected ControlRunnable[] pool = null; /* - * A monitor thread that monitors the pool for idel threads. - */ -protected MonitorRunnable monitor; - - -/* * Max number of threads that you can open in the pool. */ protected int maxThreads; @@ -146,13 +139,6 @@ pool = new ControlRunnable[maxThreads]; openThreads(minSpareThreads); -if (maxSpareThreads < maxThreads) { -monitor = new MonitorRunnable(this); -} -} - -public MonitorRunnable getMonitor() { -return monitor; } /** @@ -286,7 +272,7 @@ } public void run(Runnable r) { -ControlRunnable c = findControlRunnable(); +ControlRunnable c = findControlRunnable(true); c.runIt(r); } @@ -301,16 +287,25 @@ * Executes a given Runnable on a thread in the pool, block if needed. */ public void runIt(ThreadPoolRunnable r) { -ControlRunnable c = findControlRunnable(); +ControlRunnable c = findControlRunnable(true); c.runIt(r); } public void runIt(ThreadPoolRunnable r, Object param) { -ControlRunnable c = findControlRunnable(); +ControlRunnable c = findControlRunnable(true); c.runIt(r, param); } -private ControlRunnable findControlRunnable() { +/** Find a worker thread and remove it from the pool. + * + * If the pool is stopping, will generate a runtime exception to + * block the processing. + * + * + * @param waitForThread if true, will wait for a thread to become available. + * @return + */ +public ControlRunnable findControlRunnable(boolean waitForThread) { ControlRunnable c=null; if ( stopThePool ) { @@ -329,6 +324,9 @@ openThreads(toOpen); } else { logFull(log, currentThreadCount, maxThreads); +if( ! waitForThread ) { +return null; +} // Wait for a thread to become idel. try { this.wait(); @@ -385,10 +383,6 @@ public synchronized void shutdown() { if(!stopThePool) { stopThePool = true; -if (monitor != null) { -monitor.terminate(); -monitor = null; -} for(int i = 0; i < currentThreadCount - currentThreadsBusy; i++) { try { pool[i].terminate(); @@ -406,6 +400,16 @@ } } +boolean checkSpare() { +if( stopThePool ) { +return true; // die, the pool is stopped +} +if( (currentThreadCount - currentThreadsBusy) > maxSpareThreads ) { +return true; +} +return false; +} + /** * Called by the monitor thread to harvest idle threads. */ @@ -525,71 +529,9 @@ //loghelper.flush(); } -/** - * Periodically execute an action - cleanup in this case - */ -public static class MonitorRunnable implements Runnable { -ThreadPool p; -Thread t; -int interval=WORK_WAIT_TIMEOUT; -booleanshouldTerminate; - -MonitorRunnable(ThreadPool p) { -this.p=p; -this.start(); -} - -public void start() { -shouldTerminate = false; -t = new Thread(this); -t.setDaemon(p.getDaemon() ); - t.setName(p.getName() + "-Monitor"); -t.start(); -} - -public void setInterval(int i ) { -this.interval=i; -} - -
svn commit: r365855 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: AcceptorEndpoint.java SimpleEndpoint.java
Author: costin Date: Tue Jan 3 23:42:26 2006 New Revision: 365855 URL: http://svn.apache.org/viewcvs?rev=365855&view=rev Log: Having all threads blocked in accept ( instead of using a thread pool and notifications ) and simple thread management is 'simple' enough to be in the simple endpoint, no need for 2. Removed: tomcat/sandbox/java/org/apache/tomcat/util/net/AcceptorEndpoint.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java?rev=365855&r1=365854&r2=365855&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Tue Jan 3 23:42:26 2006 @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.tomcat.util.threads.ThreadWithAttributes; /** @@ -47,11 +48,14 @@ static Log log=LogFactory.getLog(SimpleEndpoint.class ); private final Object threadSync = new Object(); + +// active acceptors +private int acceptors=0; -/* The background thread. */ -private Thread thread = null; public SimpleEndpoint() { +maxSpareThreads = 4; +minSpareThreads = 1; } @@ -73,14 +77,6 @@ if( serverTimeout >= 0 ) serverSocket.setSoTimeout( serverTimeout ); -thread = new Thread(this, "SimpleEP"); -thread.setDaemon(daemon); -if( getThreadPriority() > 0 ) { -thread.setPriority(getThreadPriority()); -} -thread.setDaemon(true); -thread.start(); - } catch( IOException ex ) { throw ex; } @@ -93,9 +89,52 @@ } running = true; paused = false; +if( maxSpareThreads == minSpareThreads ) { +maxSpareThreads = minSpareThreads + 4; +} + +// Start the first thread +checkSpares(); +} + +/** Check the spare situation. If not enough - create more. + * If too many - return true to end this. + * + * This is the main method to handle the number of threads. + * + * @return + */ +boolean checkSpares() { +// make sure we have min spare threads +while( (acceptors - curThreads ) < minSpareThreads ) { +if( acceptors >= maxThreads ) { +// limit reached, we won't accept any more requests. +} else { +newAcceptor(); +} +} +if( acceptors - curThreads > maxSpareThreads ) { +threadEnd( Thread.currentThread() ); +return true; // this one should go +} + +return false; } +void newAcceptor() { +acceptors++; +Thread t=new ThreadWithAttributes( this, new AcceptorRunnable()); +t.setName("Tomcat-" + acceptors); +if( threadPriority > 0 ) { +t.setPriority(threadPriority); +} +t.setDaemon(daemon); +threadStart( t ); +t.start(); +} + + public void pauseEndpoint() { if (running && !paused) { paused = true; @@ -254,7 +293,7 @@ return accepted; } -protected void processSocket(Socket s, TcpConnection con, Object[] threadData) { +public void processSocket(Socket s, TcpConnection con, Object[] threadData) { // Process the connection int step = 1; try { @@ -299,81 +338,63 @@ } } - -/** - * Accept, dispatch on a new thread. May benefit from VM thread pooling, but - * the goal is to minimize the number of resources used. - * - * TODO: change this to use NIO, use the thread for other control events - * ( timers, etc ) that would require a separate thread. - * - * TODO: maybe add back ability to do pooling, by refactoring ThreadPool - * or adding some optional interface. Maybe better abstract the other endpoint - * thread models in a new TP interface. - */ public void run() { +// nothing here, all action is in AcceptorRunnable +} -// Loop until we receive a shutdown command -while (running) { +class AcceptorRunnable implements Runnable { +private TcpConnection con = new TcpConnection(); -// Loop if endpoint is paused -while (paused) { -try { -Thread.sleep(1000); -} catch (InterruptedException e) { -// Ignore + +/** + * Accept, dispa
svn commit: r365856 - in /tomcat/sandbox/java/org/apache/tomcat/util/net/apr: ./ AprByteChannel.java AprEndpoint.java AprFileChannel.java AprSocket.java
Author: costin Date: Tue Jan 3 23:45:04 2006 New Revision: 365856 URL: http://svn.apache.org/viewcvs?rev=365856&view=rev Log: Remove duplicate code, few more attempts to find a 'consistent' way to deal with apr by implementing nio interfaces using apr. Added: tomcat/sandbox/java/org/apache/tomcat/util/net/apr/ tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprByteChannel.java tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprEndpoint.java - copied, changed from r348662, tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprFileChannel.java tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprSocket.java Added: tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprByteChannel.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprByteChannel.java?rev=365856&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprByteChannel.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprByteChannel.java Tue Jan 3 23:45:04 2006 @@ -0,0 +1,26 @@ +/* + */ +package org.apache.tomcat.util.net.apr; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.ByteChannel; + +public class AprByteChannel implements ByteChannel { + +public int read(ByteBuffer dst) throws IOException { +return 0; +} + +public boolean isOpen() { +return false; +} + +public void close() throws IOException { +} + +public int write(ByteBuffer src) throws IOException { +return 0; +} + +} Copied: tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprEndpoint.java (from r348662, tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java) URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprEndpoint.java?p2=tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprEndpoint.java&p1=tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java&r1=348662&r2=365856&rev=365856&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/apr/AprEndpoint.java Tue Jan 3 23:45:04 2006 @@ -14,27 +14,26 @@ * limitations under the License. */ -package org.apache.tomcat.util.net; +package org.apache.tomcat.util.net.apr; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Stack; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.tomcat.jni.OS; import org.apache.tomcat.jni.Address; import org.apache.tomcat.jni.Error; -import org.apache.tomcat.jni.File; import org.apache.tomcat.jni.Library; +import org.apache.tomcat.jni.OS; import org.apache.tomcat.jni.Poll; import org.apache.tomcat.jni.Pool; -import org.apache.tomcat.jni.Socket; -import org.apache.tomcat.jni.Status; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.jni.SSLContext; import org.apache.tomcat.jni.SSLSocket; +import org.apache.tomcat.jni.Socket; +import org.apache.tomcat.jni.Status; +import org.apache.tomcat.util.net.PoolTcpEndpoint; +import org.apache.tomcat.util.net.TcpConnection; +import org.apache.tomcat.util.net.TcpConnectionHandler; import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.threads.ThreadWithAttributes; @@ -221,23 +220,6 @@ return sendfileSize; } - -/** - * Server socket port. - */ -protected int port; -public int getPort() { return port; } -public void setPort(int port ) { this.port=port; } - - -/** - * Address for the server socket. - */ -protected InetAddress address; -public InetAddress getAddress() { return address; } -public void setAddress(InetAddress address) { this.address = address; } - - /** * Handling of accepted sockets. */ @@ -261,32 +243,6 @@ /** - * Socket TCP no delay. - */ -protected boolean tcpNoDelay = false; -public boolean getTcpNoDelay() { return tcpNoDelay; } -public void setTcpNoDelay(boolean tcpNoDelay) { this.tcpNoDelay = tcpNoDelay; } - - -/** - * Socket linger. - */ -protected int soLinger = 100; -public int getSoLinger() { return soLinger; } -public void setSoLinger(int soLinger) { this.soLinger = soLinger; } - - -/** - * Socket timeout. - */ -protected int soTimeout = -1; -public int getSoTimeout() { return soTimeout; } -public void setSoTimeout(int soTimeout) { -this.soTimeout = soTimeout; -} - - -/** * Timeout on first request read before going to the poller, in ms. */ protected int firstReadTimeout = 100; @@ -304,25 +260,
svn commit: r365857 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: ./ javaio/ nio/
Author: costin Date: Tue Jan 3 23:48:20 2006 New Revision: 365857 URL: http://svn.apache.org/viewcvs?rev=365857&view=rev Log: Moving code around, so it can be used at the same time with the old one ( if needed ) and to make it easier to exclude or package. The old endpoint is in javaio, with the ssl abstractions that don't fit APR nor NIO. Few more simplifications and fixes to nio to reduce the thread use ( same as in LeaderFollower I think ) Added: tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/ tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/DefaultServerSocketFactory.java - copied, changed from r348654, tomcat/sandbox/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/LeaderFollowerEndpoint.java - copied, changed from r348656, tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/LeaderFollowerWorkerThread.java - copied, changed from r348662, tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/MasterSlaveEndpoint.java - copied, changed from r348656, tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/MasterSlaveWorkerThread.java - copied, changed from r348662, tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/SSLImplementation.java - copied, changed from r348654, tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/SSLSupport.java - copied, changed from r348654, tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/ServerSocketFactory.java - copied, changed from r348654, tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java tomcat/sandbox/java/org/apache/tomcat/util/net/nio/ tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java - copied, changed from r349085, tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java Removed: tomcat/sandbox/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/LeaderFollowerWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/MasterSlaveWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/SSLImplementation.java tomcat/sandbox/java/org/apache/tomcat/util/net/SSLSupport.java tomcat/sandbox/java/org/apache/tomcat/util/net/ServerSocketFactory.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java?rev=365857&r1=365856&r2=365857&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java Tue Jan 3 23:48:20 2006 @@ -26,8 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; -import org.apache.tomcat.util.threads.ThreadPool; -import org.apache.tomcat.util.threads.ThreadPool.ThreadPoolListener; /* Similar with MPM module in Apache2.0. Handles all the details related with "tcp server" functionality - thread management, accept policy, etc. @@ -54,7 +52,7 @@ */ public class PoolTcpEndpoint implements Runnable { // implements Endpoint { -static Log log=LogFactory.getLog(PoolTcpEndpoint.class ); +protected static Log log=LogFactory.getLog(PoolTcpEndpoint.class ); protected StringManager sm = StringManager.getManager("org.apache.tomcat.util.net.res"); @@ -89,7 +87,7 @@ protected int maxThreads = 20; protected int maxSpareThreads = 20; protected int minSpareThreads = 20; -protected String type; +protected String type = "default"; protected String name = "EP"; // base name for threads @@ -98,6 +96,8 @@ protected boolean daemon = true; private ArrayList listeners = new ArrayList(); + +private boolean polling; public PoolTcpEndpoint() { } @@ -105,16 +105,16 @@ public static
svn commit: r365858 - /tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java
Author: costin Date: Tue Jan 3 23:48:42 2006 New Revision: 365858 URL: http://svn.apache.org/viewcvs?rev=365858&view=rev Log: few extra checks Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=365858&r1=365857&r2=365858&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java Tue Jan 3 23:48:42 2006 @@ -690,15 +690,19 @@ int myPos=i+1; // not enough chars to have a match -if( i + srcLen >= end ) { +if( myPos + srcLen >= end ) { break; } +try { for( int srcPos=srcOff + 1; srcPos< srcEnd; ) { if( bb.get(myPos++) != src.charAt( srcPos++ )) break; if( srcPos==srcEnd ) return i-start; // found it } +} catch( Throwable t ) { +t.printStackTrace(); +} } return -1; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r365859 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11BaseProtocol.java Http11Processor.java Http11Protocol.java apr/Http11AprBaseProtocol.java apr/Http11AprProcessor.java
Author: costin Date: Tue Jan 3 23:51:50 2006 New Revision: 365859 URL: http://svn.apache.org/viewcvs?rev=365859&view=rev Log: Update for the new apr package, remove the old ssl abstraction. Since APR and NIO can't use the SocketFactory, nor JK - it doesn't make any sense to keep it for anything but the old-style connector ( which should be deprecated/removed eventually ). This also brings APR, NIO, JK closer in how they can deal with SSL. Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java?rev=365859&r1=365858&r2=365859&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java Tue Jan 3 23:51:50 2006 @@ -32,11 +32,11 @@ import org.apache.coyote.ProtocolHandler; import org.apache.coyote.RequestGroupInfo; import org.apache.tomcat.util.net.PoolTcpEndpoint; -import org.apache.tomcat.util.net.SSLImplementation; -import org.apache.tomcat.util.net.SSLSupport; -import org.apache.tomcat.util.net.ServerSocketFactory; import org.apache.tomcat.util.net.TcpConnection; import org.apache.tomcat.util.net.TcpConnectionHandler; +//import org.apache.tomcat.util.net.javaio.SSLImplementation; +//import org.apache.tomcat.util.net.javaio.SSLSupport; +//import org.apache.tomcat.util.net.javaio.ServerSocketFactory; import org.apache.tomcat.util.res.StringManager; @@ -124,6 +124,7 @@ throw ex; } +/* Endpoint should know about ssl. if( socketFactory!=null ) { Enumeration attE=attributes.keys(); while( attE.hasMoreElements() ) { @@ -132,6 +133,7 @@ socketFactory.setAttribute( key, v ); } } +*/ // XXX get domain from registration try { @@ -186,12 +188,13 @@ // Properties // -protected PoolTcpEndpoint ep= PoolTcpEndpoint.getEndpoint("acc"); +protected PoolTcpEndpoint ep= PoolTcpEndpoint.getEndpoint(null); protected boolean secure; -protected ServerSocketFactory socketFactory; -protected SSLImplementation sslImplementation; +// Old style, no longer supported by apr, nio +//protected ServerSocketFactory socketFactory; +//protected SSLImplementation sslImplementation; // socket factory attriubtes ( XXX replace with normal setters ) protected Hashtable attributes = new Hashtable(); protected String socketFactoryName=null; @@ -646,7 +649,12 @@ InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); -if( proto.secure ) { +processor.setSecure( proto.secure ); + +/* This was passing the ssl info from potocol to processor. + * Now endpoing knows all about ssl. + * + if( proto.secure ) { SSLSupport sslSupport=null; if(proto.sslImplementation != null) sslSupport = proto.sslImplementation.getSSLSupport(socket); @@ -654,6 +662,7 @@ } else { processor.setSSLSupport( null ); } +*/ processor.setSocket( socket ); processor.process(in, out); Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java?rev=365859&r1=365858&r2=365859&view=diff == --- tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java Tue Jan 3 23:51:50 2006 @@ -51,7 +51,7 @@ import org.apache.tomcat.util.http.FastHttpDateFormat; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.net.PoolTcpEndpoint; -import org.apache.tomcat.util.net.SSLSupport; +//import org.apache.tomcat.util.net.javaio.SSLSupport; import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.threads.ThreadWithAttributes; @@ -197,9 +197,14 @@ /** - * SSL information. + * SSL information - removed, specific to old-style java
svn commit: r377051 - in /tomcat/sandbox: ./ java/org/apache/tomcat/servlets/jsp/ java/org/apache/tomcat/standalone/ java/org/apache/tomcat/util/buf/ java/org/apache/tomcat/util/net/ resources/
Author: costin Date: Sat Feb 11 12:42:42 2006 New Revision: 377051 URL: http://svn.apache.org/viewcvs?rev=377051&view=rev Log: A couple of small improvements to the 'embeded' tomcat sandbox. Now it can work with only web.xml - or no xml files at all. Added: tomcat/sandbox/java/org/apache/tomcat/standalone/ETomcat.java tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java - copied, changed from r375161, tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java Removed: tomcat/sandbox/java/org/apache/tomcat/standalone/Tomcat.java Modified: tomcat/sandbox/.classpath tomcat/sandbox/build.xml tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java tomcat/sandbox/java/org/apache/tomcat/util/buf/ByteChunk.java tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java tomcat/sandbox/resources/runtime.MF Modified: tomcat/sandbox/.classpath URL: http://svn.apache.org/viewcvs/tomcat/sandbox/.classpath?rev=377051&r1=377050&r2=377051&view=diff == --- tomcat/sandbox/.classpath (original) +++ tomcat/sandbox/.classpath Sat Feb 11 12:42:42 2006 @@ -2,11 +2,13 @@ - + + + Modified: tomcat/sandbox/build.xml URL: http://svn.apache.org/viewcvs/tomcat/sandbox/build.xml?rev=377051&r1=377050&r2=377051&view=diff == --- tomcat/sandbox/build.xml (original) +++ tomcat/sandbox/build.xml Sat Feb 11 12:42:42 2006 @@ -11,8 +11,8 @@ - - + + @@ -141,13 +141,14 @@ - + - + + @@ -195,24 +196,29 @@ + depends="compile-connectors,compile-container,compile-sandbox,compile-jasper"/> - + - + + + + + - + @@ -221,6 +227,7 @@ + @@ -352,7 +359,7 @@ - + Modified: tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java?rev=377051&r1=377050&r2=377051&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/servlets/jsp/JspProxyServlet.java Sat Feb 11 12:42:42 2006 @@ -5,6 +5,7 @@ import java.util.Vector; import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -14,7 +15,12 @@ * * If jasper is not found - i.e. runtime without jasper compiler - it'll * compute the mangled class name ( same code as jasper ) - * and invoke the jsp servlet directly. + * and invoke the jsp servlet directly. If the class is not found, it'll execute + * "jspc" and try again. + * + * + * + * TODO: test jspc, generate files in or out web-inf dir, modify web.xml * * @author Costin Manolache */ @@ -64,11 +70,33 @@ Class sC=Class.forName( mangledClass ); jsp=(HttpServlet)sC.newInstance(); } catch( Throwable t ) { +} +} +if(jsp == null) { + +} +// try again +if( jsp == null ) { +try { +Class sC=Class.forName( mangledClass ); +jsp=(HttpServlet)sC.newInstance(); +} catch( Throwable t ) { t.printStackTrace(); arg1.setStatus(404); } } jsp.service( req, arg1); +} + +private void compileJsp(ServletContext ctx, String jspPath) { +// Params to pass to jspc: +// classpath + +// webapp base dir +String baseDir = ctx.getRealPath("/"); +// jsp path ( rel. base dir ) + + } public void init(ServletConfig arg0) throws ServletException { Added: tomcat/sandbox/java/org/apache/tomcat/standalone/ETomcat.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/ETomcat.java?rev=377051&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/standalone/ETomcat.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/standalone/ETomcat.java Sat Feb 11 12:42
svn commit: r380998 - in /tomcat/sandbox: bin/ java/org/apache/tomcat/standalone/ java/org/apache/tomcat/util/net/ js-bin/ webapps/
Author: costin Date: Sat Feb 25 13:35:16 2006 New Revision: 380998 URL: http://svn.apache.org/viewcvs?rev=380998&view=rev Log: Few adjustments Added: tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java tomcat/sandbox/js-bin/ tomcat/sandbox/webapps/ Modified: tomcat/sandbox/bin/jam_tomcat.sh tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Modified: tomcat/sandbox/bin/jam_tomcat.sh URL: http://svn.apache.org/viewcvs/tomcat/sandbox/bin/jam_tomcat.sh?rev=380998&r1=380997&r2=380998&view=diff == --- tomcat/sandbox/bin/jam_tomcat.sh (original) +++ tomcat/sandbox/bin/jam_tomcat.sh Sat Feb 25 13:35:16 2006 @@ -1,3 +1,4 @@ +#!/bin/sh -BASE=.. -jamvm -Xms32M -cp $BASE/runtime/tomcat-all-runtime.jar:$BASE/repository/mx4j-3.0.1/lib/mx4j.jar org.apache.catalina.startup.Bootstrap start +BASE=`pwd`/.. +jamvm -Xms32M -cp $BASE/sandbox/runtime/tomcat-runtime.jar:$BASE/repository/mx4j-3.0.1/lib/mx4j.jar org.apache.tomcat.standalone.Main $* Modified: tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java?rev=380998&r1=380997&r2=380998&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java Sat Feb 25 13:35:16 2006 @@ -31,14 +31,19 @@ return; } String dispatch = args[0]; +// default: use conf/, server.xml, etc String launcher = "org.apache.catalina.startup.Bootstrap"; if( "-webapps".equals(dispatch) ) { +// webapps dir, autodeploy launcher = "org.apache.tomcat.standalone.WebappsMain"; -} else if("-app".equals(dispatch)) { -launcher = "org.apache.tomcat.standalone.SimpleAppsMain"; +} else if("-single".equals(dispatch)) { +// one webapp, using web.xml +launcher = "org.apache.tomcat.standalone.SingleMain"; } else if("-etomcat".equals(dispatch)) { +// explicit control, no XML launcher = "org.apache.tomcat.standalone.ETomcat"; } else if("-coyote".equals(dispatch)) { +// only http11, no servlets launcher = "org.apache.coyote.standalone.Main"; } try { Added: tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java?rev=380998&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java Sat Feb 25 13:35:16 2006 @@ -0,0 +1,52 @@ +/* + */ +package org.apache.tomcat.standalone; + +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.startup.ContextConfig; + +/** + * Start tomcat using server.xml and web.xml and regular config files + * + * @author Costin Manolache + */ +public class SingleMain extends ETomcat { + +public static void main( String args[] ) { +try { +SingleMain etomcat = new SingleMain(); + +etomcat.initServer(null); +etomcat.initConnector(8000); + +// Use this to load indivitdual webapp, without auto-deployment +etomcat.initHost("localhost"); + +if( args.length < 2 ) { +etomcat.initWebXmlApp("/", "webapps/ROOT"); +} else { +etomcat.initWebapp(args[0], args[1]); +etomcat.initWebappDefaults(); +} + +etomcat.start(); +} catch (Exception e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} +} + +public StandardContext initWebXmlApp(String path, String dir) { +ctx = new StandardContext(); +ctx.setPath( path ); +ctx.setDocBase(dir); + +// web.xml reader +ContextConfig ctxCfg = new ContextConfig(); +ctx.addLifecycleListener( ctxCfg ); + +host.addChild(ctx); +return ctx; +} + +} Modified: tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java?rev=380998&
svn commit: r389421 - in /tomcat/tc6.0.x/trunk: .classpath .project
Author: costin Date: Mon Mar 27 22:45:43 2006 New Revision: 389421 URL: http://svn.apache.org/viewcvs?rev=389421&view=rev Log: Add eclipse files Added: tomcat/tc6.0.x/trunk/.classpath tomcat/tc6.0.x/trunk/.project Added: tomcat/tc6.0.x/trunk/.classpath URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/.classpath?rev=389421&view=auto == --- tomcat/tc6.0.x/trunk/.classpath (added) +++ tomcat/tc6.0.x/trunk/.classpath Mon Mar 27 22:45:43 2006 @@ -0,0 +1,10 @@ + + + + + + + + + + Added: tomcat/tc6.0.x/trunk/.project URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/.project?rev=389421&view=auto == --- tomcat/tc6.0.x/trunk/.project (added) +++ tomcat/tc6.0.x/trunk/.project Mon Mar 27 22:45:43 2006 @@ -0,0 +1,17 @@ + + + tomcat6 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r389423 - /tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd
Author: costin Date: Mon Mar 27 22:49:35 2006 New Revision: 389423 URL: http://svn.apache.org/viewcvs?rev=389423&view=rev Log: Seems to be required as well, someone is looking for it. Could someone confirm this is where it should be - I get WARNING: Could not get url for /javax/servlet/resources/web-jsptaglibrary_2_0.xsd Added: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd (with props) Added: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd?rev=389423&view=auto == --- tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd (added) +++ tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd Mon Mar 27 22:49:35 2006 @@ -0,0 +1,1025 @@ + + +http://java.sun.com/xml/ns/j2ee"; + xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"; + xmlns:xsd="http://www.w3.org/2001/XMLSchema"; + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="2.0"> + + + + %W% %G% + + + + + + + Copyright 2003 Sun Microsystems, Inc., 901 San Antonio + Road, Palo Alto, California 94303, U.S.A. All rights + reserved. + + Sun Microsystems, Inc. has intellectual property rights + relating to technology described in this document. In + particular, and without limitation, these intellectual + property rights may include one or more of the U.S. patents + listed at http://www.sun.com/patents and one or more + additional patents or pending patent applications in the + U.S. and other countries. + + This document and the technology which it describes are + distributed under licenses restricting their use, copying, + distribution, and decompilation. No part of this document + may be reproduced in any form by any means without prior + written authorization of Sun and its licensors, if any. + + Third-party software, including font technology, is + copyrighted and licensed from Sun suppliers. + + Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE, + JavaServer Pages, Enterprise JavaBeans and the Java Coffee + Cup logo are trademarks or registered trademarks of Sun + Microsystems, Inc. in the U.S. and other countries. + + Federal Acquisitions: Commercial Software - Government Users + Subject to Standard License Terms and Conditions. + + + + + + + + + + + + + + + + + + + + + The taglib tag is the document root. + The definition of taglib is provided + by the tldTaglibType. + + + + + + + + The taglib element contains, among other things, tag and + tag-file elements. + The name subelements of these elements must each be unique. + + + + + + + + + + + + The taglib element contains function elements. + The name subelements of these elements must each be unique. + + + + + + + + + + + + + + + + +Specifies the type of body that is valid for a tag. + This value is used by the JSP container to validate + that a tag invocation has the correct body syntax and + by page composition tools to assist the page author + in providing a valid tag body. + + There are currently four values specified: + + tagdependentThe body of the tag is interpreted by the tag + implementation itself, and is most likely + in a different "language", e.g embedded SQL + statements. + + JSP The body of the tag contains nested JSP + syntax. + + empty The body must be empty + + scriptless The body accepts only template text, EL + Expressions, and JSP action elements. No + scripting elements are allowed. + + + + + + + + + + + + + + + + + + + + + The extensibleType is an abstract base type that is used to + define the type of extension-elements. Instance documents + must substitute a known type to define the extension by + using xsi:type attribute to define the actual type of + extension-elements. + + + + + + + + + + + + + The function element is used to provide information on each + function in the tag library that is to be exposed to the EL. + + The function element may have several subelements defining: + + description Optional tag-specific i
svn commit: r389540 - /tomcat/tc6.0.x/trunk/build.xml
Author: costin Date: Tue Mar 28 08:53:21 2006 New Revision: 389540 URL: http://svn.apache.org/viewcvs?rev=389540&view=rev Log: Small fixes and adjustments to build.xml. Modified: tomcat/tc6.0.x/trunk/build.xml Modified: tomcat/tc6.0.x/trunk/build.xml URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/build.xml?rev=389540&r1=389539&r2=389540&view=diff == --- tomcat/tc6.0.x/trunk/build.xml (original) +++ tomcat/tc6.0.x/trunk/build.xml Tue Mar 28 08:53:21 2006 @@ -31,6 +31,19 @@ + + + + + + + + + + + + @@ -61,7 +74,7 @@ - + + + - @@ -82,6 +96,11 @@ + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r389541 - in /tomcat/tc6.0.x/trunk: bin/ bin/Tomcat6.launch conf/ conf/server.xml conf/tomcat-users.xml conf/web.xml webapps/ROOT/ webapps/ROOT/WEB-INF/ webapps/ROOT/WEB-INF/web.xml webapp
Author: costin Date: Tue Mar 28 08:55:00 2006 New Revision: 389541 URL: http://svn.apache.org/viewcvs?rev=389541&view=rev Log: A minimal set of files to debug and launch tomcat inside eclipse. server.xml is based on server-minimal.jar I assume the 'real' config files will be in the /res or in some /share directory, so it should be possible to leave /conf for ide debugging. Added: tomcat/tc6.0.x/trunk/bin/ tomcat/tc6.0.x/trunk/bin/Tomcat6.launch tomcat/tc6.0.x/trunk/conf/ tomcat/tc6.0.x/trunk/conf/server.xml tomcat/tc6.0.x/trunk/conf/tomcat-users.xml tomcat/tc6.0.x/trunk/conf/web.xml tomcat/tc6.0.x/trunk/webapps/ROOT/ tomcat/tc6.0.x/trunk/webapps/ROOT/WEB-INF/ tomcat/tc6.0.x/trunk/webapps/ROOT/WEB-INF/web.xml tomcat/tc6.0.x/trunk/webapps/ROOT/index.html Added: tomcat/tc6.0.x/trunk/bin/Tomcat6.launch URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/bin/Tomcat6.launch?rev=389541&view=auto == --- tomcat/tc6.0.x/trunk/bin/Tomcat6.launch (added) +++ tomcat/tc6.0.x/trunk/bin/Tomcat6.launch Tue Mar 28 08:55:00 2006 @@ -0,0 +1,6 @@ + + + + + + Added: tomcat/tc6.0.x/trunk/conf/server.xml URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/conf/server.xml?rev=389541&view=auto == --- tomcat/tc6.0.x/trunk/conf/server.xml (added) +++ tomcat/tc6.0.x/trunk/conf/server.xml Tue Mar 28 08:55:00 2006 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + Added: tomcat/tc6.0.x/trunk/conf/tomcat-users.xml URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/conf/tomcat-users.xml?rev=389541&view=auto == --- tomcat/tc6.0.x/trunk/conf/tomcat-users.xml (added) +++ tomcat/tc6.0.x/trunk/conf/tomcat-users.xml Tue Mar 28 08:55:00 2006 @@ -0,0 +1,10 @@ + + + + Added: tomcat/tc6.0.x/trunk/conf/web.xml URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/conf/web.xml?rev=389541&view=auto == --- tomcat/tc6.0.x/trunk/conf/web.xml (added) +++ tomcat/tc6.0.x/trunk/conf/web.xml Tue Mar 28 08:55:00 2006 @@ -0,0 +1,1094 @@ + +http://java.sun.com/xml/ns/j2ee"; +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; +xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; +version="2.4"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +default + org.apache.catalina.servlets.DefaultServlet + +debug +0 + + +listings +false + +1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +jsp +org.apache.jasper.servlet.JspServlet + +fork +false + + +xpoweredBy +false + +3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +default +/ + + + + + + + +jsp +*.jsp + + + +jsp +*.jspx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +30 + + + + + + + + + + + +abs +audio/x-mpeg + + +ai +application/postscript + + +aif +audio/x-aiff + + +aifc +audio/x-aiff + + +aiff +audio/x-aiff + + +aim +application/x-aim + + +art +image/x-jg + + +asf +video/x-ms-asf + + +asx +video/x-ms-asf + + +au +audio/basic + + +avi +video/x-msvideo + + +
svn commit: r562187 - /tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java
Author: costin Date: Thu Aug 2 10:25:21 2007 New Revision: 562187 URL: http://svn.apache.org/viewvc?view=rev&rev=562187 Log: Add a simple one-line formatter. Added: tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java - copied, changed from r415842, tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java Copied: tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java (from r415842, tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java) URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java?view=diff&rev=562187&p1=tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java&r1=415842&p2=tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java&r2=562187 == --- tomcat/sandbox/java/org/apache/tomcat/util/log/JdkLoggerFormatter.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/juli/JdkLoggerFormatter.java Thu Aug 2 10:25:21 2007 @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.tomcat.util.log; +package org.apache.juli; import java.util.logging.Formatter; import java.util.logging.LogRecord; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r534293 [3/11] - in /tomcat/sandbox/tomcat-lite: ./ bin/ external/ java/ java/org/apache/commons/logging/ java/org/apache/tomcat/lite/ java/org/apache/tomcat/lite/ctxmap/ java/org/apache/t
2&r2=534293 == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLite.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLite.java Tue May 1 19:22:45 2007 @@ -2,16 +2,18 @@ */ package org.apache.tomcat.lite; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import javax.servlet.Filter; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; @@ -19,97 +21,32 @@ import javax.servlet.UnavailableException; import javax.servlet.http.HttpServletResponse; -import org.apache.coyote.Request; -import org.apache.coyote.Response; -import org.apache.tomcat.lite.ctxmap.WebappContextMapper; +import org.apache.tomcat.lite.http11.Http11Connection; import org.apache.tomcat.lite.util.MappingData; -import org.apache.tomcat.lite.webmap.WebappFilterMapper; -import org.apache.tomcat.lite.webmap.WebappServletMapper; import org.apache.tomcat.servlets.config.ServletData; -import org.apache.tomcat.servlets.config.WebAppData; -import org.apache.tomcat.util.loader.Repository; /** - * Frontend for a minimal servlet impl for Tomcat-Lite. + * Simpler, lower footprint serlvet engine. * - * Almost all 'Servlet Container' functionality is implemented using Servlets, - * Filters, Listeners. Most of them are general-purpose, not specific and - * not dependent on Tomcat-Lite. It is possible to replace any of them - * with application-specific ones, or to use some of the general ones on other - * containers. - * - * There are 2 special webapps: - * - __x_engine - defines the context mapper ( host + context path -> context), - * defaults to be used in webapps ( default servlet, session management, - * etc ). - * - * - __x_deploy - optional webapp. If it is missing - a tomcatLite.ser file - * is required, containing all the config info, including processed web.xml - * files. No new apps can be deployed, reload is not allowed. If present - - * it'll provide the above mentioned features. - * - * In addition: - * - any context starting with __x_ will be loaded first - * - context listeners for such apps will receive notifications for all - *contexts - * - in particular, __x_protocol_* webapp should contain the connectors. * - * For each 'module' ( connector, session manager, etc), the implementation - * will be a filter or servlet, defined in __x_engine, with regular init - * parameters in web.xml used to set up. Each webapp can override them - * by defining a servlet with the same name ( names start with __x_ as well ). - * - * - * This is based on catalina classes, with non-essential features removed. It is - * possible to add back some of the flexibility using callbacks/hooks - but this - * package should be a sufficient implementation for a working servlet - * container, with no extra features ( just hooks ). * * @author Costin Manolache */ public class TomcatLite { private static TomcatLite facade = new TomcatLite(); -public static class EngineData implements Serializable { -// Informations about hosts - aliases, etc -public ArrayList hosts = new ArrayList(); - -// informations about contexts. -public ArrayList contexts = new ArrayList(); -} - -public static class HostData implements Serializable { -/** Must be lowercase */ -public String hostName; -public ArrayList aliases = new ArrayList(); -} +Filter hostMapper; -/** Data about webapps configured in the system - */ -public static class ContextConfigData implements Serializable { -public ContextConfigData() {}; -public ContextConfigData(String basePath, String path) { -this.basePath = basePath; -this.path = path; -} -public String hostName; // must be a canonical name -public String basePath; // dir - canonical or absolute -String path; // path where it is mapped. ( for multiple - use mapper, - // it is not allowed by spec ) - -public WebAppData webXml; -} +// all contexts - hostMapper knows about hostnames and how they are mapped. +private ArrayList/**/ contexts = new ArrayList(); -EngineData data = new EngineData(); +//private Repository engineRepo; -WebappContextMapper hostMapper = new WebappContextMapper(); +URLClassLoader contextParent
svn commit: r534293 [11/11] - in /tomcat/sandbox/tomcat-lite: ./ bin/ external/ java/ java/org/apache/commons/logging/ java/org/apache/tomcat/lite/ java/org/apache/tomcat/lite/ctxmap/ java/org/apache/
Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/loader/Repository.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/loader/Repository.java?view=diff&rev=534293&r1=534292&r2=534293 == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/loader/Repository.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/loader/Repository.java Tue May 1 19:22:45 2007 @@ -14,314 +14,220 @@ * limitations under the License. */ - package org.apache.tomcat.util.loader; - import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.MalformedURLException; import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; import java.util.Enumeration; -import java.util.HashMap; import java.util.Hashtable; +import java.util.Iterator; import java.util.Map; import java.util.Vector; - /** - * A group of modules. - * - * Modules can have one or more jars and classes dirs, and are reloaded as a - * unit. Each module has an internal class loader. - * - * The module will delegate to the associated repository in addition to the - * normal delegation rules. The repository will search on all sibling modules. + * Class loader similar with the MLetClassLoader and JBoss - it maintains a list + * of 'modules' ( similar with mbeans - a single jar or dir ), each of them can + * be reloaded independently, without reloading the whole repository. * - * This mechanism is defined in the MLetClassLoader and is also used by JBoss - * and few other servers. - * - * Use: - * - create a Repository in all situations where you would need a separate - * class loader - each webapp, common/, server/, etc. - * - set the parent hierarchy - * - add modules to each repo - a module can be a single jar/classes, or - * multiple jars. I think single jar modules may be better. - * - get the classloader from repository + * This works well as long as the interface between modules don't change - it is + * a bit better than hot-reloading of classes, which requires each class method + * signatures to be unchanged. * * @author Costin Manolache */ public class Repository { - -private static final boolean DEBUG=System.getProperty("loader.debug.Repository") != null; - -// Allows the (experimental) use of jar indexes -// Right now ( for small set of jars, incomplete build ) it's a tiny 3.5 -> 3.4 sec dif. -private static final boolean USE_IDX=System.getProperty("loader.Repository.noIndex") == null; - -private Vector loaders=new Vector(); -private String name; -private Vector grpModules=new Vector(); -//private transient Loader loader; - -private transient RepositoryClassLoader groupClassLoader; -private Hashtable prefixes=new Hashtable(); -// For delegation -private ClassLoader parentClassLoader; -private Repository parent; +// Use jar indexes. Most loaders don't - it's a small optimization, +// but it's a good practice. +private static final boolean USE_IDX = true; +Vector loaders = new Vector(); -public Repository() { -} +private RepositoryClassLoader groupClassLoader; -public void addModule( Module mod ) { -mod.setRepository( this ); +private ClassLoader parent; -grpModules.addElement(mod); - -if( parentClassLoader != null ) -mod.setParentClassLoader( parentClassLoader ); +// From jar index: package -> Module or Module[] +private Hashtable prefixes = new Hashtable(); + +// Collects all jars without INDEX.LIST. +private ArrayList missingIndexList = new ArrayList(); -if(! mod.isStarted()) { -mod.start(); +/** + * Should this class loader delegate to the parent class loader + * before searching its own repositories (i.e. the usual + * Java2 delegation model)? + */ +private boolean delegate = true; + +public Repository() { +this(null, null, true); +} + +public Repository(URL[] cp, ClassLoader parent) { +this(cp, parent, true); +} + +public Repository(URL[] cp, ClassLoader parent, boolean delegate) { +if (parent == null) { +parent = Thread.currentThread().getContextClassLoader(); } - -try { -if( USE_IDX ) { -processJarIndex(mod); -// TODO: if we are in the initial starting, write cache only once -// TODO: write it only if there is a change in the timestamp -writeCacheIdx(); +this.parent = parent; +if (cp != null) { +for (int i = 0; i < cp.length; i++) {
svn commit: r407672 - /tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
Author: costin Date: Thu May 18 17:56:28 2006 New Revision: 407672 URL: http://svn.apache.org/viewvc?rev=407672&view=rev Log: Downgrade to DynamicMBeans in method signatures - there is no need to use Model here, the mbean server doesn't care. Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java?rev=407672&r1=407671&r2=407672&view=diff == --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java Thu May 18 17:56:28 2006 @@ -19,6 +19,7 @@ import java.util.Hashtable; +import javax.management.DynamicMBean; import javax.management.MBeanException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; @@ -139,7 +140,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(Connector connector) +static DynamicMBean createMBean(Connector connector) throws Exception { String mname = createManagedName(connector); @@ -151,7 +152,7 @@ String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); -ModelMBean mbean = managed.createMBean(connector); +DynamicMBean mbean = managed.createMBean(connector); ObjectName oname = createObjectName(domain, connector); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); @@ -170,7 +171,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(Context context) +static DynamicMBean createMBean(Context context) throws Exception { String mname = createManagedName(context); @@ -182,7 +183,7 @@ String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); -ModelMBean mbean = managed.createMBean(context); +DynamicMBean mbean = managed.createMBean(context); ObjectName oname = createObjectName(domain, context); if( mserver.isRegistered(oname)) { log.debug("Already registered " + oname); @@ -202,7 +203,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(ContextEnvironment environment) +static DynamicMBean createMBean(ContextEnvironment environment) throws Exception { String mname = createManagedName(environment); @@ -214,7 +215,7 @@ String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); -ModelMBean mbean = managed.createMBean(environment); +DynamicMBean mbean = managed.createMBean(environment); ObjectName oname = createObjectName(domain, environment); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); @@ -233,7 +234,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(ContextResource resource) +static DynamicMBean createMBean(ContextResource resource) throws Exception { String mname = createManagedName(resource); @@ -245,7 +246,7 @@ String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); -ModelMBean mbean = managed.createMBean(resource); +DynamicMBean mbean = managed.createMBean(resource); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); @@ -264,7 +265,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(ContextResourceLink resourceLink) +static DynamicMBean createMBean(ContextResourceLink resourceLink) throws Exception { String mname = createManagedName(resourceLink); @@ -276,7 +277,7 @@ String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); -ModelMBean mbean = managed.createMBean(resourceLink); +DynamicMBean mbean = managed.createMBean(resourceLink); ObjectName oname = createObjectName(domain, resourceLink); if( mserver.isRegistered( oname )) { mserver.unregisterMBean(oname); @@ -294,7 +295,7 @@ * * @exception Exception if an MBean cannot be created or registered */ -static ModelMBean createMBean(Engine engine) +static DynamicMBean createMBean
svn commit: r407673 - /tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ModJkMX.java
Author: costin Date: Thu May 18 17:57:15 2006 New Revision: 407673 URL: http://svn.apache.org/viewvc?rev=407673&view=rev Log: AFAIK mod_jk2 is deprecated - and I doubt anyone is using this. If they do - can be reverted. Removed: tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ModJkMX.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407674 - in /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote: tomcat3/ tomcat4/
Author: costin Date: Thu May 18 17:58:16 2006 New Revision: 407674 URL: http://svn.apache.org/viewvc?rev=407674&view=rev Log: Cleaning up the sandbox Removed: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/ tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407675 - /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/
Author: costin Date: Thu May 18 17:59:12 2006 New Revision: 407675 URL: http://svn.apache.org/viewvc?rev=407675&view=rev Log: Unused Removed: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407676 - /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/
Author: costin Date: Thu May 18 18:00:47 2006 New Revision: 407676 URL: http://svn.apache.org/viewvc?rev=407676&view=rev Log: Duplicates Removed: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionCode.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionHook.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Adapter.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Constants.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/InputBuffer.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/OutputBuffer.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Processor.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ProtocolHandler.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Request.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestGroupInfo.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestInfo.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Response.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407677 - in /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote: tomcat3/ tomcat4/
Author: costin Date: Thu May 18 18:24:04 2006 New Revision: 407677 URL: http://svn.apache.org/viewvc?rev=407677&view=rev Log: Rollback, bad eclipse ( or bad copy )... Added: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/ - copied from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/ tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/CoyoteInterceptor2.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/CoyoteInterceptor2.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Adapter.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Adapter.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Response.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Response.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/ - copied from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/ tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/Constants.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/Constants.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteAdapter.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteAdapter.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteInputStream.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteInputStream.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteOutputStream.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteOutputStream.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyotePrincipal.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyotePrincipal.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequestFacade.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequestFacade.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponse.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponse.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponseFacade.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponseFacade.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteServerSocketFactory.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteServerSocketFactory.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteWriter.java - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/CoyoteWriter.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings.properties - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings.properties tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_es.properties - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_es.properties tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_fr.properties - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_fr.properties tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_ja.properties - copied unchanged from r407673, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings_ja.properties tomcat/connectors/trunk/coyote
svn commit: r407678 - /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/
Author: costin Date: Thu May 18 18:25:12 2006 New Revision: 407678 URL: http://svn.apache.org/viewvc?rev=407678&view=rev Log: Rolling back Added: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionCode.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionCode.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionHook.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ActionHook.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Adapter.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Adapter.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Constants.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Constants.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/InputBuffer.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/InputBuffer.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/OutputBuffer.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/OutputBuffer.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Processor.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Processor.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ProtocolHandler.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/ProtocolHandler.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Request.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Request.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestGroupInfo.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestGroupInfo.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestInfo.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/RequestInfo.java tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Response.java - copied unchanged from r407675, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/Response.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407679 - in /tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory: ./ MemoryProtocolHandler.java
Author: costin Date: Thu May 18 18:26:17 2006 New Revision: 407679 URL: http://svn.apache.org/viewvc?rev=407679&view=rev Log: Rollback Added: tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/ - copied from r407674, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/ tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/MemoryProtocolHandler.java - copied unchanged from r407674, tomcat/connectors/trunk/coyote/src/java/org/apache/coyote/memory/MemoryProtocolHandler.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407715 [2/2] - in /tomcat/sandbox: ./ java/org/apache/coyote/adapters/ java/org/apache/coyote/http11/ java/org/apache/coyote/http11/apr/ java/org/apache/coyote/standalone/ java/org/apache
Added: tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java?rev=407715&view=auto == --- tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java (added) +++ tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java Thu May 18 22:18:18 2006 @@ -0,0 +1,480 @@ +/* + * Copyright 1999,2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.tomcat.util.loader; + + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + + +/** + * A group of modules and libraries. + * + * Modules can have one or more jars and class dirs. Classloaders are created + * from modules when the module is started are be disposed when the module is stopped. + * + * The module will delegate to the associated repository in addition to the + * normal delegation rules. The repository will search on all sibling modules. + * This mechanism is defined in the MLetClassLoader and is also used by JBoss and + * few other servers. + * + * TODO: explain more ( or point to the right jboss/mlet pages ) + * TODO: explain how this can be used for webapps to support better partitioning + * + * @author Costin Manolache + */ +public class Repository { + +private static final boolean DEBUG=Loader.getProperty("loader.debug.Repository") != null; + +// Allows the (experimental) use of jar indexes +// Right now ( for small set of jars, incomplete build ) it's a tiny 3.5 -> 3.4 sec dif. +private static final boolean USE_IDX=Loader.getProperty("loader.Repository.noIndex") == null; + +private Vector loaders=new Vector(); +private String name; +private Vector grpModules=new Vector(); +private transient Loader loader; + +private transient RepositoryClassLoader groupClassLoader; +private Hashtable prefixes=new Hashtable(); + +// For delegation +private ClassLoader parentClassLoader; +private Repository parent; + + +private Repository() { +} + +public Repository(Loader loader) { +if( loader== null ) throw new NullPointerException(); +this.loader=loader; +} + +public Loader getLoader() { +return loader; +} + +void addModule( Module mod ) { +mod.setRepository( this ); + +grpModules.addElement(mod); +if( loader.listener!=null ) { +loader.listener.moduleAdd(mod); +} + +if( parentClassLoader != null ) +mod.setParentClassLoader( parentClassLoader ); + +if(! mod.isStarted()) { +mod.start(); +//log("started " + mod); +} else { +//log("already started " + mod); +} + +try { +if( USE_IDX ) { +processJarIndex(mod); +// TODO: if we are in the initial starting, write cache only once +// TODO: write it only if there is a change in the timestamp +writeCacheIdx(); +} +} catch (Exception e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} + +} + +public void newModule( String path ) { +Module m=new Module(); +m.setPath( path ); +addModule( m ); +} + +public Enumeration getModules() { +return grpModules.elements(); +} + +/** Reload any module that is modified + */ +public void checkReload() { +try { +Enumeration mE=grpModules.elements(); +while( mE.hasMoreElements() ) { +Module m=(Module)mE.nextElement(); +boolean modif=m.modified(); +log("Modified " + m + " " + modif); + +if( modif ) { +m.stop(); +m.start(); +} +} +} catch( Throwable t ) { +t.printStackTrace(); +} +} + +/** Verify if any module is modified. This is a deep search, including dirs. + * Expensive o
svn commit: r407717 - in /tomcat/sandbox: Tomcat5.5.launch Tomcat6Sandbox.launch
Author: costin Date: Thu May 18 22:25:26 2006 New Revision: 407717 URL: http://svn.apache.org/viewvc?rev=407717&view=rev Log: Switched the launcher - will launch in tomcat6/build, with sandbox in classpath before tomcat6. Added: tomcat/sandbox/Tomcat6Sandbox.launch Removed: tomcat/sandbox/Tomcat5.5.launch Added: tomcat/sandbox/Tomcat6Sandbox.launch URL: http://svn.apache.org/viewvc/tomcat/sandbox/Tomcat6Sandbox.launch?rev=407717&view=auto == --- tomcat/sandbox/Tomcat6Sandbox.launch (added) +++ tomcat/sandbox/Tomcat6Sandbox.launch Thu May 18 22:25:26 2006 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r407937 - in /tomcat/sandbox/java/org/apache/tomcat/util/modeler: AttributeInfo.java BaseModelMBean.java ConstructorInfo.java FeatureInfo.java ManagedBean.java OperationInfo.java Parameter
Author: costin Date: Fri May 19 19:08:49 2006 New Revision: 407937 URL: http://svn.apache.org/viewvc?rev=407937&view=rev Log: More cleanup of unused stuff. Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java?rev=407937&r1=407936&r2=407937&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java Fri May 19 19:08:49 2006 @@ -28,58 +28,22 @@ * descriptor. * * @author Craig R. McClanahan - * @version $Revision: 155428 $ $Date: 2005-02-26 14:12:25 +0100 (sam., 26 févr. 2005) $ */ - public class AttributeInfo extends FeatureInfo implements Serializable { static final long serialVersionUID = -2511626862303972143L; // - Instance Variables - - -/** - * The ModelMBeanAttributeInfo object that corresponds - * to this AttributeInfo instance. - */ -protected transient MBeanAttributeInfo info = null; protected String displayName = null; + +// Information about the method to use protected String getMethod = null; protected String setMethod = null; - -//protected transient Method getMethodObj = null; -//protected transient Method setMethodObj = null; - protected boolean readable = true; protected boolean writeable = true; - protected boolean is = false; -protected String type = null; - -protected String persist; -protected String defaultStringValue; + // - Properties - -/** - * Override the description property setter. - * - * @param description The new description - */ -public void setDescription(String description) { -super.setDescription(description); -this.info = null; -} - -/** - * Override the name property setter. - * - * @param name The new name - */ -public void setName(String name) { -super.setName(name); -this.info = null; -} - /** * The display name of this attribute. */ @@ -102,7 +66,6 @@ public void setGetMethod(String getMethod) { this.getMethod = getMethod; -this.info = null; } /** @@ -114,7 +77,6 @@ public void setIs(boolean is) { this.is = is; -this.info = null; } @@ -127,7 +89,6 @@ public void setReadable(boolean readable) { this.readable = readable; -this.info = null; } @@ -142,23 +103,8 @@ public void setSetMethod(String setMethod) { this.setMethod = setMethod; -this.info = null; -} - - -/** - * The fully qualified Java class name of this attribute. - */ -public String getType() { -return (this.type); } -public void setType(String type) { -this.type = type; -this.info = null; -} - - /** * Is this attribute writeable by management applications? */ @@ -168,35 +114,8 @@ public void setWriteable(boolean writeable) { this.writeable = writeable; -this.info = null; -} - -/** Persistence policy. - * All persistent attributes should have this attribute set. - * Valid values: - * ??? - */ -public String getPersist() { -return persist; -} - -public void setPersist(String persist) { -this.persist = persist; -} - -/** Default value. If set, it can provide info to the user and - * it can be used by persistence mechanism to generate a more compact - * representation ( a value may not be saved if it's default ) - */ -public String getDefault() { -return defaultStringValue; -} - -public void setDefault(String defaultStringValue) { -this.defaultStringValue = defaultStringValue; } - // - Public Methods @@ -204,44 +123,14 @@ * Create and return a ModelMBeanAttributeInfo object that * corresponds to the attribute described by this instance. */ -publ
svn commit: r407938 - in /tomcat/sandbox/java/org/apache/coyote: adapters/FileAdapter.java adapters/MapperAdapter.java standalone/Main.java standalone/MainInetd.java
Author: costin Date: Fri May 19 19:09:31 2006 New Revision: 407938 URL: http://svn.apache.org/viewvc?rev=407938&view=rev Log: Few fixes - probably most of it can be removed, but until then it better work. Modified: tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java tomcat/sandbox/java/org/apache/coyote/standalone/Main.java tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java Modified: tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java?rev=407938&r1=407937&r2=407938&view=diff == --- tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java (original) +++ tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java Fri May 19 19:09:31 2006 @@ -10,7 +10,9 @@ import org.apache.coyote.Adapter; import org.apache.coyote.Request; import org.apache.coyote.Response; +import org.apache.coyote.standalone.MessageWriter; import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.buf.C2BConverter; /** * Serve a static file. This is the traditional method, a separate adapter could @@ -113,8 +115,10 @@ initContentTypes(); } static void initContentTypes() { +contentTypes.put("xhtml", "text/html"); contentTypes.put("html", "text/html"); contentTypes.put("txt", "text/plain"); +contentTypes.put("css", "text/css"); contentTypes.put("xul", "application/vnd.mozilla.xul+xml"); } Modified: tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java?rev=407938&r1=407937&r2=407938&view=diff == --- tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java (original) +++ tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java Fri May 19 19:09:31 2006 @@ -7,6 +7,7 @@ import org.apache.coyote.Response; import org.apache.coyote.standalone.MessageWriter; import org.apache.tomcat.util.http.mapper.Mapper; +import org.apache.tomcat.util.http.mapper.MappingData; /** * @@ -14,45 +15,32 @@ public class MapperAdapter implements Adapter { public Mapper mapper=new Mapper(); +private Adapter defaultAdapter; -// TODO: add extension mappings -// Key = prefix, one level only, value= class name of Adapter -// key starts with a / and has no other / ( /foo - but not /foo/bar ) -Hashtable prefixMap=new Hashtable(); - -String fileAdapterCN="org.apache.coyote.adapters.FileAdapter"; -Adapter defaultAdapter=new FileAdapter(); - public MapperAdapter() { +mapper = new Mapper(); +} + +public MapperAdapter(Mapper mapper2) { +mapper = mapper2; } public void service(Request req, final Response res) -throws Exception { -try { -String uri=req.requestURI().toString(); -if( uri.equals("/") ) uri="index.html"; -String ctx=""; -String local=uri; -if( uri.length() > 1 ) { -int idx=uri.indexOf('/', 1); -if( idx > 0 ) { -ctx=uri.substring(0, idx); -local=uri.substring( idx ); -} -} -Adapter h=(Adapter)prefixMap.get( ctx ); -if( h != null ) { +throws Exception { +try { +MappingData mapRes = new MappingData(); +mapper.map(req.remoteHost(), req.decodedURI(), mapRes); + +Adapter h=(Adapter)mapRes.wrapper; +if (h != null) { h.service( req, res ); -} else { -defaultAdapter.service( req, res ); } + } catch( Throwable t ) { t.printStackTrace(); } -//out.flushBuffer(); -//out.getByteChunk().flushBuffer(); - part of res.finish() -// final processing +// Final processing MessageWriter.getWriter(req, res, 0).flush(); res.finish(); @@ -62,14 +50,15 @@ } -public void addAdapter( String prefix, Adapter adapter ) { -prefixMap.put(prefix, adapter); +public void addAdapter( String path, Adapter adapter ) { +mapper.addWrapper(path, adapter); } public void setDefaultAdapter(Adapter adapter) { -defaultAdapter=adapter; +mapper.addWrapper("*", adapter); +defaultAdapter = adapter; } - + public
svn commit: r407939 [5/8] - in /tomcat/sandbox/java/org/apache/coyote/servlet: ./ util/
new File(basePath, path); + } else { +jarFile = new File(context.getWorkPath(), path); +} +if (jarFile.exists()) { +return jarFile.toURL(); +} else { +return null; +} +} else { + +// TODO(costin): File based resources !! + +//DirContext resources = context.getResources(); +//if (resources != null) { +//String fullPath = context.getName() + path; +//String hostName = context.getParent().getName(); +//try { +//resources.lookup(path); +//return new URL +//("jndi", "", 0, getJNDIUri(hostName, fullPath), +// new DirContextURLStreamHandler(resources)); +//} catch (Exception e) { +//// Ignore +//} +//} +} + +return (null); + +} + + +Host getParent() { +return host; +} + +void setParent(Host host) { +this.host = host; +} + +String getName() { +return null; +} + + +private String getWorkPath() { +return null; +} + + +/** + * Return the requested resource as an InputStream. The + * path must be specified according to the rules described under + * getResource. If no such resource can be identified, + * return null. + * + * @param path The path to the desired resource. + */ +public InputStream getResourceAsStream(String path) { + +path = normalize(path); +if (path == null) +return (null); + +// TODO(costin): file based resources +//DirContext resources = context.getResources(); +//if (resources != null) { +//try { +//Object resource = resources.lookup(path); +//if (resource instanceof Resource) +//return (((Resource) resource).streamContent()); +//} catch (Exception e) { +//} +//} +return (null); + +} + + +/** + * Return a Set containing the resource paths of resources member of the + * specified collection. Each path will be a String starting with + * a "/" character. The returned set is immutable. + * + * @param path Collection path + */ +public Set getResourcePaths(String path) { + +// Validate the path argument +if (path == null) { + return null; +} +if (!path.startsWith("/")) { +throw new IllegalArgumentException +(sm.getString("applicationContext.resourcePaths.iae", path)); +} + +path = normalize(path); +if (path == null) +return (null); + +// TODO(costin): file based resources +//DirContext resources = context.getResources(); +//if (resources != null) { +//return (getResourcePathsInternal(resources, path)); +//} +return (null); + +} + + +/** + * Internal implementation of getResourcesPath() logic. + * + * @param resources Directory context to search + * @param path Collection path + */ +//private Set getResourcePathsInternal(DirContext resources, String path) { +// +//HashSet set = new HashSet(); +//try { +//listCollectionPaths(set, resources, path); +//} catch (NamingException e) { +//return (null); +//} +////set.setLocked(true); +//return (set); +// +//} + + +/** + * Return the name and version of the servlet container. + */ +public String getServerInfo() { + +return "Apache Tomcat"; + +} + + +/** + * @deprecated As of Java Servlet API 2.1, with no direct replacement. + */ +public Servlet getServlet(String name) { + +return (null); + +} + + +/** + * Return the display name of this web application. + */ +public String getServletContextName() { + +return contextName ; + +} + + +/** + * @deprecated As of Java Servlet API 2.1, with no direct replacement. + */ +public Enumeration getServletNames() { +return (new Enumerator(empty)); +} + + +/** + * @deprecated As of Java Servlet API 2.1, with no direct replacement. + */ +public Enumeration getServlets() { +return (new Enumerator(empty)); +} + + +/** + * Writes the specified message to a servlet log file. + * + * @param message Message to be written + */ +public void log(String message) { + +context.getLogger().info(message); + +} + + +/** + * Writes the specified exception and message to a servlet log file. + * + * @param exception Exception to be reported + * @param message Message to be written +
svn commit: r407939 [3/8] - in /tomcat/sandbox/java/org/apache/coyote/servlet: ./ util/
Added: tomcat/sandbox/java/org/apache/coyote/servlet/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/coyote/servlet/LocalStrings.properties?rev=407939&view=auto == --- tomcat/sandbox/java/org/apache/coyote/servlet/LocalStrings.properties (added) +++ tomcat/sandbox/java/org/apache/coyote/servlet/LocalStrings.properties Fri May 19 19:12:51 2006 @@ -0,0 +1,187 @@ +applicationContext.attributeEvent=Exception thrown by attributes event listener +applicationContext.mapping.error=Error during mapping +applicationContext.requestDispatcher.iae=Path {0} does not start with a "/" character +applicationContext.resourcePaths.iae=Path {0} does not start with a "/" character +applicationContext.setAttribute.namenull=Name cannot be null +applicationDispatcher.allocateException=Allocate exception for servlet {0} +applicationDispatcher.deallocateException=Deallocate exception for servlet {0} +applicationDispatcher.forward.ise=Cannot forward after response has been committed +applicationDispatcher.forward.throw=Forwarded resource threw an exception +applicationDispatcher.include.throw=Included resource threw an exception +applicationDispatcher.isUnavailable=Servlet {0} is currently unavailable +applicationDispatcher.serviceException=Servlet.service() for servlet {0} threw exception +applicationRequest.badParent=Cannot locate parent Request implementation +applicationRequest.badRequest=Request is not a javax.servlet.ServletRequestWrapper +applicationResponse.badParent=Cannot locate parent Response implementation +applicationResponse.badResponse=Response is not a javax.servlet.ServletResponseWrapper +aprListener.aprInit=The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: {0} +aprListener.tcnInvalid=An incompatible version {0} of the Apache Tomcat Native library is installed, while Tomcat requires version {1} +aprListener.aprDestroy=Failed shutdown of Apache Portable Runtime +containerBase.addDefaultMapper=Exception configuring default mapper of class {0} +containerBase.alreadyStarted=Container {0} has already been started +containerBase.notConfigured=No basic Valve has been configured +containerBase.notStarted=Container {0} has not been started +containerBase.backgroundProcess.cluster=Exception processing cluster {0} background process +containerBase.backgroundProcess.loader=Exception processing loader {0} background process +containerBase.backgroundProcess.manager=Exception processing manager {0} background process +containerBase.backgroundProcess.realm=Exception processing realm {0} background process +containerBase.backgroundProcess.valve=Exception processing valve {0} background process +fastEngineMapper.alreadyStarted=FastEngineMapper {0} has already been started +fastEngineMapper.notStarted=FastEngineMapper {0} has not yet been started +filterChain.filter=Filter execution threw an exception +filterChain.servlet=Servlet execution threw an exception +httpContextMapper.container=This container is not a StandardContext +httpEngineMapper.container=This container is not a StandardEngine +httpHostMapper.container=This container is not a StandardHost +interceptorValve.alreadyStarted=InterceptorValve has already been started +interceptorValve.notStarted=InterceptorValve has not yet been started +naming.bindFailed=Failed to bind object: {0} +naming.jmxRegistrationFailed=Failed to register in JMX: {0} +naming.unbindFailed=Failed to unbind object: {0} +naming.invalidEnvEntryType=Environment entry {0} has an invalid type +naming.invalidEnvEntryValue=Environment entry {0} has an invalid value +naming.namingContextCreationFailed=Creation of the naming context failed: {0} +standardContext.invalidWrapperClass={0} is not a subclass of StandardWrapper +standardContext.alreadyStarted=Context has already been started +standardContext.applicationListener=Error configuring application listener of class {0} +standardContext.applicationSkipped=Skipped installing application listeners due to previous error(s) +standardContext.badRequest=Invalid request path ({0}). +standardContext.crlfinurl=The URL pattern "{0}" contains a CR or LF and so can never be matched. +standardContext.errorPage.error=Error page location {0} must start with a ''/'' +standardContext.errorPage.required=ErrorPage cannot be null +standardContext.errorPage.warning=WARNING: Error page location {0} must start with a ''/'' in Servlet 2.4 +standardContext.filterMap.either=Filter mapping must specify either a or a +standardContext.filterMap.name=Filter mapping specifies an unknown filter name {0} +standardContext.filterMap.pattern=Invalid {0} in filter mapping +standardContext.filterStart=Exception starting filter {0} +standardContext.filterStartFailed=Failed to start application Filters successfully +standardContext.requestListenerStartFailed=Failed to start
svn commit: r409040 - in /tomcat/sandbox/java/org/apache/coyote: adapters/ http11/ standalone/
Author: costin Date: Tue May 23 19:49:08 2006 New Revision: 409040 URL: http://svn.apache.org/viewvc?rev=409040&view=rev Log: Clean up. Refactoring apr/old processor didn't work out. Standalone coyote didn't work out either - the API is too low level, another experiment is in servlet. Removed: tomcat/sandbox/java/org/apache/coyote/adapters/FileAdapter.java tomcat/sandbox/java/org/apache/coyote/adapters/MapperAdapter.java tomcat/sandbox/java/org/apache/coyote/http11/Constants.java tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java tomcat/sandbox/java/org/apache/coyote/http11/InputFilter.java tomcat/sandbox/java/org/apache/coyote/http11/InternalInputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/OutputFilter.java tomcat/sandbox/java/org/apache/coyote/standalone/ClientAbortException.java tomcat/sandbox/java/org/apache/coyote/standalone/Main.java tomcat/sandbox/java/org/apache/coyote/standalone/MainInetd.java tomcat/sandbox/java/org/apache/coyote/standalone/MessageReader.java tomcat/sandbox/java/org/apache/coyote/standalone/MessageWriter.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r409041 - in /tomcat/sandbox/java/org/apache/tomcat/util/net: ./ javaio/ nio/ res/ simple/
Author: costin Date: Tue May 23 19:50:33 2006 New Revision: 409041 URL: http://svn.apache.org/viewvc?rev=409041&view=rev Log: Remove dead code - refactoring of the connector. Since having a common base is not likely - I'm using same approach as apr, i.e. separate connector, duplicate some code ( but this may allow better cleanup ) Added: tomcat/sandbox/java/org/apache/tomcat/util/net/simple/ tomcat/sandbox/java/org/apache/tomcat/util/net/simple/SimpleEndpoint.java - copied, changed from r408800, tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Removed: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnection.java tomcat/sandbox/java/org/apache/tomcat/util/net/TcpConnectionHandler.java tomcat/sandbox/java/org/apache/tomcat/util/net/URL.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/DefaultServerSocketFactory.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/LeaderFollowerEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/LeaderFollowerWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/MasterSlaveEndpoint.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/MasterSlaveWorkerThread.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/SSLImplementation.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/SSLSupport.java tomcat/sandbox/java/org/apache/tomcat/util/net/javaio/ServerSocketFactory.java tomcat/sandbox/java/org/apache/tomcat/util/net/res/LocalStrings.properties tomcat/sandbox/java/org/apache/tomcat/util/net/res/LocalStrings_es.properties tomcat/sandbox/java/org/apache/tomcat/util/net/res/LocalStrings_fr.properties tomcat/sandbox/java/org/apache/tomcat/util/net/res/LocalStrings_ja.properties Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java?rev=409041&r1=409040&r2=409041&view=diff == --- tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/net/nio/NioEndpoint.java Tue May 23 19:50:33 2006 @@ -22,16 +22,18 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.SocketAddress; +import java.nio.channels.Channel; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; +import java.nio.channels.spi.SelectorProvider; import java.util.Iterator; import java.util.Set; -import org.apache.tomcat.util.net.SimpleEndpoint; import org.apache.tomcat.util.net.TcpConnection; +import org.apache.tomcat.util.net.simple.SimpleEndpoint; import org.apache.tomcat.util.threads.ThreadPool; import org.apache.tomcat.util.threads.ThreadPoolRunnable; @@ -181,6 +183,25 @@ // nothing } +/** + */ +public ServerSocketChannel getInetdChannel() { +SelectorProvider sp=SelectorProvider.provider(); + +try { +Channel ch=sp.inheritedChannel(); +if(ch!=null ) { +System.err.println("Inherited: " + ch.getClass().getName()); +ServerSocketChannel ssc=(ServerSocketChannel)ch; +return ssc; +//proto.getEndpoint().setServerSocketFactory(new InetdServerSocketFactory(ssc.socket())); +} +} catch (IOException e) { +e.printStackTrace(); +} +return null; +} + public void addSocketRead(Socket s, Object o) throws IOException { s.getChannel().register( selector, SelectionKey.OP_READ, o); @@ -204,8 +225,8 @@ public Object[] getInitData() { // no synchronization overhead, but 2 array access Object obj[]=new Object[2]; -obj[1]= getConnectionHandler().init(); -obj[0]=new TcpConnection(); +obj[1]= null;//getConnectionHandler().init(); +obj[0]= null; // new TcpConnection(); return obj; } @@ -246,7 +267,7 @@ // TODO: customize this if needed tp.runIt( this ); // now process the socket. -processSocket(sockC.socket(), (TcpConnection) perThrData[0], +processSocket(sockC.socket(), (Object[]) perThrData[1]); continue; } Copied: tomcat/sandbox/