Author: markt Date: Sat Oct 22 21:30:59 2011 New Revision: 1187812 URL: http://svn.apache.org/viewvc?rev=1187812&view=rev Log: Trailing whitespace removal from /modules/tomcat-lite
Modified: tomcat/trunk/modules/tomcat-lite/build.xml tomcat/trunk/modules/tomcat-lite/ivy.xml tomcat/trunk/modules/tomcat-lite/java/org/apache/coyote/lite/LiteProtocolHandler.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/BaseMapper.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/CompressFilter.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ContentType.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/DefaultHttpConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Dispatcher.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Http11Connection.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpClient.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnectionPool.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpMessage.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpRequest.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpResponse.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpServer.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/HttpWriter.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/MappingData.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/MultiMap.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ServerCookie.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/SpdyConnection.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/BBucket.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/BBuffer.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/BufferedIOReader.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/CBucket.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/CBuffer.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/DumpChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/FastHttpDateFormat.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/FileConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/FileConnectorJavaIo.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/FutureCallbacks.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/Hex.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOBuffer.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOInputStream.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOOutputStream.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOReader.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/IOWriter.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/MemoryIOConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/NioChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/NioThread.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/SocketConnector.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/SocketIOChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/SslProvider.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/UrlEncoding.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/WrappedException.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/JsseSslProvider.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/SslChannel.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/CopyCallback.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/HttpProxyService.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/ProxyFlushedCallback.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/SocksServer.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/StaticContentService.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/IOStatus.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/LogConfig.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/FastHttpDateFormat.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/LocaleParser.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/MimeMap.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/Range.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/URLEncoder.java tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/UrlUtils.java tomcat/trunk/modules/tomcat-lite/pom.xml tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/ServletTests.java tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/Tomcat.java tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/TomcatLiteCoyoteTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/TomcatStandaloneMain.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/TestMain.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/ClientTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/CompressFilterTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/DispatcherTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelInMemoryTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpChannelTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/HttpsTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/LiveHttp1Test.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/MultiMapTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/SpdyTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/services/EchoCallback.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/http/services/SleepCallback.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/BBufferTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/CBufferTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/OneTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/SocksTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/UEncoderTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttp5Test.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttpThreadedTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/MicroTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/ThreadRunner.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/LiveProxyHttp1Test.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/ProxyTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/SmallProxyTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/util/UEncoderTest.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/AntProperties.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/CookieController.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/DynamicObject.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/HttpCookie.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/RfcDateParser.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogClient.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogHttpClient.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestCase.java tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestImpl.java Modified: tomcat/trunk/modules/tomcat-lite/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/build.xml?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/build.xml (original) +++ tomcat/trunk/modules/tomcat-lite/build.xml Sat Oct 22 21:30:59 2011 @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<project name="Tomcat Lite" default="tomcat-lite.jar" +<project name="Tomcat Lite" default="tomcat-lite.jar" xmlns:ivy="antlib:org.apache.ivy.ant" basedir="."> @@ -19,7 +19,7 @@ <property name="MAIN" value="org.apache.tomcat.integration.simple.Main"/> <property name="compile.source" value="1.6"/> <property name="compile.debug" value="true"/> - + <!-- All Ivy downloads --> <path id='lite-classpath'> <fileset dir='target/lib' includes="*.jar" /> @@ -28,14 +28,14 @@ <path id='head-classpath'> <pathelement location="${tomcat.build}/../classes" /> <pathelement location="target/lib/asm.jar" /> - <pathelement location="target/lib/asm-tree.jar" /> + <pathelement location="target/lib/asm-tree.jar" /> <pathelement location="target/lib/junit.jar"/> <pathelement location="target/lib/commons-codec.jar"/> </path> <target name="http" depends="http.compile,http.test,http.pack"/> - - <target name="http.compile" + + <target name="http.compile" description="Compile only the HTTP connector classes, no servlets"> <mkdir dir="${classes}"/> <javac destdir="${classes}" @@ -51,12 +51,12 @@ <exclude name="org/apache/tomcat/lite/servlet/**"/> </javac> <copy todir="${classes}"> - <fileset dir="${tomcat.lite.src}/java" + <fileset dir="${tomcat.lite.src}/java" includes="**/*.properties **/*.xml" /> </copy> </target> - - <target name="http.test.compile" + + <target name="http.test.compile" description="Test only the HTTP connector classes, no servlets"> <mkdir dir="${http.test-classes}"/> <javac destdir="${http.test-classes}" @@ -75,11 +75,11 @@ <exclude name="org/apache/tomcat/test/watchdog/**"/> </javac> <copy todir="${http.test-classes}"> - <fileset dir="${tomcat.lite.src}/test" + <fileset dir="${tomcat.lite.src}/test" includes="**/*.properties **/*.xml **/*.bin **/*.keystore **/*.cert **/*.der" /> </copy> </target> - + <target name="http.test" depends="http.test.compile" > <!-- also: perTest(default) --> <junit printsummary="on" fork="once" @@ -107,9 +107,9 @@ <exclude name="org/apache/tomcat/test/watchdog/**"/> </fileset> </batchtest> - </junit> + </junit> </target> - + <target name="runtest" depends="http.test.compile"> <junit printsummary="withOutAndErr" fork="no" dir="${tomcat.base}"> <sysproperty key="tests" value="${tests}"/> @@ -125,15 +125,15 @@ <include name="**/${test}.java" /> </fileset> </batchtest> - </junit> - + </junit> + </target> - - <target name="http.pack" + + <target name="http.pack" description="Pack the HTTP client and connector"> </target> - - <target name="compile" + + <target name="compile" description="Build all classes against tomcat head."> <mkdir dir="${classes}"/> <javac destdir="${classes}" @@ -148,12 +148,12 @@ <exclude name="**/ServletApi25.java"/> </javac> <copy todir="${classes}"> - <fileset dir="${tomcat.lite.src}/java" + <fileset dir="${tomcat.lite.src}/java" includes="**/*.properties **/*.xml" /> </copy> </target> - - <target name="compile25" + + <target name="compile25" description="Build against 2.5 servlet API, similar with the maven"> <mkdir dir="${classes}" /> <javac destdir="${classes}" @@ -168,7 +168,7 @@ <exclude name="org/apache/tomcat/coyote/servlet/*.java"/> </javac> <copy todir="${classes}"> - <fileset dir="${tomcat.lite.src}/java" + <fileset dir="${tomcat.lite.src}/java" includes="**/*.properties **/*.xml" /> </copy> </target> @@ -190,11 +190,11 @@ <src path="${tomcat.lite.src}/test" /> </javac> <copy todir="${test-classes}"> - <fileset dir="${tomcat.lite.src}/test" + <fileset dir="${tomcat.lite.src}/test" includes="**/*.properties **/*.xml **/*.keystore" /> </copy> - <!-- Need to run it in tomcat to find output/build/webapps --> + <!-- Need to run it in tomcat to find output/build/webapps --> <junit printsummary="yes" fork="yes" dir="${tomcat.base}" > <classpath refid="lite-classpath" /> @@ -217,7 +217,7 @@ </batchtest> </junit> </target> - + <target name="test25" depends="compile25"> <mkdir dir="${test-classes}"/> <javac destdir="${test-classes}" @@ -235,7 +235,7 @@ <exclude name="org/apache/coyote/**"/> </javac> <copy todir="${test-classes}"> - <fileset dir="${tomcat.lite.src}/test" + <fileset dir="${tomcat.lite.src}/test" includes="**/*.properties **/*.xml **/*.keystore" /> </copy> @@ -299,7 +299,7 @@ <target name="download-ivy" unless="ivy.exist"> <mkdir dir="${ivy.jar.dir}"/> - <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" + <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/> </target> Modified: tomcat/trunk/modules/tomcat-lite/ivy.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/ivy.xml?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/ivy.xml (original) +++ tomcat/trunk/modules/tomcat-lite/ivy.xml Sat Oct 22 21:30:59 2011 @@ -15,9 +15,9 @@ "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. + under the License. --> -<ivy-module version="2.0" +<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <info @@ -27,6 +27,6 @@ </info> <dependencies> - + </dependencies> </ivy-module> Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/coyote/lite/LiteProtocolHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/coyote/lite/LiteProtocolHandler.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/coyote/lite/LiteProtocolHandler.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/coyote/lite/LiteProtocolHandler.java Sat Oct 22 21:30:59 2011 @@ -37,27 +37,27 @@ import org.apache.tomcat.util.modeler.Re /** * Work in progress - use the refactored http as a coyote connector. - * Just basic requests work right now - need to implement all the + * Just basic requests work right now - need to implement all the * methods of coyote. - * - * + * + * * @author Costin Manolache */ public class LiteProtocolHandler implements ProtocolHandler { Adapter adapter; Map<String, Object> attributes = new HashMap<String, Object>(); - - + + HttpConnector httpConnServer; int port = 8999; - + // Tomcat JMX integration Registry registry; - + public LiteProtocolHandler() { } - + @Override public void destroy() throws Exception { } @@ -99,9 +99,9 @@ public class LiteProtocolHandler impleme while (io != null) { bind("IOConnector-" + (ioLevel++) + "-" + base, io); if (io instanceof SocketConnector) { - bind("NioThread-" + base, + bind("NioThread-" + base, ((SocketConnector) io).getSelector()); - + } io = io.getNet(); } @@ -126,9 +126,9 @@ public class LiteProtocolHandler impleme public void targetRemoved(RemoteServer host) { unbind("AsyncHttp-" + base + "-" + host.target); } - + }); - + httpConnServer.setOnCreate(new HttpChannelEvents() { @Override public void onCreate(HttpChannel data, HttpConnector extraData) @@ -141,11 +141,11 @@ public class LiteProtocolHandler impleme unbind("AsyncHttp-" + base + "-" + data.getId()); } }); - + // TODO: process attributes via registry !! - + } - + private void bind(String name, Object o) { try { registry.registerComponent(o, "TomcatLite:name=" + name, null); @@ -169,19 +169,19 @@ public class LiteProtocolHandler impleme @Override public void setAdapter(Adapter adapter) { this.adapter = adapter; - + } - + @Override public void setAttribute(String name, Object value) { attributes.put(name, value); } - + @Override public void start() throws Exception { httpConnServer.start(); } - + public void setPort(int port) { this.port = port; } @@ -190,7 +190,7 @@ public class LiteProtocolHandler impleme * Wrap old tomcat buffer to lite buffer. */ private void wrap(MessageBytes dest, CBuffer buffer) { - dest.setChars(buffer.array(), buffer.position(), + dest.setChars(buffer.array(), buffer.position(), buffer.length()); } @@ -201,7 +201,7 @@ public class LiteProtocolHandler impleme // TODO: reuse, per req RequestData rc = new RequestData(); rc.init(httpReq, httpRes); - + try { adapter.service(rc.req, rc.res); } catch (Exception e) { @@ -209,8 +209,8 @@ public class LiteProtocolHandler impleme e.printStackTrace(); } } - - /** + + /** * ActionHook implementation, include coyote request/response objects. */ public class RequestData implements ActionHook { @@ -231,14 +231,14 @@ public class LiteProtocolHandler impleme Response res = new Response(); HttpResponse httpRes; HttpRequest httpReq; - + InputBuffer inputBuffer = new InputBuffer() { @Override public int doRead(ByteChunk bchunk, Request request) throws IOException { httpReq.getBody().waitData(httpReq.getHttpChannel().getIOTimeout()); - int rd = - httpReq.getBody().read(bchunk.getBytes(), + int rd = + httpReq.getBody().read(bchunk.getBytes(), bchunk.getStart(), bchunk.getBytes().length); if (rd > 0) { bchunk.setEnd(bchunk.getEnd() + rd); @@ -246,7 +246,7 @@ public class LiteProtocolHandler impleme return rd; } }; - + public RequestData() { req.setInputBuffer(inputBuffer); res.setOutputBuffer(outputBuffer); @@ -254,27 +254,27 @@ public class LiteProtocolHandler impleme res.setRequest(req); res.setHook(this); } - + public void init(HttpRequest httpReq, HttpResponse httpRes) { this.httpRes = httpRes; this.httpReq = httpReq; - // TODO: turn http request into a coyote request - copy all fields, + // TODO: turn http request into a coyote request - copy all fields, // add hooks where needed. - + wrap(req.decodedURI(), httpReq.decodedURI()); wrap(req.method(), httpReq.method()); wrap(req.protocol(), httpReq.protocol()); wrap(req.requestURI(), httpReq.requestURI()); wrap(req.queryString(), httpReq.queryString()); - + req.setServerPort(httpReq.getServerPort()); req.serverName().setString(req.localName().toString()); - + MultiMap mimeHeaders = httpReq.getMimeHeaders(); MimeHeaders coyoteHeaders = req.getMimeHeaders(); for (int i = 0; i < mimeHeaders.size(); i++ ) { Entry entry = mimeHeaders.getEntry(i); - MessageBytes val = + MessageBytes val = coyoteHeaders.addValue(entry.getName().toString()); val.setString(entry.getValue().toString()); } @@ -289,7 +289,7 @@ public class LiteProtocolHandler impleme public void action(ActionCode actionCode, Object param) { if (actionCode == ActionCode.ACTION_POST_REQUEST) { - commit(); // make sure it's sent - on errors + commit(); // make sure it's sent - on errors } else if (actionCode == ActionCode.ACTION_COMMIT) { commit(); } else if (actionCode == ActionCode.ACTION_ACK) { @@ -341,7 +341,7 @@ public class LiteProtocolHandler impleme Object sslAtt = httpReq.getHttpChannel().getNet().getAttribute(SslProvider.ATT_SSL_CIPHER); req.setAttribute("javax.servlet.request.cipher_suite", sslAtt); - + sslAtt = httpReq.getHttpChannel().getNet().getAttribute(SslProvider.ATT_SSL_KEY_SIZE); req.setAttribute("javax.servlet.request.key_size", sslAtt); @@ -386,7 +386,7 @@ public class LiteProtocolHandler impleme private void commit() { if (res.isCommitted()) return; - + // TODO: copy headers, fields httpRes.setStatus(res.getStatus()); httpRes.setMessage(res.getMessage()); @@ -414,7 +414,7 @@ public class LiteProtocolHandler impleme if (lang != null) { httpRes.setHeader("Content-Language", lang); } - + try { httpReq.send(); } catch (IOException e) { Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/BaseMapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/BaseMapper.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/BaseMapper.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/BaseMapper.java Sat Oct 22 21:30:59 2011 @@ -29,7 +29,7 @@ import org.apache.tomcat.lite.io.BBucket /** * Mapper, which implements the servlet API mapping rules (which are derived * from the HTTP rules). - * + * * This class doesn't use JNDI. */ public class BaseMapper { @@ -39,18 +39,18 @@ public class BaseMapper { // TODO: /** - * Mapping should be done on bytes - as received from net, before + * Mapping should be done on bytes - as received from net, before * translation to chars. This would allow setting the default charset - * for the context - or even executing the servlet and letting it specify + * for the context - or even executing the servlet and letting it specify * the charset to use for further decoding. - * + * */ public static interface Mapper { public void map(BBucket host, BBucket url, MappingData md); } - - /** + + /** * Like BaseMapper, for a Context. */ public static class ServiceMapper extends BaseMapper { @@ -117,10 +117,10 @@ public class BaseMapper { * Array containing the virtual hosts definitions. */ Host[] hosts = new Host[0]; - - /** - * If no other host is found. - * For single-host servers ( most common ) this is the only one + + /** + * If no other host is found. + * For single-host servers ( most common ) this is the only one * used. */ Host defaultHost = new Host(); @@ -139,7 +139,7 @@ public class BaseMapper { Host newHost = new Host(); newHost.name = name; newHost.contextList = new ContextList(); - + if (insertMap(hosts, newHosts, newHost)) { hosts = newHosts; } @@ -187,7 +187,7 @@ public class BaseMapper { return; } Host realHost = hosts[pos]; - + Host[] newHosts = new Host[hosts.length + 1]; Host newHost = new Host(); newHost.name = alias; @@ -201,14 +201,14 @@ public class BaseMapper { private Host getHost(String host) { return getHost(CBuffer.newInstance().append(host)); } - + private Host getHost(CBuffer host) { - if (hosts == null || hosts.length <= 1 || host == null + if (hosts == null || hosts.length <= 1 || host == null || host.length() == 0 || host.equals("")) { return defaultHost; } else { Host[] hosts = this.hosts; - // TODO: if hosts.length == 1 or defaultHost ? + // TODO: if hosts.length == 1 or defaultHost ? int pos = findIgnoreCase(hosts, host); if ((pos != -1) && (host.equalsIgnoreCase(hosts[pos].name))) { return hosts[pos]; @@ -236,18 +236,18 @@ public class BaseMapper { * @param context Context object * @param welcomeResources Welcome files defined for this context * @param resources Static resources of the context - * @param ctxService + * @param ctxService */ public BaseMapper.Context addContext(String hostName, String path, Object context, - String[] welcomeResources, FileConnector resources, + String[] welcomeResources, FileConnector resources, HttpChannel.HttpService ctxService) { if (path == null) { path = "/"; } - + Host host = getOrCreateHost(hostName); - + int slashCount = slashCount(path); synchronized (host) { BaseMapper.Context[] contexts = host.contextList.contexts; @@ -408,7 +408,7 @@ public class BaseMapper { * @param contextPath Context path this wrapper belongs to * @param path Wrapper mapping */ - public void removeWrapper(String hostName, String contextPath, + public void removeWrapper(String hostName, String contextPath, String path) { Host host = getHost(hostName); BaseMapper.Context[] contexts = host.contextList.contexts; @@ -478,7 +478,7 @@ public class BaseMapper { MappingData mappingData) throws Exception { - internalMap(host.length() == 0 ? null : + internalMap(host.length() == 0 ? null : host, uri, mappingData); } @@ -498,7 +498,7 @@ public class BaseMapper { int nesting = 0; // Virtual host mapping - Host mappedHost = getHost(host); + Host mappedHost = getHost(host); contexts = mappedHost.contextList.contexts; nesting = mappedHost.contextList.nesting; @@ -506,7 +506,7 @@ public class BaseMapper { if (contexts.length == 0) { return; } - + if (mappingData.context == null) { if (nesting < 1 || contexts.length == 1 && "".equals(contexts[0].name)) { // if 1 context (default) -> fast return @@ -533,7 +533,7 @@ public class BaseMapper { boolean found = false; CBuffer tmp = mappingData.tmpPrefix; tmp.wrap(uri, 0, uri.length()); - + while (pos >= 0) { if (tmp.startsWith(contexts[pos].name)) { length = contexts[pos].name.length(); @@ -563,7 +563,7 @@ public class BaseMapper { } } } - + if (context != null) { mappingData.context = context.object; mappingData.contextPath.set(context.name); @@ -582,20 +582,20 @@ public class BaseMapper { * Wrapper mapping, using servlet rules. */ protected final void internalMapWrapper( - BaseMapper.Context context, + BaseMapper.Context context, CBuffer url, MappingData mappingData) throws Exception { boolean noServletPath = false; if (url.length() < context.name.length()) { - throw new IOException("Invalid mapping " + context.name + " " + + throw new IOException("Invalid mapping " + context.name + " " + url); } try { // Set the servlet path. - mappingData.tmpServletPath.set(url, + mappingData.tmpServletPath.set(url, context.name.length(), url.length() - context.name.length()); @@ -607,16 +607,16 @@ public class BaseMapper { } } - mapAfterContext(context, url, mappingData.tmpServletPath, mappingData, + mapAfterContext(context, url, mappingData.tmpServletPath, mappingData, noServletPath); } catch (ArrayIndexOutOfBoundsException ex) { System.err.println(1); } } - void mapAfterContext(BaseMapper.Context context, - CBuffer url, CBuffer urlNoContext, - MappingData mappingData, boolean noServletPath) + void mapAfterContext(BaseMapper.Context context, + CBuffer url, CBuffer urlNoContext, + MappingData mappingData, boolean noServletPath) throws Exception { @@ -629,10 +629,10 @@ public class BaseMapper { BaseMapper.ServiceMapping[] wildcardWrappers = context.wildcardWrappers; if (mappingData.getServiceObject() == null) { - internalMapWildcardWrapper(wildcardWrappers, context.nesting, + internalMapWildcardWrapper(wildcardWrappers, context.nesting, urlNoContext, mappingData); - - if (mappingData.getServiceObject() != null + + if (mappingData.getServiceObject() != null && mappingData.service.jspWildCard) { if (urlNoContext.lastChar() == '/') { /* @@ -642,7 +642,7 @@ public class BaseMapper { * Force the context's welcome files, which are interpreted * as JSP files (since they match the url-pattern), to be * considered. See Bugzilla 27664. - */ + */ mappingData.service = null; checkJspWelcomeFiles = true; } else { @@ -675,7 +675,7 @@ public class BaseMapper { if (checkWelcomeFiles) { for (int i = 0; (i < context.welcomeResources.length) && (mappingData.getServiceObject() == null); i++) { - + CBuffer wpath = mappingData.tmpWelcome; wpath.set(urlNoContext); wpath.append(context.welcomeResources[i]); @@ -686,7 +686,7 @@ public class BaseMapper { // Rule 4b -- Welcome resources processing for prefix match if (mappingData.getServiceObject() == null) { internalMapWildcardWrapper - (wildcardWrappers, context.nesting, + (wildcardWrappers, context.nesting, urlNoContext, mappingData); } @@ -695,14 +695,14 @@ public class BaseMapper { if (mappingData.getServiceObject() == null && context.resources != null) { String pathStr = urlNoContext.toString(); - + mapWelcomResource(context, urlNoContext, mappingData, extensionWrappers, pathStr); - + } } } - + } @@ -716,25 +716,25 @@ public class BaseMapper { // Redirection to a folder if (context.resources != null && urlNoContext.lastChar() != '/') { String pathStr = urlNoContext.toString(); - mapDefaultServlet(context, urlNoContext, mappingData, + mapDefaultServlet(context, urlNoContext, mappingData, url, pathStr); } } } - /** + /** * Filesystem-dependent method: - * if pathStr corresponds to a directory, we'll need to redirect with / - * at end. + * if pathStr corresponds to a directory, we'll need to redirect with / + * at end. */ - protected void mapDefaultServlet(BaseMapper.Context context, + protected void mapDefaultServlet(BaseMapper.Context context, CBuffer path, - MappingData mappingData, + MappingData mappingData, CBuffer url, String pathStr) throws IOException { - - if (context.resources != null + + if (context.resources != null && context.resources.isDirectory(pathStr)) { mappingData.redirectPath.set(url); mappingData.redirectPath.append("/"); @@ -746,13 +746,13 @@ public class BaseMapper { /** - * Filesystem dependent method: - * check if a resource exists in filesystem. + * Filesystem dependent method: + * check if a resource exists in filesystem. */ protected void mapWelcomResource(BaseMapper.Context context, CBuffer path, MappingData mappingData, BaseMapper.ServiceMapping[] extensionWrappers, String pathStr) { - + if (context.resources != null && context.resources.isFile(pathStr)) { internalMapExtensionWrapper(extensionWrappers, @@ -786,15 +786,15 @@ public class BaseMapper { * Prefix mapping. ( /foo/* ) */ private final void internalMapWildcardWrapper - (BaseMapper.ServiceMapping[] wrappers, int nesting, CBuffer path, + (BaseMapper.ServiceMapping[] wrappers, int nesting, CBuffer path, MappingData mappingData) { int lastSlash = -1; int length = -1; - + CBuffer tmp = mappingData.tmpPrefix; tmp.wrap(path, 0, path.length()); - + int pos = find(wrappers, tmp); if (pos != -1) { boolean found = false; @@ -810,7 +810,7 @@ public class BaseMapper { } } if (lastSlash == -1) { - lastSlash = tmp.nthSlash(nesting + 1); + lastSlash = tmp.nthSlash(nesting + 1); } else { lastSlash = tmp.lastIndexOf('/'); } @@ -819,7 +819,7 @@ public class BaseMapper { } if (found) { mappingData.wrapperPath.set(wrappers[pos].name); - + if (path.length() > length) { mappingData.pathInfo.set (path, length, path.length() - length); @@ -830,21 +830,21 @@ public class BaseMapper { } } } - + /** * Extension mappings. */ protected final void internalMapExtensionWrapper (BaseMapper.ServiceMapping[] wrappers, CBuffer path, MappingData mappingData) { - + int dot = path.getExtension(mappingData.ext, '/', '.'); if (dot >= 0) { int pos = find(wrappers, mappingData.ext); - + if ((pos != -1) && (mappingData.ext.equals(wrappers[pos].name))) { - + mappingData.wrapperPath.set(path); mappingData.requestPath.set(path); @@ -868,10 +868,10 @@ public class BaseMapper { if (b == -1) { return -1; } - + if (name.compare(map[0].name) < 0 ) { return -1; - } + } if (b == 0) { return 0; } @@ -904,7 +904,7 @@ public class BaseMapper { * This will return the index for the closest inferior or equal item in the * given array. */ - private static final int findIgnoreCase(BaseMapper.Mapping[] map, + private static final int findIgnoreCase(BaseMapper.Mapping[] map, CBuffer name) { int a = 0; int b = map.length - 1; @@ -915,7 +915,7 @@ public class BaseMapper { } if (name.compareIgnoreCase(map[0].name) < 0 ) { return -1; - } + } if (b == 0) { return 0; } @@ -958,10 +958,10 @@ public class BaseMapper { if (b == -1) { return -1; } - + if (name.compareTo(map[0].name) < 0) { return -1; - } + } if (b == 0) { return 0; } @@ -1062,21 +1062,21 @@ public class BaseMapper { public static final class Context extends BaseMapper.Mapping { - + Context(BaseMapper mapper) { this.mapper = mapper; } public BaseMapper mapper; public String[] welcomeResources = new String[0]; public FileConnector resources = null; - + public BaseMapper.ServiceMapping defaultWrapper = null; - + public BaseMapper.ServiceMapping[] exactWrappers = new BaseMapper.ServiceMapping[0]; public BaseMapper.ServiceMapping[] wildcardWrappers = new BaseMapper.ServiceMapping[0]; public BaseMapper.ServiceMapping[] extensionWrappers = new BaseMapper.ServiceMapping[0]; public int nesting = 0; - + public void addWrapper(String path, HttpService service) { mapper.addWrapper(this, path, service); } @@ -1086,17 +1086,17 @@ public class BaseMapper { public static class ServiceMapping extends BaseMapper.Mapping { public boolean jspWildCard = false; - // If set, the service will run in the selector thread ( should + // If set, the service will run in the selector thread ( should // be non-blocking ) public boolean selectorThread = false; - + } - protected static abstract class Mapping { + protected static abstract class Mapping { public String name = null; public Object object = null; - + public String toString() { if (name == null || "".equals(name)) { return "DEFAULT"; Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/CompressFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/CompressFilter.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/CompressFilter.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/CompressFilter.java Sat Oct 22 21:30:59 2011 @@ -17,29 +17,29 @@ public class CompressFilter { // 1CMF 1FLG [4DICTID] DATA 4ADLER // CMF: CINFO + CM (compression method). == x8 // 78 == deflate with 32k window, i.e. max window - + // FLG: 2bit level, 1 bit FDICT, 5 bit FCHECK // Cx, Dx - no dict; Fx, Ex - dict ( for BEST_COMPRESSION ) - + // Overhead: 6 bytes without dict, 10 with dict // data is encoded in blocks - there is a 'block end' marker and // 'last block'. - + // Flush: http://www.bolet.org/~pornin/deflate-flush.html - // inflater needs about 9 bits + // inflater needs about 9 bits // Z_SYNC_FLUSH: send empty block, 00 00 FF FF - seems recomended // PPP can skip this - there is a record format on top // Z_PARTIAL_FLUSH: standard for SSH ZStream cStream; ZStream dStream; - + byte[] dict; long dictId; - + public CompressFilter() { } - + public void recycle() { if (cStream == null) { return; @@ -49,7 +49,7 @@ public class CompressFilter { dStream.free(); dStream = null; } - + public void init() { if (cStream != null) { return; @@ -59,12 +59,12 @@ public class CompressFilter { // BEST_COMRESSION results in 256Kb per Deflate // 15 == default = 32k window cStream.deflateInit(JZlib.Z_BEST_SPEED, 10); - + dStream = new ZStream(); dStream.inflateInit(); } - + CompressFilter setDictionary(byte[] dict, long id) { init(); this.dict = dict; @@ -76,7 +76,7 @@ public class CompressFilter { void compress(IOBuffer in, IOBuffer out) throws IOException { init(); BBucket bb = in.popFirst(); - + while (bb != null) { // TODO: only the last one needs flush @@ -84,12 +84,12 @@ public class CompressFilter { compress(bb, out, false); bb = in.popFirst(); } - + if (in.isClosedAndEmpty()) { compressEnd(out); } } - + void compress(BBucket bb, IOBuffer out, boolean last) throws IOException { // TODO: only the last one needs flush @@ -115,7 +115,7 @@ public class CompressFilter { break; } } - + if (last) { compressEnd(out); } @@ -125,12 +125,12 @@ public class CompressFilter { while (true) { ByteBuffer outB = out.getWriteBuffer(); cStream.next_out = outB.array(); - + cStream.next_out_index = outB.position(); cStream.avail_out = outB.remaining(); cStream.deflate(JZlib.Z_FINISH); cStream.deflateEnd(); - + outB.position(cStream.next_out_index); out.releaseWriteBuffer(1); if (cStream.avail_out > 0) { @@ -142,11 +142,11 @@ public class CompressFilter { void decompress(IOBuffer in, IOBuffer out) throws IOException { decompress(in, out, in.available()); } - + void decompress(IOBuffer in, IOBuffer out, int len) throws IOException { init(); BBucket bb = in.peekFirst(); - + while (bb != null && len > 0) { dStream.next_in = bb.array(); dStream.next_in_index = bb.position(); @@ -155,11 +155,11 @@ public class CompressFilter { while (true) { ByteBuffer outB = out.getWriteBuffer(); - + dStream.next_out = outB.array(); dStream.next_out_index = outB.position(); dStream.avail_out = outB.remaining(); - + int err = dStream.inflate(JZlib.Z_SYNC_FLUSH); if (err == JZlib.Z_NEED_DICT && dict != null) { // dStream.adler has the dict id - not sure how to check @@ -190,12 +190,12 @@ public class CompressFilter { break; } } - - in.advance(rd); // consummed + + in.advance(rd); // consummed len -= rd; bb = in.peekFirst(); } - + if (in.isClosedAndEmpty()) { // Shouldn't happen - input was not properly closed.. // This should throw an exception, inflateEnd will check the CRC @@ -205,13 +205,13 @@ public class CompressFilter { out.close(); } } - + private void check(int err, ZStream stream) throws IOException { if (err != JZlib.Z_OK) { throw new IOException(err + " " + stream.msg); } } - + boolean isCompressed(HttpMessage http) { return false; } @@ -219,7 +219,7 @@ public class CompressFilter { boolean needsCompression(HttpMessage in, HttpMessage out) { return false; } - - + + } Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ContentType.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ContentType.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ContentType.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/ContentType.java Sat Oct 22 21:30:59 2011 @@ -20,7 +20,7 @@ package org.apache.tomcat.lite.http; /** * Usefull methods for Content-Type processing - * + * * @author James Duncan Davidson [dun...@eng.sun.com] * @author James Todd [go...@eng.sun.com] * @author Jason Hunter [j...@eng.sun.com] Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/DefaultHttpConnector.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/DefaultHttpConnector.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/DefaultHttpConnector.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/DefaultHttpConnector.java Sat Oct 22 21:30:59 2011 @@ -12,12 +12,12 @@ public class DefaultHttpConnector { public synchronized static HttpConnector get() { if (DefaultHttpConnector.socketConnector == null) { - socketConnector = + socketConnector = new SocketConnector(); } return new HttpConnector(socketConnector); } - + private static SocketConnector socketConnector; } Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Dispatcher.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Dispatcher.java?rev=1187812&r1=1187811&r2=1187812&view=diff ============================================================================== --- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Dispatcher.java (original) +++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/http/Dispatcher.java Sat Oct 22 21:30:59 2011 @@ -31,9 +31,9 @@ import org.apache.tomcat.lite.io.FileCon * - decide if the request should be run in the selector thread * or in a thread pool * - finalizes the request ( close / flush ) - * - detects if the request is complete or set callbacks + * - detects if the request is complete or set callbacks * for receive/flush/done. - * + * */ public class Dispatcher implements HttpService { @@ -45,15 +45,15 @@ public class Dispatcher implements HttpS public Dispatcher() { init(); } - + protected void init() { - mapper = new BaseMapper(); + mapper = new BaseMapper(); } public void runService(HttpChannel ch) { runService(ch, true); } - + public void runService(HttpChannel ch, boolean recycle) { MappingData mapRes = ch.getRequest().getMappingData(); HttpService h = (HttpService) mapRes.getServiceObject(); @@ -73,38 +73,38 @@ public class Dispatcher implements HttpS t.printStackTrace(); } } - + @Override public void service(HttpRequest httpReq, HttpResponse httpRes) throws IOException { service(httpReq, httpRes, false, true); } - /** + /** * Process the request/response in the current thread, without * release ( recycle ) at the end. - * + * * For use by tests and/or in-memory running of servlets. - * - * If no connection is associated with the request - the + * + * If no connection is associated with the request - the * output will remain in the out buffer. */ public void run(HttpRequest httpReq, HttpResponse httpRes) throws IOException { service(httpReq, httpRes, true, false); } - - public void service(HttpRequest httpReq, HttpResponse httpRes, boolean noThread, boolean recycle) + + public void service(HttpRequest httpReq, HttpResponse httpRes, boolean noThread, boolean recycle) throws IOException { long t0 = System.currentTimeMillis(); HttpChannel http = httpReq.getHttpChannel(); - + http.setCompletedCallback(doneCallback); - + try { // compute decodedURI - not done by connector MappingData mapRes = httpReq.getMappingData(); mapRes.recycle(); - + mapper.map(httpReq.serverName(), httpReq.decodedURI(), mapRes); @@ -112,24 +112,24 @@ public class Dispatcher implements HttpS if (h != null) { if (debug) { - log.info(">>>>>>>> START: " + http.getRequest().method() + " " + - http.getRequest().decodedURI() + " " + + log.info(">>>>>>>> START: " + http.getRequest().method() + " " + + http.getRequest().decodedURI() + " " + h.getClass().getSimpleName()); } - + if (mapRes.service.selectorThread || noThread) { runService(http, recycle); } else { tp.execute(httpReq.getHttpChannel().dispatcherRunnable); } - + } else { httpRes.setStatus(404); http.complete(); } - + } catch (IOException ex) { - if ("Broken pipe".equals(ex.getMessage())) { + if ("Broken pipe".equals(ex.getMessage())) { log.warning("Connection interrupted while writting"); } throw ex; @@ -144,26 +144,26 @@ public class Dispatcher implements HttpS @Override public void handle(HttpChannel client, Object extraData) throws IOException { if (debug) { - log.info("<<<<<<<< DONE: " + client.getRequest().method() + " " + - client.getRequest().decodedURI() + " " + - client.getResponse().getStatus() + " " + log.info("<<<<<<<< DONE: " + client.getRequest().method() + " " + + client.getRequest().decodedURI() + " " + + client.getResponse().getStatus() + " " ); } } }; - + public BaseMapper.Context addContext(String hostname, String ctxPath, Object ctx, String[] welcomeResources, FileConnector resources, HttpService ctxService) { - return mapper.addContext(hostname, ctxPath, ctx, welcomeResources, resources, + return mapper.addContext(hostname, ctxPath, ctx, welcomeResources, resources, ctxService); } public BaseMapper.Context addContext(String ctxPath) { - return mapper.addContext(null, ctxPath, null, null, null, + return mapper.addContext(null, ctxPath, null, null, null, null); } - + public void map(CBuffer hostMB, CBuffer urlMB, MappingData md) { try { mapper.map(hostMB, urlMB, md); @@ -187,10 +187,10 @@ public class Dispatcher implements HttpS HttpService service) { mapper.addWrapper(ctx, path, service); } - - + + public void setDefaultService(HttpService service) { - BaseMapper.Context mCtx = + BaseMapper.Context mCtx = mapper.addContext(null, "/", null, null, null, null); mapper.addWrapper(mCtx, "/", service); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org