Re: svn commit: r667604 - /tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
William A. Rowe, Jr. wrote: Tim Funk wrote: Since there was never a release from trunk - there really isn't a change log. When trunk is released as a new branch it should have a RELEASE-NOTES which highlight why its a different branch but maintaining change log for an unreleased version doesn't make much sense to me. Hmmm - perhaps the simple fact that it's a code base is enough to warrant a change log against the last released flavor? Nearly all of the changes in trunk get ported to 6.0.x where the change log is kept up to date. I agree changes that aren't going to be ported should be documented (code clean-up, conversion to generics, etc should be summarised under a single entry). That really needs a diff between the two to make sure we capture everything. I just kicked such a diff off to see what it looks like. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r667815 - in /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11: ./ async/ async/AsyncHttpProcessor.java async/AsyncProtocolHandler.java async/BlockingCoyoteBuffers.jav
Author: costin Date: Sat Jun 14 08:30:48 2008 New Revision: 667815 URL: http://svn.apache.org/viewvc?rev=667815&view=rev Log: Server side. As with the client side, most is actually cut&pasted from the apr and nio connectors, and heavily refactored. Added: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncHttpProcessor.java (with props) tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncProtocolHandler.java (with props) tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/BlockingCoyoteBuffers.java (with props) Added: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncHttpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncHttpProcessor.java?rev=667815&view=auto == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncHttpProcessor.java (added) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/http11/async/AsyncHttpProcessor.java Sat Jun 14 08:30:48 2008 @@ -0,0 +1,840 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.async; + +import java.io.IOException; +import java.net.InetAddress; + +import org.apache.coyote.ActionCode; +import org.apache.coyote.ActionHook; +import org.apache.coyote.adapters.CoyoteServer; +import org.apache.coyote.client.AsyncHttp; +import org.apache.coyote.http11.Constants; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.buf.HexUtils; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.http.FastHttpDateFormat; +import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.tomcat.util.net.SelectorCallback; +import org.apache.tomcat.util.net.SelectorThread.SelectorData; + +/* + * Cut&pasted from nio and apr connectors, replacing the + * IO with the AsyncHttp model. + */ + +/** + * Handles a single http transaction, for Coyote connector. + * Created ( or get from pool ) when the request is received, + * released when service is done and body is sent/received. + * + * TODO: more on the async part - move mapping and more to the IO thread, + * right now it still require a dispatch to the thread pool + * + * @author Costin Manolache + */ +public class AsyncHttpProcessor extends AsyncHttp +implements ActionHook, Runnable { + +public static final byte[] ACK_BYTES = +ByteChunk.convertToBytes("HTTP/1.1 100 Continue\r\n\r\n"); + +static ByteChunk CLOSE = ByteChunk.fromString("close"); +static ByteChunk KEEPALIVE = ByteChunk.fromString("keep-alive"); +public static final String HTTP_11 = "HTTP/1.1"; +public static final String HTTP_10 = "HTTP/1.0"; +public static final String GET = "GET"; +public static final String POST = "POST"; + + +// Empty string to not send identification +String serverHeader = "ApacheTomcat"; +AsyncProtocolHandler simpleProtocolHandler; + +boolean http11 = false; +boolean http09 = false; +boolean error = false; +// don't return to keep alive. +boolean comet = false; +boolean cometClose = false; + +// TODO: use CharChunk +protected char[] hostNameC = new char[0]; +boolean ssl; +BlockingCoyoteBuffers blockingIO = new BlockingCoyoteBuffers(this); + +/** + * Implements blocking write and buffering of the response. + * Uses the 'output' ByteBuffer. + * + * Since the socket is non-blocking, there are few special things: + * - flush() and endRequest() will cause the callback to register for WRITE + * - write will keep sending data until the buffer is empty. + * - flush() will wait for the buffer to be empty, endRequest will not. + * - when the buffer is full, a flush() will be called + * - TODO: it should be possible to add to the buffer while data is + * written
svn commit: r667816 - /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/
Author: costin Date: Sat Jun 14 08:35:14 2008 New Revision: 667816 URL: http://svn.apache.org/viewvc?rev=667816&view=rev Log: Various coyote adapters, as example and for testing. Added: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ProxyAdapter.java (with props) Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ClientAbortException.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteMain.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteServer.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/EchoAdapter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/MapperAdapter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/MessageReader.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/MessageWriter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/SimpleFileAdapter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/SleepAdapter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/StaticAdapter.java Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ClientAbortException.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ClientAbortException.java?rev=667816&r1=667815&r2=667816&view=diff == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ClientAbortException.java (original) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/ClientAbortException.java Sat Jun 14 08:35:14 2008 @@ -1,9 +1,10 @@ /* - * 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 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 * @@ -13,8 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.coyote.adapters; import java.io.IOException; Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteMain.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteMain.java?rev=667816&r1=667815&r2=667816&view=diff == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteMain.java (original) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteMain.java Sat Jun 14 08:35:14 2008 @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.adapters; import org.apache.coyote.Adapter; Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteServer.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteServer.java?rev=667816&r1=667815&r2=667816&view=diff == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteServer.java (original) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteServer.java Sat Jun 14 08:35:14 2008 @@ -1,3 +1,18 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor licens
svn commit: r667817 - in /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net: SelectorCallback.java SelectorThread.java SelectorThreadNio.java
Author: costin Date: Sat Jun 14 08:36:49 2008 New Revision: 667817 URL: http://svn.apache.org/viewvc?rev=667817&view=rev Log: Selector abstraction, apr version not ready yet ( bugs - but seems a bit faster, so worth finishing ). Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorCallback.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThread.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThreadNio.java Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorCallback.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorCallback.java?rev=667817&r1=667816&r2=667817&view=diff == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorCallback.java (original) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorCallback.java Sat Jun 14 08:36:49 2008 @@ -18,6 +18,8 @@ import java.io.IOException; import java.nio.channels.Channel; +import org.apache.tomcat.util.net.SelectorThread.SelectorData; + /** * Notiy user code of events. All methods are called from the selector thread, * they should not block. The reason is to allow parsing and non-blocking @@ -30,16 +32,11 @@ * ( older version used long - but non-blocking connect needs a second param ) */ public class SelectorCallback { - protected SelectorThread.SelectorData selectorData = new SelectorThread.SelectorData(this); - - public SelectorThread getSelector() { -return selectorData.sel; - } /** * Called when the protocol is connected. */ - public void connected(SelectorThread selThread) + public void connected(SelectorData selThread) throws IOException { } @@ -47,27 +44,34 @@ * It is possible to write data. * For both read and write - re-enable interest if you want more data. */ - public void dataWriteable(SelectorThread selThread) throws IOException { + public void dataWriteable(SelectorData selThread) throws IOException { } /** * Data available for read. * For both read and write - re-enable interest if you want more data. */ - public void dataReceived(SelectorThread selThread) throws IOException { + public void dataReceived(SelectorData selThread) throws IOException { } /** * nextTimeEvent reached. */ - public void timeEvent(SelectorThread selThread) { + public void timeEvent(SelectorData selThread) { + } + + /** + * @throws IOException + * + */ + public void ioThreadRun(SelectorData selThread) throws IOException { } /** * Close was detected, or an unhandled exception happened while processing * this callback. */ - public void channelClosed(SelectorThread selThread, Throwable ex) { + public void channelClosed(SelectorData selThread, Throwable ex) { } /** @@ -79,7 +83,7 @@ * TODO: is there any case where something else besides registering read * interest on the new connection is needed ? Maybe it could read some data ? */ - public SelectorCallback connectionAccepted(SelectorThread selThread, + public SelectorCallback connectionAccepted(SelectorData selThread, Channel sockC) { return null; } Modified: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThread.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThread.java?rev=667817&r1=667816&r2=667817&view=diff == --- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThread.java (original) +++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorThread.java Sat Jun 14 08:36:49 2008 @@ -20,8 +20,6 @@ import java.nio.ByteBuffer; import java.nio.channels.Channel; -import org.apache.tomcat.util.buf.ByteChunk; - /** * Abstract NIO/APR to avoid some of the complexity and allow more code * sharing and experiments. @@ -44,17 +42,19 @@ /** * This is stored as the attachment in the selector. */ - static class SelectorData { -SelectorData(SelectorCallback selectorCallback) { - this.callback = selectorCallback; + public static class SelectorData { +public SelectorData(SelectorThread sel) { + this.sel = sel; } // APR long is wrapped in a ByteChannel as well - with few other longs. Channel channelData; - -SelectorThread sel; Object selKey; -SelectorCallback callback; + +public SelectorThread sel; +public SelectorCallback callback; + +SelectorCallback pendingCallback; // Current interest,
svn commit: r667818 - in /tomcat/sandbox/tomcat-lite/java/org/apache/tomcat: lite/ servlets/addon/ servlets/file/ servlets/jsp/ servlets/sec/ servlets/util/
Author: costin Date: Sat Jun 14 08:41:23 2008 New Revision: 667818 URL: http://svn.apache.org/viewvc?rev=667818&view=rev Log: Various bug fixes and cleanups. Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/RequestDispatcherImpl.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletResponseImpl.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLite.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/addon/AddonSupport.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/addon/UserTemplateClassMapper.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/file/Dir2Html.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/file/WebdavServlet.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/jsp/JspFileTemplateServlet.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/jsp/SimpleTemplateClassMapper.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/jsp/WildcardTemplateServlet.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/sec/DigestAuthServlet.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/util/Enumerator.java Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/RequestDispatcherImpl.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/RequestDispatcherImpl.java?rev=667818&r1=667817&r2=667818&view=diff == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/RequestDispatcherImpl.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/RequestDispatcherImpl.java Sat Jun 14 08:41:23 2008 @@ -1,9 +1,10 @@ /* - * 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 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 * @@ -13,8 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.tomcat.lite; import java.io.IOException; Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java?rev=667818&r1=667817&r2=667818&view=diff == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java Sat Jun 14 08:41:23 2008 @@ -1,9 +1,10 @@ /* - * 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 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 * @@ -13,8 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.tomcat.lite; @@ -58,6 +57,7 @@ import org.apache.tomcat.servlets.addon.ConfigurableContextListeners; import org.apache.tomcat.servlets.addon.ConfigurableServletContext; import org.apache.tomcat.servlets.addon.UserSessionManager; +import org.apache.tomcat.servlets.addon.UserTemplateClassMapper; import org.apache.tomcat.servlets.config.FilterData; import org.apache.tomcat.servlets.config.FilterMappingData; import org.apache.tomcat.servlets.config.ServletData; @@ -1193,6 +1193,19 @@ SERVLETS_PACKAGE + ".session.SessionManagerServlet"); } +String jspCompilerKey = AddonSupport.ADDON_PREFIX + +Us
svn commit: r667821 [2/2] - /tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/
Added: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/SimpleHttpClient.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/SimpleHttpClient.java?rev=667821&view=auto == --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/SimpleHttpClient.java (added) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/SimpleHttpClient.java Sat Jun 14 08:44:34 2008 @@ -0,0 +1,405 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.test; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.net.SocketException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; + + +public class SimpleHttpClient { +private static final String CRLF = "\r\n"; +private static final int LINE_FEED = 10; + +static int debug = 0; + +public static void dispatch(GTest client) throws Exception { +HashMap requestHeaders = client.requestHeaders; +String host = client.host; +int port = client.port; +String content = client.content; +String request = client.request; + +// XXX headers are ignored +Socket socket = new Socket( host, port ); + +//socket obtained, rebuild the request. +rebuildRequest(client, client.request, socket); + +InputStream in = new CRBufferedInputStream( socket.getInputStream() ); + +// Write the request +socket.setSoLinger( true, 1000 ); + +OutputStream out = new BufferedOutputStream( + socket.getOutputStream() ); +StringBuffer reqbuf = new StringBuffer( 128 ); + +// set the Host header +client.setHeaderDetails( "Host:" + host + ":" + port, requestHeaders, true ); + +// set the Content-Length header +if ( content != null ) { +client.setHeaderDetails( "Content-Length:" + content.length(), + requestHeaders, true ); +} + +// set the Cookie header +if ( client.testSession != null ) { +client.cookieController = ( CookieController ) client.sessionHash.get( client.testSession ); + +if ( client.cookieController != null ) { + +String releventCookieString = client.cookieController.applyRelevantCookies( client.requestURL ); + +if ( ( releventCookieString != null ) && ( !releventCookieString.trim().equals( "" ) ) ) { +client.setHeaderDetails( "Cookie:" + releventCookieString, requestHeaders, true ); +} +} +} + +if ( debug > 0 ) { +System.out.println( " REQUEST: " + request ); +} +reqbuf.append( client.request ).append( CRLF ); + +// append all request headers +if ( !requestHeaders.isEmpty() ) { +Iterator iter = requestHeaders.keySet().iterator(); + +while ( iter.hasNext() ) { +StringBuffer tmpBuf = new StringBuffer(32); +String headerKey = ( String ) iter.next(); +ArrayList values = (ArrayList) requestHeaders.get( headerKey ); +String[] value = (String[]) values.toArray( new String[ values.size() ] ); +tmpBuf.append( headerKey ).append(": "); +for ( int i = 0; i < value.length; i++ ) { +if ((i + 1) == value.length) { +tmpBuf.append( value[ i ] ); +} else { +tmpBuf.append( value[ i ] ).append(", "); +} +} +if ( debug > 0 ) { +System.out.println( " REQUEST HEADER: " + tmpBuf.toString()); +} +tmpBuf.append( CRLF ); +reqbuf.
svn commit: r667822 - in /tomcat/sandbox/tomcat-lite/test/org/apache/tomcat: lite/TomcatLiteNoConnectorTest.java lite/TomcatLiteTest.java proxy/ proxy/ProxyTest.java util/http/ util/http/Http11ParserT
Author: costin Date: Sat Jun 14 08:55:44 2008 New Revision: 667822 URL: http://svn.apache.org/viewvc?rev=667822&view=rev Log: More tests. Added: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/proxy/ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/proxy/ProxyTest.java (with props) tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/util/http/ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/util/http/Http11ParserTest.java (with props) Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteTest.java Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java?rev=667822&r1=667821&r2=667822&view=diff == --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java (original) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java Sat Jun 14 08:55:44 2008 @@ -1,4 +1,18 @@ /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.lite; @@ -17,7 +31,7 @@ public class TomcatLiteNoConnectorTest extends TestCase { - TomcatLite lite = TomcatLite.getServletImpl(); + TomcatLite lite = new TomcatLite(); ConfigurableServletContext ctx; Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteTest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteTest.java?rev=667822&r1=667821&r2=667822&view=diff == --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteTest.java (original) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteTest.java Sat Jun 14 08:55:44 2008 @@ -1,66 +1,70 @@ /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.lite; -import java.io.BufferedInputStream; import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + +import javax.servlet.ServletException; import junit.framework.TestCase; import org.apache.tomcat.servlets.addon.ConfigurableServletContext; +import org.apache.tomcat.test.CoyoteTestHelper; +import org.apache.tomcat.util.buf.ByteChunk; public class TomcatLiteTest extends TestCase { - TomcatLite lite = TomcatLite.getServletImpl(); + TomcatLite lite = new TomcatLite(); void initServer() throws Exception { -ConfigurableServletContext ctx = - (ConfigurableServletContext) lite.addServletContext(null, null, "/test1"); - -ctx.addServlet("test", new SimpleServlet()); -ctx.addMapping("/1stTest", "test"); - -// Ex: change the default +TomcatLiteTest.initServlets(lite); lite.setPort(8804); - -lite.init(); -lite.start(); - // At this point we can add contexts and inject requests, if we want to // do it over HTTP need to start the connector as well. lite.startConnector(); } - public void stopServer() { -lite.stop(); - } -
svn commit: r667823 - in /tomcat/sandbox/tomcat-lite/test/org/apache/coyote: ./ adapters/ adapters/StaticAdapterTest.java client/ client/HttpProcessorTest.java client/HttpProcessorThreadedTest.java
Author: costin Date: Sat Jun 14 08:56:43 2008 New Revision: 667823 URL: http://svn.apache.org/viewvc?rev=667823&view=rev Log: More tests Added: tomcat/sandbox/tomcat-lite/test/org/apache/coyote/ tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/ tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java (with props) tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/ tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorTest.java (with props) tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorThreadedTest.java (with props) Added: tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java?rev=667823&view=auto == --- tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java (added) +++ tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java Sat Jun 14 08:56:43 2008 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.adapters; + +import junit.framework.TestCase; + +import org.apache.tomcat.test.CoyoteTestHelper; + +public class StaticAdapterTest extends TestCase { + + public void testStaticAdapter() throws Exception { +CoyoteServer server = CoyoteTestHelper.getTestServer(8001); + +assertEquals("Hello world", +CoyoteTestHelper.getUrl("http://localhost:8001/hello";).toString()); +assertEquals("Hello world2", +CoyoteTestHelper.getUrl("http://localhost:8001/2nd";).toString()); + +server.stop(); + } + +} Propchange: tomcat/sandbox/tomcat-lite/test/org/apache/coyote/adapters/StaticAdapterTest.java -- svn:eol-style = native Added: tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorTest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorTest.java?rev=667823&view=auto == --- tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorTest.java (added) +++ tomcat/sandbox/tomcat-lite/test/org/apache/coyote/client/HttpProcessorTest.java Sat Jun 14 08:56:43 2008 @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.client; + + +import java.io.IOException; + +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.apache.coyote.adapters.CoyoteServer; +import org.apache.tomcat.test.CoyoteTestHelper; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.buf.MessageBytes; + +public class HttpProcessorTest extends TestCase { + CoyoteServer staticMain = CoyoteTestHelper.getTestServer(8802); + AsyncHttp acstate; + BlockingHttp cstate; + ByteChunk bodyRecvBuffer = new ByteChunk(1024); + int to = 1; + + public void setUp() { + acstate = AsyncHttpPool.getDefault().get(); // client); + cstate = acstate.getBlockingHttp(); + bodyRecvBuffer.recycle(); + } + + public void tearDown() throws Exception { + acstate.release(); // async + } + + /** + * Want to run the same tests few times. +
svn commit: r667824 - in /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache: coyote/ coyote/http11/filters/ juli/ tomcat/util/ tomcat/util/buf/ tomcat/util/modeler/
Author: costin Date: Sat Jun 14 09:01:09 2008 New Revision: 667824 URL: http://svn.apache.org/viewvc?rev=667824&view=rev Log: Small fixes, added a GzipInputFilter to match the output ( for client side ) Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/http11/filters/GzipInputFilter.java (with props) Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/JdkLoggerFormatter.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/IntrospectionUtils.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/Registry.java Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java?rev=667824&r1=667823&r2=667824&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java Sat Jun 14 09:01:09 2008 @@ -23,11 +23,10 @@ import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.buf.UDecoder; - -import org.apache.tomcat.util.http.MimeHeaders; -import org.apache.tomcat.util.http.Parameters; import org.apache.tomcat.util.http.ContentType; import org.apache.tomcat.util.http.Cookies; +import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.tomcat.util.http.Parameters; /** * This is a low-level, efficient representation of a server request. Most Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/http11/filters/GzipInputFilter.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/http11/filters/GzipInputFilter.java?rev=667824&view=auto == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/http11/filters/GzipInputFilter.java (added) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/http11/filters/GzipInputFilter.java Sat Jun 14 09:01:09 2008 @@ -0,0 +1,194 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.filters; + +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.GZIPInputStream; + +import org.apache.coyote.InputBuffer; +import org.apache.coyote.Request; +import org.apache.coyote.http11.InputFilter; +import org.apache.coyote.http11.OutputFilter; +import org.apache.tomcat.util.buf.ByteChunk; + +/** + * Gzip output filter. + * + * @author Remy Maucherat + */ +public class GzipInputFilter implements InputFilter { + + +// -- Constants + + +protected static final String ENCODING_NAME = "gzip"; +protected static final ByteChunk ENCODING = new ByteChunk(); + + +// - Static Initializer + + +static { +ENCODING.setBytes(ENCODING_NAME.getBytes(), 0, ENCODING_NAME.length()); +} + + +// - Instance Variables + + +/** + * Next buffer in the pipeline. + */ +protected InputBuffer buffer; + + +/** + * Compression output stream. + */ +protected GZIPInputStream compressionStream = null; + + +/** + * Fake internal output stream. + */ +protected InputStream fakeInputStream = new FakeInputStream(); + + +// --- OutputBuffer Methods + + +/** + * Write some bytes. + * + * @return number of bytes written by the filter + */ +public int doRead(ByteChunk chunk, Request req) +throws IOException { + if (compressionStream == null) { +compressionStream = new GZIPInputStream(fakeInput
svn commit: r667825 - in /tomcat/sandbox/tomcat-lite/webapps: ROOT/ ROOT/WEB-INF/ addons-jasper/ addons-jasper/WEB-INF/ addons-jasper/WEB-INF/src/ addons-jasper/WEB-INF/src/org/ addons-jasper/WEB-INF/
Author: costin Date: Sat Jun 14 09:04:49 2008 New Revision: 667825 URL: http://svn.apache.org/viewvc?rev=667825&view=rev Log: Jasper integration is still intended as an add-on webapp, but the new build file just bundles it, to make things easier. I may just move it to the main tree, too much trouble. The integration class is pretty cool I think - tomcat-lite doesn't have any dependency on jasper except the interface class, which can actually be used for any template language. The only downside is that you would do foo.non_jsp_template. Precompiled jsps don't need this class. Also, jsp recompilation not supported right now, and 6 JSP tests ( in watchdog ) fail Added: tomcat/sandbox/tomcat-lite/webapps/addons-jasper/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/jsp/ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/jsp/JasperCompilerTemplateClassMapper.java (with props) Modified: tomcat/sandbox/tomcat-lite/webapps/ROOT/WEB-INF/web.xml tomcat/sandbox/tomcat-lite/webapps/ROOT/index.html Modified: tomcat/sandbox/tomcat-lite/webapps/ROOT/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/webapps/ROOT/WEB-INF/web.xml?rev=667825&r1=667824&r2=667825&view=diff == --- tomcat/sandbox/tomcat-lite/webapps/ROOT/WEB-INF/web.xml (original) +++ tomcat/sandbox/tomcat-lite/webapps/ROOT/WEB-INF/web.xml Sat Jun 14 09:04:49 2008 @@ -7,7 +7,6 @@ _tc_usersorg.apache.tomcat.servlets.sec.DigestAuthenticator u.testpass - jspCompiler/_jspc dav/dav/* Modified: tomcat/sandbox/tomcat-lite/webapps/ROOT/index.html URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/webapps/ROOT/index.html?rev=667825&r1=667824&r2=667825&view=diff == --- tomcat/sandbox/tomcat-lite/webapps/ROOT/index.html (original) +++ tomcat/sandbox/tomcat-lite/webapps/ROOT/index.html Sat Jun 14 09:04:49 2008 @@ -1,46 +1,4 @@ Tomcat-Lite -TODO -Internal attributes - -- - -Internal Webapps - -Webapps with names starting with __x_ will be treated in special ways. -The benefit of using webapps instead of special directories and layout is -that you can use the same tools to configure and deploy as with regular -webapps. -They are loaded first, and have additional properties: - -__x_classpath* - it's WEB-INF/classes, lib will be added to the container -classpath. -In particular - you may want to place a copy of jasper.jar to -enable jsp compilation, without it tomcat-lite only supports precompiled jsps -This replaces the old tomcat server/lib, common/lib, etc. Tomcat-lite supports -only a simple classloader hierarchy ( arbitrary restriction - it would be easy - to add more with a simple module, but for now we care more about - single-jar than lots of apps with conflicting libraries ). - -__x_protocol* - the connectors. A load-on-startup servlet will start -accepting http connections. The code is dependent on tomcat-lite internals, but -can be configured and deployed using regular webapp tools. - -__x_deploy - internal tools to control deploy, reload and configuration. If it -is missing, reloading is disabled and web.xml is frozen - all configs are loaded -from tomcatLite.ser. In a production server or tiny server you don't need -web.xml parsing, reload and most of the deploy functions ( if you use lb -or are ok with a complete server restart ). - -__x_engine - engine specific servlets/filters - controls the dispatching, -servlet manager, security settings, etc. All the configuration in tomcat-lite -is done using web.xml and servlets/filters - this replaces most of -the conf/ settings in tomcat. - - - -Internal servlets - -- \ No newline at end of file Added: tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/jsp/JasperCompilerTemplateClassMapper.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/jsp/JasperCompilerTemplateClassMapper.java?rev=667825&view=auto == --- tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servlets/jsp/JasperCompilerTemplateClassMapper.java (added) +++ tomcat/sandbox/tomcat-lite/webapps/addons-jasper/WEB-INF/src/org/apache/tomcat/servl
svn commit: r667826 - /tomcat/sandbox/tomcat-lite/build.xml
Author: costin Date: Sat Jun 14 09:06:06 2008 New Revision: 667826 URL: http://svn.apache.org/viewvc?rev=667826&view=rev Log: Changed the build file, 2 self-running jars are generated, one bundling jasper and one with only precompiled-jsp support. Modified: tomcat/sandbox/tomcat-lite/build.xml Modified: tomcat/sandbox/tomcat-lite/build.xml URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/build.xml?rev=667826&r1=667825&r2=667826&view=diff == --- tomcat/sandbox/tomcat-lite/build.xml (original) +++ tomcat/sandbox/tomcat-lite/build.xml Sat Jun 14 09:06:06 2008 @@ -20,7 +20,7 @@ - + @@ -71,6 +71,7 @@ + @@ -115,7 +116,6 @@ deprecation="false" debug="false" > - @@ -142,8 +142,8 @@ includeJavaRuntime="false" deprecation="false" debug="false" > - - + + @@ -158,7 +158,6 @@ - @@ -182,30 +181,23 @@ - + - + - - - - - - - - - - + + + - +
svn commit: r667828 - /tomcat/sandbox/tomcat-lite/.classpath
Author: costin Date: Sat Jun 14 09:06:46 2008 New Revision: 667828 URL: http://svn.apache.org/viewvc?rev=667828&view=rev Log: Eclipse update Modified: tomcat/sandbox/tomcat-lite/.classpath Modified: tomcat/sandbox/tomcat-lite/.classpath URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/.classpath?rev=667828&r1=667827&r2=667828&view=diff == --- tomcat/sandbox/tomcat-lite/.classpath (original) +++ tomcat/sandbox/tomcat-lite/.classpath Sat Jun 14 09:06:46 2008 @@ -1,13 +1,20 @@ - + - + + + - + + + + + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]