DO NOT REPLY [Bug 45710] FormAuthenticator - Request Parameters are lost after authentication
https://issues.apache.org/bugzilla/show_bug.cgi?id=45710 Mark Thomas <[EMAIL PROTECTED]> changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID --- Comment #1 from Mark Thomas <[EMAIL PROTECTED]> 2008-08-29 03:26:45 PST --- There isn't enough information here, particularly on how the controller is coded, to reproduce this. This looks like an application issue at the moment and therefore this should be explored further on the users list. I would suggest using ieHttpHeaders or LiveHttpHeaders to confirm exactly what the client is sending. This should enable you to construct a much simpler test case. If the discussion on the users list IDs a Tomcat bug, please feel free to reopen this issue and attach the details. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45709] Incorrect configuration in default catalina.policy
https://issues.apache.org/bugzilla/show_bug.cgi?id=45709 Mark Thomas <[EMAIL PROTECTED]> changed: What|Removed |Added Status|NEW |RESOLVED Resolution||DUPLICATE --- Comment #1 from Mark Thomas <[EMAIL PROTECTED]> 2008-08-29 04:01:19 PST --- The first issue has already been fixed. The second isn't going to be fixed. Work is in hand to handle the errors more gracefully. In a security conscious environment, the examples should not be installed so I don't see the need to add explicit permissions for this web app. *** This bug has been marked as a duplicate of bug 45293 *** -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45293] catalina.policy prevents tomcat 5.5.26 from start
https://issues.apache.org/bugzilla/show_bug.cgi?id=45293 Mark Thomas <[EMAIL PROTECTED]> changed: What|Removed |Added CC||[EMAIL PROTECTED] --- Comment #4 from Mark Thomas <[EMAIL PROTECTED]> 2008-08-29 04:01:19 PST --- *** Bug 45709 has been marked as a duplicate of this bug. *** -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
An extra LF in md5 files for 5.5.27 candidate (Ant 1.7 vs. 1.6.5)
Hi! I noticed that the *.md5 files in the candidate binaries for 5.5.27 release, and also the ones in released 6.0.18, have an extra line feed (CR-LF in 5.5.27, LF in 6.0.18) between the checksum and the file name. IIRC, for the 5.5.26 release it was corrected by hand http://marc.info/?l=tomcat-dev&m=120179627509101&w=2 I tried to find the cause of it, and the following is what I've found: 1. The md5 files are generated by task in build.xml in TC 5.5 and dist.xml in TC 6. The generation is performed by task followed by task that appends the file name to the contents of the md5 file. 2. The change is caused by the difference between Ant 1.7.0 and its previous version, 1.6.5. Implementation of the checksum task was changed, and now prints a line feed after the checksum. 3. Possible ways to fix it: a) If compatibility with 1.6.5 is required, one may capture the checksum value into a property, and print it in the task. b) If going forward with 1.7+, the checksum task since 1.7.0 does support pattern and format attributes. E.g., format="MD5SUM" will do the job. Is Ant 1.6.5 compatibility required for Tomcat project? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45709] Incorrect configuration in default catalina.policy
https://issues.apache.org/bugzilla/show_bug.cgi?id=45709 --- Comment #2 from William Tranmer <[EMAIL PROTECTED]> 2008-08-29 07:59:46 PST --- Thanks -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45714] New: response.sendError does not send back message properly
https://issues.apache.org/bugzilla/show_bug.cgi?id=45714 Summary: response.sendError does not send back message properly Product: Tomcat 6 Version: 6.0.18 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] In Tomcat 6.0.16 if you do the following: response.sendError(500, "This is my error message") The statusText read by the browser will be "This is my error message" and the status will be 500. Something has changed in Tomcat 6.0.18 where the statusText will be the literal string translation of the error code (the status will still be 500). I.E. the statusText will read "Internal Server Error" instead of "This is my error message". This occurs for all error code types and is browser independent. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45714] response.sendError does not send back message properly
https://issues.apache.org/bugzilla/show_bug.cgi?id=45714 Mark Thomas <[EMAIL PROTECTED]> changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID --- Comment #1 from Mark Thomas <[EMAIL PROTECTED]> 2008-08-29 13:29:05 PST --- This is as a result of the fix for CVE-2008-1232. See http://tomcat.apache.org/security-6.html for the details. To configure the behavior, see http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html specifcially org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER If you do change this setting you *must* make sure only ISO-8859-1 text is used in the error message. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45661] NioBlockingSelector uses all CPU after a socket connection is killed
https://issues.apache.org/bugzilla/show_bug.cgi?id=45661 Filip Hanik <[EMAIL PROTECTED]> changed: What|Removed |Added AssignedTo|[EMAIL PROTECTED] |tomcat- ||[EMAIL PROTECTED] --- Comment #4 from Filip Hanik <[EMAIL PROTECTED]> 2008-08-29 17:45:20 PST --- I tried to JDK versions on Win XP 32bit. sun java version "1.5.0_10" sun java version "1.6.0_07" And I wasn't able to reproduce the problem at all. I tried both connections that were inside of a request, and connections not sent any data yet(registered for an operation) and in either case I don't get any CPU usage best Filip -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 45661] NioBlockingSelector uses all CPU after a socket connection is killed
https://issues.apache.org/bugzilla/show_bug.cgi?id=45661 Filip Hanik <[EMAIL PROTECTED]> changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WORKSFORME -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat-Lite - part 1
Hi, About 2 years ago (closer to 3) I started a sandbox experiment with the goal of refactoring tomcat to a smaller and easier to embed variant. I think it's time to see what can be contributed back to tomcat main branch, what can be released, and what needs to be retired or moved out. The code is organized in several relatively independent components, some of them low-risk, some controversial - I will start a separate thread with a proposal to merge back the first component, then decide what to do with the others based on the feedback I get here. 1. General tomcat-util and coyote improvements. This should be the easy part I hope - sandbox/tomcat-lite/tomcat-coyote contains the code, just small additions to make it easier to code with coyote. The only 'major' and backward-incompatible change is in RequestInfo, replacing ObjectName with Object, it requires 2 casts in nio/apr ( JMX is not available on some embedded platforms ). There are few additions - Appendable, CharSequence in CharChunk/ByteChunk, few small fixes, etc. There is also a new ObjectManager that can be used to abstract JMX and/or better integrate with frameworks ( osgi, guice, other dep-injection ). 2. Examples and extensions for coyote for 'standalone' use. As we know, coyote implements the HTTP protocol, catalina implements the servlet spec. There are cases where you may just want a small http server embedded in your app ( but not full servlets), or maybe you want to load-test/optimize coyote itself. There are several Adapters - including a conversion of the dav servlet (default servlet) from tomcat, mapping, startup code, examples. I don't know if we want to support 'standalone coyote' - but having the adapters in the main branch ( marked as example/unsupported ) shouldn't hurt anyone, and may help people working on coyote. It works quite well as a server on very small devices ( like a storage server or phone, with jamvm or on the android emulator ) 3. A new connector and http client This will probably be controversial :-), but there are no deps between the rest of tomcat-lite and the new connector - all works just fine with the apr/nio connectors. It is not intended as a replacement, but as a low-end ( or high-end) alternative. The reasons I wrote it: - wanted to see if the apr/nio code could be merged ( lots is duplicated ). I think SelectorThread is a good abstraction and can hide the details of apr/nio. - was quite unhappy with http client - wanted a non-blocking http client, and simpler. - nio/apr connectors were a bit too big for embedded - I wanted to write a fast proxy servlet - but comet didn't support enough non-blocking behavior (detached operation, both input and output blocking). And of course - the http client for proxy needed to be non-blocking. See the ProxyAdapter as example. Again, I don't think adding it to the main branch would hurt ( not enabling it by default, marking it as 'in progress', etc) - but I can move it to sourceforge or leave it in sandbox until it's more appealing. It is missing SSL ( I'm working on it ) and many of the config flags ( easy to add back ). The code is actually based on the existing connectors - I started with the code in apr connector, then abstracting all that was apr or nio specific in SelectorThread ( SelectorThreadApr is not submitted, but at some point worked and shouldn't be hard to fix), then refactored http parsing code to be fully non-blocking ( nio has this I think ), and added support for client-mode as well. The client should be faster and simpler than apache http-client, and currently uses coyote APIs ( Request, etc ) - it is quite convenient if you want to just proxy a request to a different server. Of course, it is quite tomcat-specific, but if there is interest it should be used without a server. 4. Few filters and servlet code that can be used with any server - and some tomcat-independent interfaces to better integrate them Refactored from Catalina Valves - the idea was that Filters can be used instead of Valves and be more generic ( Valves were developed before or at same time with Filter standardization ). The benefit is that code could be reused in other engines - like next point, tomcat-lite :-) The filters provide same services as the original valves - but with no deps on catalina. This can be used if for example you want to have the same auth code on different servlet engines. I'll send more explanations when I get to this - IMO it would be great for the servlet world if tomcat moves away from Valves for some extensions, when they can be done with filters ( and very light additional container interfaces that could be ported easily to other engines ) 5. Tomcat-lite - the servlet engine impl Again, this started with catalina code, I replaced Valves with Filters, removed most of the layers ( listeners, etc ) and kept only the core code. Another major change is removal of all 'sandbox' support - 10 years ago sandbox was important, today we have vir
svn commit: r690452 - in /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache: coyote/ juli/ tomcat/util/buf/ tomcat/util/http/ tomcat/util/modeler/
Author: costin Date: Fri Aug 29 21:17:45 2008 New Revision: 690452 URL: http://svn.apache.org/viewvc?rev=690452&view=rev Log: Merged from main branch. Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/FileHandler.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/B2CConverter.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/ByteChunk.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/CharChunk.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/buf/MessageBytes.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeHeaders.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/ServerCookie.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/ManagedBean.java Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java?rev=690452&r1=690451&r2=690452&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/ActionCode.java Fri Aug 29 21:17:45 2008 @@ -151,7 +151,16 @@ */ public static final ActionCode ACTION_AVAILABLE = new ActionCode(23); +/** + * Callback for an asynchronous close of the Comet event + */ +public static final ActionCode ACTION_COMET_CLOSE = new ActionCode(24); +/** + * Callback for setting the timeout asynchronously + */ +public static final ActionCode ACTION_COMET_SETTIMEOUT = new ActionCode(25); + // --- Constructors int code; Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java?rev=690452&r1=690451&r2=690452&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Constants.java Fri Aug 29 21:17:45 2008 @@ -60,5 +60,12 @@ (System.getSecurityManager() != null); +/** + * If true, custom HTTP status messages will be used in headers. + */ +public static final boolean USE_CUSTOM_STATUS_MSG_IN_HEADER = +Boolean.valueOf(System.getProperty( +"org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER", +"false")).booleanValue(); } Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java?rev=690452&r1=690451&r2=690452&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/coyote/Request.java Fri Aug 29 21:17:45 2008 @@ -23,10 +23,11 @@ import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.buf.UDecoder; -import org.apache.tomcat.util.http.ContentType; -import org.apache.tomcat.util.http.Cookies; + import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.http.Parameters; +import org.apache.tomcat.util.http.ContentType; +import org.apache.tomcat.util.http.Cookies; /** * This is a low-level, efficient representation of a server request. Most Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java?rev=690452&r1=690451&r2=690452&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/juli/ClassLoaderLogManager.java Fri Aug 29 21:17:45 2008 @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URLClassLoader; +import java.security.AccessControlException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collections; @@ -134,9 +1
svn commit: r690453 - /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java
Author: costin Date: Fri Aug 29 21:18:52 2008 New Revision: 690453 URL: http://svn.apache.org/viewvc?rev=690453&view=rev Log: Copy of Mapper, with File instead of JNDI. Ideally Mapper should extend this and override few methods - will do this if the file is accepted to the main branch. ( JNDI is not available on some platforms - android for example ) Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java (with props) Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java?rev=690453&view=auto == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java (added) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/mapper/SimpleMapper.java Fri Aug 29 21:18:52 2008 @@ -0,0 +1,1391 @@ +/* + * 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.util.http.mapper; + + +import org.apache.tomcat.util.buf.CharChunk; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.buf.Ascii; + +import java.io.File; +import java.util.List; +import java.util.ArrayList; + +/** + * Mapper, which implements the servlet API mapping rules (which are derived + * from the HTTP rules). + * + * This class doesn't use JNDI. + * + * @author Remy Maucherat + */ +public final class SimpleMapper { + + +private static org.apache.juli.logging.Log logger = +org.apache.juli.logging.LogFactory.getLog(SimpleMapper.class); +// - Instance Variables + + +/** + * Array containing the virtual hosts definitions. + */ +protected Host[] hosts = new Host[0]; + + +/** + * Default host name. + */ +protected String defaultHostName = null; + +/** + * Context associated with this wrapper, used for wrapper mapping. + */ +protected Context context = new Context(); + + +// - Public Methods + + +/** + * Get default host. + * + * @return Default host name + */ +public String getDefaultHostName() { +return defaultHostName; +} + + +/** + * Set default host. + * + * @param defaultHostName Default host name + */ +public void setDefaultHostName(String defaultHostName) { +this.defaultHostName = defaultHostName; +} + +/** + * Add a new host to the mapper. + * + * @param name Virtual host name + * @param host Host object + */ +public synchronized void addHost(String name, String[] aliases, + Object host) { +Host[] newHosts = new Host[hosts.length + 1]; +Host newHost = new Host(); +ContextList contextList = new ContextList(); +newHost.name = name; +newHost.contextList = contextList; +newHost.object = host; +if (insertMap(hosts, newHosts, newHost)) { +hosts = newHosts; +} +for (int i = 0; i < aliases.length; i++) { +newHosts = new Host[hosts.length + 1]; +newHost = new Host(); +newHost.name = aliases[i]; +newHost.contextList = contextList; +newHost.object = host; +if (insertMap(hosts, newHosts, newHost)) { +hosts = newHosts; +} +} +} + + +/** + * Remove a host from the mapper. + * + * @param name Virtual host name + */ +public synchronized void removeHost(String name) { +// Find and remove the old host +int pos = find(hosts, name); +if (pos < 0) { +return; +} +Object host = hosts[pos].object; +Host[] newHosts = new Host[hosts.length - 1]; +if (removeMap(hosts, newHosts, name)) { +hosts = newHosts; +} +// Remove all aliases (they will map to the same host object) +for (int i
svn commit: r690454 - in /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util: ObjectManager.java modeler/JmxObjectManager.java
Author: costin Date: Fri Aug 29 21:20:14 2008 New Revision: 690454 URL: http://svn.apache.org/viewvc?rev=690454&view=rev Log: Abstract JMX out, allow other frameworks to be plugged in. This is pretty early, will need to be reviewed/improved, but it gets the job done. ( JMX may not be available or needed for some embedded apps ) Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java (with props) tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/JmxObjectManager.java (with props) Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java?rev=690454&view=auto == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java (added) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java Fri Aug 29 21:20:14 2008 @@ -0,0 +1,67 @@ +/* + */ +package org.apache.tomcat.util; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tomcat is using JMX heavily - but other apps embedding tomcat may have + * different preferences. + * + * This class removes the dependency on JMX - and allows other kinds of + * frameworks ( like dependency injection - guice, etc ) to configure + * different tomcat objects. + * + * Note that unlike the old Registry, which was only used for monitoring, this + * interface also allows configuration and injection, and may use other + * methods to get what should be monitored/set ( besides bean properties ). + * + * InstanceManager was considered - but the interface is pretty confusing and + * wrong package ( and didn't fit very well ). It should be possible to + * adapt it. It is possible to use the InstanceManager as one of the providers. + * Sprint, Guice, JNDI, web.xml, CLI are other possible providers. + * + * @author Costin Manolache + */ +public class ObjectManager { + +List managers = +new ArrayList(); + +static ObjectManager singleton = new ObjectManager(); + +/** + * Ok, singletons can be bad - but it's so much easier, and this just + * calls other managers. + */ +public static ObjectManager get() { +return singleton; +} + +public void registerManager(ObjectManagerProvider om) { +managers.add(om); +} + + +public void registerObject(Object o, String name, String type) { +for (ObjectManagerProvider p : managers) { +p.registerObject(o, name, type); +} +} + +public void unregisterObject(Object o) { +for (ObjectManagerProvider p : managers) { +p.unregisterObject(o); +} +} + +public static interface ObjectManagerProvider { +public Object registerObject(Object o, String name, + String category); + +public void unregisterObject(Object o); +} + + +} Propchange: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/ObjectManager.java -- svn:eol-style = native Added: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/JmxObjectManager.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/JmxObjectManager.java?rev=690454&view=auto == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/JmxObjectManager.java (added) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/JmxObjectManager.java Fri Aug 29 21:20:14 2008 @@ -0,0 +1,41 @@ +/* + */ +package org.apache.tomcat.util.modeler; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +import org.apache.tomcat.util.ObjectManager; +import org.apache.tomcat.util.ObjectManager.ObjectManagerProvider; + +public class JmxObjectManager implements ObjectManagerProvider { +Registry registry; +Logger log = Logger.getLogger("JmxObjectManager"); + +public JmxObjectManager() { +registry = Registry.getRegistry(); +ObjectManager.get().registerManager(this); +} + +Map reverseMap = new HashMap(); + +public Object registerObject(Object o, String name, String category) { +try { +registry.registerComponent(o, ":name=" + name, category); +reverseMap.put(o, name); +} catch (Exception e) { +log.severe("Error registering" + e); +} +return o; +} + +// TODO: should we unregister by name ? +// InstanceManager is by instance - name is more registry/jndi centric, +// with object it would be easier
svn commit: r690455 - /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java
Author: costin Date: Fri Aug 29 21:21:10 2008 New Revision: 690455 URL: http://svn.apache.org/viewvc?rev=690455&view=rev Log: Getter with the same name as in servlet api, to make it easier to convert servlets to adapters Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java?rev=690455&r1=690454&r2=690455&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/http/MimeMap.java Fri Aug 29 21:21:10 2008 @@ -36,6 +36,7 @@ new Hashtable(101); static { defaultMap.put("txt", "text/plain"); +defaultMap.put("css", "text/css"); defaultMap.put("html","text/html"); defaultMap.put("htm", "text/html"); defaultMap.put("gif", "image/gif"); @@ -144,6 +145,10 @@ return map.keys(); } +public String getMimeType(String ext) { +return getContentTypeFor(ext); +} + public String getContentType(String extn) { String type = (String)map.get(extn.toLowerCase()); if( type == null ) type=(String)defaultMap.get( extn ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r690456 - in /tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util: DomUtil.java modeler/modules/MbeansSource.java
Author: costin Date: Fri Aug 29 21:23:04 2008 New Revision: 690456 URL: http://svn.apache.org/viewvc?rev=690456&view=rev Log: The xslt was only used there - no need to have a dep on it in. Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/DomUtil.java tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansSource.java Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/DomUtil.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/DomUtil.java?rev=690456&r1=690455&r2=690456&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/DomUtil.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/DomUtil.java Fri Aug 29 21:23:04 2008 @@ -18,18 +18,11 @@ import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -258,13 +251,4 @@ return doc; } -public static void writeXml( Node n, OutputStream os ) -throws TransformerException -{ -TransformerFactory tf=TransformerFactory.newInstance(); -//identity -Transformer t=tf.newTransformer(); -t.setOutputProperty(OutputKeys.INDENT, "yes"); -t.transform(new DOMSource( n ), new StreamResult( os )); -} } Modified: tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansSource.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansSource.java?rev=690456&r1=690455&r2=690456&view=diff == --- tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansSource.java (original) +++ tomcat/sandbox/tomcat-lite/tomcat-coyote/org/apache/tomcat/util/modeler/modules/MbeansSource.java Fri Aug 29 21:23:04 2008 @@ -19,6 +19,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; +import java.io.OutputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; @@ -28,7 +29,12 @@ import javax.management.MBeanServer; import javax.management.ObjectName; import javax.management.loading.MLet; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -308,7 +314,7 @@ lastUpdate=time; try { FileOutputStream fos=new FileOutputStream(location); -DomUtil.writeXml(document, fos); +writeXml(document, fos); } catch (TransformerException e) { log.error( "Error writing"); } catch (FileNotFoundException e) { @@ -316,6 +322,17 @@ } } } + +public static void writeXml( Node n, OutputStream os ) +throws TransformerException +{ +TransformerFactory tf=TransformerFactory.newInstance(); +//identity +Transformer t=tf.newTransformer(); +t.setOutputProperty(OutputKeys.INDENT, "yes"); +t.transform(new DOMSource( n ), new StreamResult( os )); +} + private void processAttribute(MBeanServer server, Node descN, String objectName ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r690457 - in /tomcat/sandbox/tomcat-lite/java/org/apache/tomcat: lite/ servlets/config/ util/buf/res/ util/threads/res/
Author: costin Date: Fri Aug 29 21:24:45 2008 New Revision: 690457 URL: http://svn.apache.org/viewvc?rev=690457&view=rev Log: Remove unused files ( they are in the other dir ), small fixes Removed: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/buf/res/LocalStrings.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/threads/res/LocalStrings.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/threads/res/LocalStrings_es.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletContextImpl.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/config/WebXml.java 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=690457&r1=690456&r2=690457&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 Fri Aug 29 21:24:45 2008 @@ -66,6 +66,7 @@ import org.apache.tomcat.servlets.util.Enumerator; import org.apache.tomcat.servlets.util.RequestUtil; import org.apache.tomcat.servlets.util.UrlUtils; +import org.apache.tomcat.util.http.MimeMap; import org.apache.tomcat.util.res.StringManager; @@ -110,18 +111,7 @@ StringManager.getManager("org.apache.tomcat.lite"); -static Properties contentTypes=new Properties(); -static { -initContentTypes(); -} -// TODO: proper implementation -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"); -} +MimeMap contentTypes = new MimeMap(); /** * The context attributes for this context. @@ -275,7 +265,7 @@ } public void addMimeType(String ext, String type) { -contentTypes.put(ext, type); +contentTypes.addContentType(ext, type); } public WebappServletMapper getMapper() { @@ -410,15 +400,7 @@ * @param file Filename for which to identify a MIME type */ public String getMimeType(String file) { -if (file == null) -return (null); -int period = file.lastIndexOf("."); -if (period < 0) -return (null); -String extension = file.substring(period + 1); -if (extension.length() < 1) -return (null); -return contentTypes.getProperty(extension); +return contentTypes.getMimeType(file); } /** Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java?rev=690457&r1=690456&r2=690457&view=diff == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/TomcatLiteMain.java Fri Aug 29 21:24:45 2008 @@ -16,6 +16,13 @@ */ package org.apache.tomcat.lite; +import java.io.IOException; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.tomcat.servlets.addon.ConfigurableServletContext; import org.apache.tomcat.util.IntrospectionUtils; /** @@ -43,7 +50,7 @@ // TODO: integrate this with JMX IntrospectionUtils.processArgs(lite, args); IntrospectionUtils.processArgs(lite.coyote, args); - + lite.init(); lite.start(); lite.startConnector(); Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/config/WebXml.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/config/WebXml.java?rev=690457&r1=690456&r2=690457&view=diff == --- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/servlets/config/WebXml.java (original) +++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/s
svn commit: r690459 - in /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache: coyote/adapters/ coyote/client/ tomcat/util/http/
Author: costin Date: Fri Aug 29 21:28:23 2008 New Revision: 690459 URL: http://svn.apache.org/viewvc?rev=690459&view=rev Log: Removed jmx where not needed, added few files to make it easier to port default servlet Added: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/adapters/CoyoteUtils.java (with props) tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/http/HttpStatus.java (with props) Modified: 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/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/ProxyAdapter.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/client/AsyncHttp.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/client/BlockingHttp.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/coyote/client/SocketPool.java tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/http/Http11Parser.java 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=690459&r1=690458&r2=690459&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 Fri Aug 29 21:28:23 2008 @@ -39,6 +39,13 @@ // --- Main - public static void main( String args[]) throws Exception { +try { +Class c = Class.forName("org.apache.tomcat.util.modeler.JmxObjectManager"); +c.newInstance(); +} catch (Throwable t) { +System.err.println("JMX not available"); +} + CoyoteMain sa=new CoyoteMain(); IntrospectionUtils.processArgs(sa, args); IntrospectionUtils.processArgs(fileAdapter, args); 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=690459&r1=690458&r2=690459&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 Fri Aug 29 21:28:23 2008 @@ -16,15 +16,13 @@ package org.apache.coyote.adapters; import java.io.IOException; -import java.lang.management.ManagementFactory; import org.apache.coyote.Adapter; import org.apache.coyote.ProtocolHandler; -import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.async.AsyncProtocolHandler; import org.apache.juli.JdkLoggerConfig; +import org.apache.tomcat.util.ObjectManager; import org.apache.tomcat.util.buf.BufferInfo; -import org.apache.tomcat.util.modeler.Registry; /** @@ -47,9 +45,7 @@ protected ProtocolHandler proto; - protected Registry registry; - - protected Adapter adapter; + protected Adapter adapter = new MapperAdapter(); protected int maxThreads = 20; boolean started = false; boolean async = false; // use old nio connector @@ -78,20 +74,12 @@ * @param adapter */ public void addAdapter(String path, Adapter added) { -if (adapter == null && "/".equals(path)) { - adapter = added; -} else { - if (!(adapter instanceof MapperAdapter)) { -Adapter oldDefault = adapter; -adapter = new MapperAdapter(); -((MapperAdapter) adapter).setDefaultAdapter(oldDefault); - } if ("/".equals(path)) { -((MapperAdapter) adapter).setDefaultAdapter(added); + ((MapperAdapter) adapter).setDefaultAdapter(added); } else { -((MapperAdapter) adapter).getMapper().addWrapper(path, added); + ((MapperAdapter) adapter).getMapper().addWrapper(path, added); } -} + ObjectManager.get().registerObject(adapter, path, "Adapter"); } /** @@ -109,12 +97,10 @@ daemon = b; } - public void setAsync(boolean b) { - async = b; - } - public void init() { JdkLoggerConfig.loadCustom(); +ObjectManager.get().registerObject(this, "CoyoteServer-" + port, +"CoyoteServer"); } protected void initAdapters() { @@ -146,36 +132,
svn commit: r690460 - in /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net: SelectorCallback.java SelectorThread.java SelectorThreadNio.java
Author: costin Date: Fri Aug 29 21:33:15 2008 New Revision: 690460 URL: http://svn.apache.org/viewvc?rev=690460&view=rev Log: Initial support for plugging in ssl 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=690460&r1=690459&r2=690460&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 Fri Aug 29 21:33:15 2008 @@ -31,12 +31,13 @@ * seems cleaner and it's nice to be able to use APR more portably. * ( older version used long - but non-blocking connect needs a second param ) */ -public class SelectorCallback { +public class SelectorCallback implements SelectorThread.IOThreadRunnable, +SelectorThread.DataEvents { /** * Called when the protocol is connected. */ - public void connected(SelectorData selThread) + public void connected(SelectorData sdata) throws IOException { } @@ -44,34 +45,34 @@ * It is possible to write data. * For both read and write - re-enable interest if you want more data. */ - public void dataWriteable(SelectorData selThread) throws IOException { + public void dataWriteable(SelectorData sdata) throws IOException { } /** * Data available for read. * For both read and write - re-enable interest if you want more data. */ - public void dataReceived(SelectorData selThread) throws IOException { + public void dataReceived(SelectorData sdata) throws IOException { } /** * nextTimeEvent reached. */ - public void timeEvent(SelectorData selThread) { + public void timeEvent(SelectorData sdata) { } /** * @throws IOException * */ - public void ioThreadRun(SelectorData selThread) throws IOException { + public void ioThreadRun(SelectorData sdata) throws IOException { } /** * Close was detected, or an unhandled exception happened while processing * this callback. */ - public void channelClosed(SelectorData selThread, Throwable ex) { + public void channelClosed(SelectorData sdata, Throwable ex) { } /** @@ -83,7 +84,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(SelectorData selThread, + public SelectorCallback connectionAccepted(SelectorData sdata, 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=690460&r1=690459&r2=690460&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 Fri Aug 29 21:33:15 2008 @@ -74,7 +74,11 @@ int lastReadResult; int zeroReads = 0; int lastWriteResult; + +public SelectorFilter ssl; +public int suspended = 0; + public String toString() { StringBuffer sb = new StringBuffer(); sb.append("SelData: ") @@ -85,6 +89,47 @@ return sb.toString(); } } + + public static interface IOThreadRunnable { + public void ioThreadRun(SelectorData selThread) throws IOException; + } + + public static interface DataEvents { + /** + * Called by selector thread when it can write data. + * SSL may consume sending data for negotiation. + * @throws IOException + */ + public void dataWriteable(SelectorData sdata) throws IOException; + + public void dataReceived(SelectorData sdata) throws IOException; + } + + public static interface DataChannel { + public int writeNonBlocking(SelectorThread st, SelectorData sdata, + ByteBuffer bb) throws IOException; + + public int readNonBlocking(SelectorThread st, SelectorData sdata, + ByteBuffer bb) throws IOException; + + } + + /** + * Used for non-blocking SSL, gzip, etc + */ + public s
svn commit: r690462 - /tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java
Author: costin Date: Fri Aug 29 21:49:49 2008 New Revision: 690462 URL: http://svn.apache.org/viewvc?rev=690462&view=rev Log: Set the nio connector explicitely. Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java?rev=690462&r1=690461&r2=690462&view=diff == --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java (original) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/test/CoyoteTestHelper.java Fri Aug 29 21:49:49 2008 @@ -39,6 +39,7 @@ import org.apache.coyote.client.AsyncHttp; import org.apache.coyote.client.AsyncHttpPool; import org.apache.coyote.client.BlockingHttp; +import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.async.AsyncProtocolHandler; import org.apache.juli.JdkLoggerConfig; import org.apache.tomcat.lite.TomcatLite; @@ -167,10 +168,13 @@ CoyoteServer server) { server.setPort(port); server.setDaemon(daemon); - if (testWithNewConnector) { - server.setAsyncConnector(); - } else { - server.setNioConnector(); + if (!testWithNewConnector) { + Http11NioProtocol proto = new Http11NioProtocol(); + proto.setCompression("on"); + proto.setCompressionMinSize(32); + proto.setPort(port); + proto.getEndpoint().setDaemon(daemon); + server.setConnector(proto); } } @@ -221,8 +225,6 @@ File f = new File(path + "/build/webapps"); CoyoteServer server = new CoyoteServer(); - server.setPort(8080); - server.setDaemon(true); TomcatLite servlets = new TomcatLite(server); servlets.init("webapps/ROOT", "/"); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat-Lite - part 1
> Hi, > > About 2 years ago (closer to 3) I started a sandbox experiment with the goal > of refactoring tomcat to a smaller > and easier to embed variant. I think it's time to see what can be > contributed back to tomcat main branch, what can be > released, and what needs to be retired or moved out. > > The code is organized in several relatively independent components, some of > them low-risk, some controversial - > I will start a separate thread with a proposal to merge back the first > component, then decide what to do with the > others based on the feedback I get here. > > > 1. General tomcat-util and coyote improvements. > > This should be the easy part I hope - sandbox/tomcat-lite/tomcat-coyote > contains the code, just small additions to make it easier to code with > coyote. The only 'major' and backward-incompatible change is in RequestInfo, > replacing ObjectName with Object, it requires 2 casts in nio/apr ( JMX is > not available on some embedded platforms ). > There are few additions - Appendable, CharSequence in CharChunk/ByteChunk, > few small fixes, etc. There is also a new ObjectManager > that can be used to abstract JMX and/or better integrate with frameworks ( > osgi, guice, other dep-injection ). > > 2. Examples and extensions for coyote for 'standalone' use. > > As we know, coyote implements the HTTP protocol, catalina implements the > servlet spec. There are cases where you may > just want a small http server embedded in your app ( but not full servlets), > or maybe you want to load-test/optimize coyote itself. > There are several Adapters - including a conversion of the dav servlet > (default servlet) from tomcat, mapping, startup code, examples. > > I don't know if we want to support 'standalone coyote' - but having the > adapters in the main branch ( marked as > example/unsupported ) shouldn't hurt anyone, and may help people working on > coyote. It works quite well as a server on > very small devices ( like a storage server or phone, with jamvm or on the > android emulator ) > > > 3. A new connector and http client > > This will probably be controversial :-), but there are no deps between the > rest of tomcat-lite and the new connector - all works > just fine with the apr/nio connectors. It is not intended as a replacement, > but as a low-end ( or high-end) alternative. > > The reasons I wrote it: > - wanted to see if the apr/nio code could be merged ( lots is duplicated ). > I think SelectorThread is a good abstraction and can hide the > details of apr/nio. > - was quite unhappy with http client - wanted a non-blocking http client, > and simpler. > - nio/apr connectors were a bit too big for embedded > - I wanted to write a fast proxy servlet - but comet didn't support enough > non-blocking behavior (detached operation, both > input and output blocking). And of course - the http client for proxy needed > to be non-blocking. See the ProxyAdapter as example. > > Again, I don't think adding it to the main branch would hurt ( not enabling > it by default, marking it as 'in progress', etc) - but > I can move it to sourceforge or leave it in sandbox until it's more > appealing. It is missing SSL ( I'm working on it ) and many > of the config flags ( easy to add back ). > > The code is actually based on the existing connectors - I started with the > code in apr connector, then abstracting all that was > apr or nio specific in SelectorThread ( SelectorThreadApr is not submitted, > but at some point worked and shouldn't be hard to fix), > then refactored http parsing code to be fully non-blocking ( nio has this I > think ), and added support for client-mode as well. > > The client should be faster and simpler than apache http-client, and > currently uses coyote APIs ( Request, etc ) - it is > quite convenient if you want to just proxy a request to a different server. > Of course, it is quite tomcat-specific, but if there is > interest it should be used without a server. > > 4. Few filters and servlet code that can be used with any server - and some > tomcat-independent interfaces to better integrate them > > Refactored from Catalina Valves - the idea was that Filters can be used > instead of Valves and be more generic ( > Valves were developed before or at same time with Filter standardization ). > The benefit is that code could be reused > in other engines - like next point, tomcat-lite :-) > The filters provide same services as the original valves - but with no deps > on catalina. > > This can be used if for example you want to have the same auth code on > different servlet engines. I'll send more > explanations when I get to this - IMO it would be great for the servlet > world if tomcat moves away from Valves for > some extensions, when they can be done with filters ( and very light > additional container > interfaces that could be ported easily to other engines ) > > 5. Tomcat-lite - the servlet engine impl > > Again, this started with catalina code, I replaced Valves with Filters,
Re: Tomcat-Lite - part 1
>> If you read this far - I don't want to start a flame war, but I appreciate >> all feedback :-). My current goal is to >> 'graduate' the first 2 components, the others can stay longer in sandbox or >> be moved out - but since they rely on >> the first 2 I would have to clone a lot of tomcat code. I think 4 would also >> be nice for tomcat, allowing people >> to extend tomcat by using easier interfaces ( and have the extensions easily >> ported ). I don't mind too much if 3 and 5 >> are not accepted at this point, I'll move them out or try again later :-) >> >> I think moving forward, for tomcat-7 and beyond - it would be worth >> reconsidering some of the 10-year-old decisions, and >> tomcat-lite can be a good example on how things can be done differently: >> - Valves/LifecycleListeners versus plain Filters and listeners >> - configuration and better integration with frameworks ( >> JMX/dep-injection/etc) >> - sanbox support >> - layers and complexity >From my own experience (during the 10 years), the servlet engine was the main piece in Web applications for many years. Now it's only a small part of the architecture and it often needed to be embedded in a larger part. Now the container should be small, embeddedable and modular, to fit this new 'requirements' (not necessary the whole Servlet/JSP specs). That's why I feel that tomcat light could be the foundation for this future. Congrats again Costin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]