tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1187812 [6/8] - in /tomcat/trunk/modules/tomcat-lite: ./ java/org/apache/coyote/lite/ java/org/apache/tomcat/lite/http/ java/org/apache/tomcat/lite/io/ java/org/apache/tomcat/lite/io/jsse/ java/org/apache/tomcat/lite/proxy/ java/org/apache...
Date Sat, 22 Oct 2011 21:31:02 GMT
Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/JsseSslProvider.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/JsseSslProvider.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/JsseSslProvider.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/JsseSslProvider.java Sat Oct 22 21:30:59 2011
@@ -54,68 +54,68 @@ public class JsseSslProvider implements 
 
     /**
      * TODO: option to require validation.
-     * TODO: remember cert signature. This is needed to support self-signed 
-     * certs, like those used by the test. 
-     * 
+     * TODO: remember cert signature. This is needed to support self-signed
+     * certs, like those used by the test.
+     *
      */
     public static class BasicTrustManager implements X509TrustManager {
-    
+
         private X509Certificate[] chain;
-        
+
         public void checkClientTrusted(X509Certificate[] chain, String authType)
                 throws CertificateException {
             this.chain = chain;
         }
-    
+
         public void checkServerTrusted(X509Certificate[] chain, String authType)
                 throws CertificateException {
             this.chain = chain;
         }
-    
+
         public X509Certificate[] getAcceptedIssuers() {
             return new X509Certificate[0];
         }
     }
 
-    public static TrustManager[] trustAllCerts = new TrustManager[] { 
-        new BasicTrustManager() }; 
+    public static TrustManager[] trustAllCerts = new TrustManager[] {
+        new BasicTrustManager() };
 
     static String[] enabledCiphers;
 
     static final boolean debug = false;
-    
+
     IOConnector net;
-    private KeyManager[] keyManager; 
+    private KeyManager[] keyManager;
     SSLContext sslCtx;
     boolean server;
     private TrustManager[] trustManagers;
-    
+
     public AtomicInteger handshakeCount = new AtomicInteger();
     public AtomicInteger handshakeOk = new AtomicInteger();
     public AtomicInteger handshakeErr = new AtomicInteger();
     public AtomicInteger handshakeTime = new AtomicInteger();
-    
+
     Executor handshakeExecutor = Executors.newCachedThreadPool();
     static int id = 0;
-    
+
     public JsseSslProvider() {
     }
-    
+
     public static void setEnabledCiphers(String[] enabled) {
         enabledCiphers = enabled;
     }
-    
+
     public void start() {
-        
+
     }
-    
+
     SSLContext getSSLContext() {
         if (sslCtx == null) {
             try {
                 sslCtx = SSLContext.getInstance("TLS");
                 if (trustManagers == null) {
-                    trustManagers = 
-                        new TrustManager[] {new BasicTrustManager()}; 
+                    trustManagers =
+                        new TrustManager[] {new BasicTrustManager()};
 
                 }
                 sslCtx.init(keyManager, trustManagers, null);
@@ -128,7 +128,7 @@ public class JsseSslProvider implements 
         }
         return sslCtx;
     }
-    
+
     public IOConnector getNet() {
         if (net == null) {
             getSSLContext();
@@ -136,7 +136,7 @@ public class JsseSslProvider implements 
         }
         return net;
     }
-    
+
     @Override
     public IOChannel channel(IOChannel net, String host, int port) throws IOException {
       if (debug) {
@@ -158,8 +158,8 @@ public class JsseSslProvider implements 
         ch.setSink(net);
         return ch;
     }
-    
-    public void acceptor(final ConnectedCallback sc, CharSequence port, Object extra) 
+
+    public void acceptor(final ConnectedCallback sc, CharSequence port, Object extra)
             throws IOException {
         getNet().acceptor(new ConnectedCallback() {
             @Override
@@ -168,7 +168,7 @@ public class JsseSslProvider implements 
                 if (debug) {
                     first = DumpChannel.wrap("S-ENC-" + id, ch);
                 }
-                
+
                 IOChannel sslch = serverChannel(first);
                 sslch.setSink(first);
                 first.setHead(sslch);
@@ -177,12 +177,12 @@ public class JsseSslProvider implements 
                     sslch = DumpChannel.wrap("S-CLR-" + id, sslch);
                     id++;
                 }
-                
+
                 sc.handleConnected(sslch);
             }
         }, port, extra);
     }
-    
+
     public void connect(final String host, final int port, final ConnectedCallback sc)
             throws IOException {
         getNet().connect(host, port, new ConnectedCallback() {
@@ -193,7 +193,7 @@ public class JsseSslProvider implements 
                 if (debug) {
                     first = DumpChannel.wrap("ENC-" + id, first);
                 }
-                
+
                 IOChannel sslch = channel(first, host, port);
 //                first.setHead(sslch);
 
@@ -201,10 +201,10 @@ public class JsseSslProvider implements 
                     sslch = DumpChannel.wrap("CLR-" + id, sslch);
                     id++;
                 }
-                
+
                 sc.handleConnected(sslch);
             }
-            
+
         });
     }
 
@@ -212,16 +212,16 @@ public class JsseSslProvider implements 
         this.keyManager = kms;
         return this;
     }
-    
+
     public JsseSslProvider setKeystoreFile(String file, String pass) throws IOException {
         return setKeystore(new FileInputStream(file), pass);
     }
 
     public JsseSslProvider setKeystoreResource(String res, String pass) throws IOException {
-        return setKeystore(this.getClass().getClassLoader().getResourceAsStream(res), 
+        return setKeystore(this.getClass().getClassLoader().getResourceAsStream(res),
                 pass);
     }
-    
+
     public JsseSslProvider setKeystore(InputStream file, String pass) {
         char[] passphrase = pass.toCharArray();
         KeyStore ks;
@@ -232,14 +232,14 @@ public class JsseSslProvider implements 
             // Android: BKS
             ks = KeyStore.getInstance(type);
             ks.load(file, passphrase);
-            KeyManagerFactory kmf = 
+            KeyManagerFactory kmf =
                 KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
             kmf.init(ks, passphrase);
-            
-            TrustManagerFactory tmf = 
+
+            TrustManagerFactory tmf =
                 TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
             tmf.init(ks);
-            
+
             keyManager = kmf.getKeyManagers();
             trustManagers = tmf.getTrustManagers();
         } catch (KeyStoreException e) {
@@ -261,38 +261,38 @@ public class JsseSslProvider implements 
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-                
+
         return this;
     }
-    
+
     public JsseSslProvider setKeys(X509Certificate cert, PrivateKey privKey) {
         keyManager = new KeyManager[] {
                 new TestKeyManager(cert, privKey)
         };
         return this;
     }
-    
-    public JsseSslProvider setKeyFiles(String certPem, String keyFile) 
+
+    public JsseSslProvider setKeyFiles(String certPem, String keyFile)
             throws IOException {
-        
+
 
         return this;
     }
-    
-    public JsseSslProvider setKeyRes(String certPem, String keyFile) 
+
+    public JsseSslProvider setKeyRes(String certPem, String keyFile)
             throws IOException {
         setKeys(this.getClass().getClassLoader().getResourceAsStream(certPem),
                 this.getClass().getClassLoader().getResourceAsStream(keyFile));
         return this;
     }
-    
+
     private void setKeys(InputStream certPem,
             InputStream keyDer) throws IOException {
         BBuffer keyB = BBuffer.allocate(2048);
         keyB.readAll(keyDer);
         byte[] key = new byte[keyB.remaining()];
         keyB.getByteBuffer().get(key);
-        
+
         setKeys(certPem, key);
     }
 
@@ -300,19 +300,19 @@ public class JsseSslProvider implements 
         InputStream is = new ByteArrayInputStream(certPem.getBytes());
         return setKeys(is, keyBytes);
     }
-    
+
     /**
      * Initialize using a PEM certificate and key bytes.
      * ( TODO: base64 dep to set the key as PEM )
-     * 
+     *
      *  openssl genrsa 1024 > host.key
-     *  openssl pkcs8 -topk8 -nocrypt -in host.key -inform PEM 
+     *  openssl pkcs8 -topk8 -nocrypt -in host.key -inform PEM
      *     -out host.der -outform DER
      *  openssl req -new -x509 -nodes -sha1 -days 365 -key host.key > host.cert
-     * 
+     *
      */
     public JsseSslProvider setKeys(InputStream certPem, byte[] keyBytes) throws IOException{
-        // convert key 
+        // convert key
         try {
             KeyFactory kf = KeyFactory.getInstance("RSA");
             PKCS8EncodedKeySpec keysp = new PKCS8EncodedKeySpec(keyBytes);
@@ -332,22 +332,22 @@ public class JsseSslProvider implements 
     public class TestKeyManager extends X509ExtendedKeyManager {
         X509Certificate cert;
         PrivateKey privKey;
-        
+
         public TestKeyManager(X509Certificate cert2, PrivateKey privKey2) {
             cert = cert2;
             privKey = privKey2;
         }
 
-        public String chooseEngineClientAlias(String[] keyType, 
+        public String chooseEngineClientAlias(String[] keyType,
                 java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine) {
             return "client";
         }
-        
-        public String chooseEngineServerAlias(String keyType, 
+
+        public String chooseEngineServerAlias(String keyType,
                 java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine) {
             return "server";
         }
-        
+
         public String chooseClientAlias(String[] keyType,
                                         Principal[] issuers, Socket socket) {
             return "client";
@@ -367,8 +367,8 @@ public class JsseSslProvider implements 
         }
 
         public PrivateKey getPrivateKey(String alias) {
-            
-            return privKey; 
+
+            return privKey;
         }
 
         public String[] getServerAliases(String keyType, Principal[] issuers) {
@@ -377,8 +377,8 @@ public class JsseSslProvider implements 
     }
 
     // TODO: add a mode that trust a defined list of certs, like SSH
-    
-    /** 
+
+    /**
      * Make URLConnection accept all certificates.
      * Use only for testing !
      */
@@ -386,7 +386,7 @@ public class JsseSslProvider implements 
         try {
             SSLContext sc = SSLContext.getInstance("TLS");
             sc.init(null, JsseSslProvider.trustAllCerts, null);
-            
+
             javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(
                     sc.getSocketFactory());
             javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
@@ -404,16 +404,16 @@ public class JsseSslProvider implements 
                             }
                             return true;
                         }
-                        
+
                     });
-            
+
         } catch (Exception e) {
             e.printStackTrace();
-        } 
+        }
     }
 
     // Utilities
-    public static byte[] getPrivateKeyFromStore(String file, String pass) 
+    public static byte[] getPrivateKeyFromStore(String file, String pass)
             throws Exception {
         KeyStore store = KeyStore.getInstance("JKS");
         store.load(new FileInputStream(file), pass.toCharArray());
@@ -423,7 +423,7 @@ public class JsseSslProvider implements 
         return encoded;
     }
 
-    public static byte[] getCertificateFromStore(String file, String pass) 
+    public static byte[] getCertificateFromStore(String file, String pass)
             throws Exception {
         KeyStore store = KeyStore.getInstance("JKS");
         store.load(new FileInputStream(file), pass.toCharArray());
@@ -431,7 +431,7 @@ public class JsseSslProvider implements 
 
         return certificate.getEncoded();
     }
-    
+
     public static KeyPair generateRsaOrDsa(boolean rsa) throws Exception {
         if (rsa) {
             KeyPairGenerator keyPairGen =
@@ -455,7 +455,7 @@ public class JsseSslProvider implements 
             return pair;
         }
     }
-    
+
     /**
      * I know 2 ways to generate certs:
      *  - keytool

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/SslChannel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/SslChannel.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/SslChannel.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/io/jsse/SslChannel.java Sat Oct 22 21:30:59 2011
@@ -27,17 +27,17 @@ class SslChannel extends IOChannel imple
     static Logger log = Logger.getLogger("SSL");
 
     static ByteBuffer EMPTY = ByteBuffer.allocate(0);
-    
+
 
     SSLEngine sslEngine;
     // Last result
     SSLEngineResult unwrapR;
-    
+
     boolean handshakeDone = false;
     boolean handshakeInProgress = false;
     Object handshakeSync = new Object();
     boolean flushing = false;
-    
+
     IOBuffer in = new IOBuffer(this);
     IOBuffer out = new IOBuffer(this);
 
@@ -45,15 +45,15 @@ class SslChannel extends IOChannel imple
     // Used for session reuse
     String host;
     int port;
-    
+
     ByteBuffer myAppOutData;
-    ByteBuffer myNetOutData; 
+    ByteBuffer myNetOutData;
     private static boolean debugWrap = false;
 
     /*
      * Special: SSL works in packet mode, and we may receive an incomplete
      * packet. This should be in compacted write mode (i.e. data from 0 to pos,
-     * limit at end )  
+     * limit at end )
      */
     ByteBuffer myNetInData;
     ByteBuffer myAppInData;
@@ -62,15 +62,15 @@ class SslChannel extends IOChannel imple
     private SSLContext sslCtx;
 
     private boolean closeHandshake = false;
-    
+
     public SslChannel() {
     }
-    
+
     /**
-     * Setting the host/port enables clients to reuse SSL session - 
-     * less traffic and encryption overhead at startup, assuming the 
+     * Setting the host/port enables clients to reuse SSL session -
+     * less traffic and encryption overhead at startup, assuming the
      * server caches the session ( i.e. single server or distributed cache ).
-     * 
+     *
      * SSL ticket extension is another possibility.
      */
     public SslChannel setTarget(String host, int port) {
@@ -78,13 +78,13 @@ class SslChannel extends IOChannel imple
         this.port = port;
         return this;
     }
-    
+
     private synchronized void initSsl() throws GeneralSecurityException {
         if (sslEngine != null) {
             log.severe("Double initSsl");
             return;
         }
-        
+
         if (client) {
             if (port > 0) {
                 sslEngine = sslCtx.createSSLEngine(host, port);
@@ -95,16 +95,16 @@ class SslChannel extends IOChannel imple
         } else {
             sslEngine = sslCtx.createSSLEngine();
             sslEngine.setUseClientMode(false);
-            
+
         }
 
         // Some VMs have broken ciphers.
         if (JsseSslProvider.enabledCiphers != null) {
             sslEngine.setEnabledCipherSuites(JsseSslProvider.enabledCiphers);
         }
-        
+
         SSLSession session = sslEngine.getSession();
-    
+
         int packetBuffer = session.getPacketBufferSize();
         myAppOutData = ByteBuffer.allocate(session.getApplicationBufferSize());
         myNetOutData = ByteBuffer.allocate(packetBuffer);
@@ -115,13 +115,13 @@ class SslChannel extends IOChannel imple
         myAppInData.flip();
         myAppOutData.flip();
     }
-    
+
     public SslChannel withServer() {
         client = false;
         return this;
     }
-    
-    
+
+
     @Override
     public synchronized void setSink(IOChannel net) throws IOException {
         try {
@@ -133,7 +133,7 @@ class SslChannel extends IOChannel imple
             log.log(Level.SEVERE, "Error initializing ", e);
         }
     }
-    
+
     @Override
     public IOBuffer getIn() {
         return in;
@@ -143,14 +143,14 @@ class SslChannel extends IOChannel imple
     public IOBuffer getOut() {
         return out;
     }
-    
+
     /**
      * Typically called when a dataReceived callback is passed up.
-     * It's up to the higher layer to decide if it can handle more data 
+     * It's up to the higher layer to decide if it can handle more data
      * and disable read interest and manage its buffers.
-     * 
+     *
      * We have to use one buffer.
-     * @throws IOException 
+     * @throws IOException
      */
     public int processInput(IOBuffer netIn, IOBuffer appIn) throws IOException {
         if (log.isLoggable(Level.FINEST)) {
@@ -160,15 +160,15 @@ class SslChannel extends IOChannel imple
             if (!handshakeDone && !handshakeInProgress) {
                 handshakeInProgress = true;
                 handleHandshking();
-                return 0; 
-            }            
+                return 0;
+            }
             if (handshakeInProgress) {
                 return 0; // leave it there
             }
         }
         return processRealInput(netIn, appIn);
     }
-    
+
     private synchronized int processRealInput(IOBuffer netIn, IOBuffer appIn) throws IOException {
         int rd = 0;
         boolean needsMore = true;
@@ -187,7 +187,7 @@ class SslChannel extends IOChannel imple
             } finally {
                 myNetInData.flip();
             }
-            if (rdNow == 0 && (myNetInData.remaining() == 0 || 
+            if (rdNow == 0 && (myNetInData.remaining() == 0 ||
                     notEnough)) {
                 return rd;
             }
@@ -221,14 +221,14 @@ class SslChannel extends IOChannel imple
                             closeHandshake  = true;
                         }
                         handleHandshking();
-                        
+
                         startSending();
                     }
                     break;
                 }
-                
+
                 if (unwrapR.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
-                    tasks();                    
+                    tasks();
                 }
                 if (unwrapR.getStatus() == Status.BUFFER_OVERFLOW) {
                     log.severe("Unhandled overflow " + unwrapR);
@@ -241,8 +241,8 @@ class SslChannel extends IOChannel imple
                 }
             }
             sendHandleReceivedCallback();
-            
-            
+
+
         }
         return rd;
     }
@@ -256,7 +256,7 @@ class SslChannel extends IOChannel imple
     }
 
     public void startSending() throws IOException {
-        
+
         flushing = true;
         boolean needHandshake = false;
         synchronized(handshakeSync) {
@@ -270,12 +270,12 @@ class SslChannel extends IOChannel imple
         }
         if (needHandshake) {
             handleHandshking();
-            return; // can't write yet.            
+            return; // can't write yet.
         }
-        
+
         startRealSending();
     }
-    
+
     public void close() throws IOException {
         if (net.getOut().isAppendClosed()) {
             return;
@@ -303,16 +303,16 @@ class SslChannel extends IOChannel imple
         // clean close handshake
         super.close();
     }
-    
+
     private Object sendLock = new Object();
 
     private JsseSslProvider sslProvider;
-    
+
     private void startRealSending() throws IOException {
         // Only one thread at a time
         synchronized (sendLock) {
             while (true) {
-                
+
                 myAppOutData.compact();
                 int rd;
                 try {
@@ -332,7 +332,7 @@ class SslChannel extends IOChannel imple
                 synchronized(myNetOutData) {
                     myNetOutData.compact();
                     try {
-                        wrap = sslEngine.wrap(myAppOutData, 
+                        wrap = sslEngine.wrap(myAppOutData,
                                 myNetOutData);
                     } finally {
                         myNetOutData.flip();
@@ -354,33 +354,33 @@ class SslChannel extends IOChannel imple
                 }
             }
         }
-        
+
         net.startSending();
     }
 
 
-    // SSL handshake require slow tasks - that will need to be executed in a 
-    // thread anyways. Better to keep it simple ( the code is very complex ) - 
+    // SSL handshake require slow tasks - that will need to be executed in a
+    // thread anyways. Better to keep it simple ( the code is very complex ) -
     // and do the initial handshake in a thread, not in the IO thread.
     // We'll need to unregister and register again from the selector.
-    private void handleHandshking() { 
+    private void handleHandshking() {
         if (log.isLoggable(Level.FINEST)) {
             log.info("Starting handshake");
         }
         synchronized(handshakeSync) {
-            handshakeInProgress = true;            
+            handshakeInProgress = true;
         }
 
         sslProvider.handshakeExecutor.execute(this);
     }
-    
+
     private void endHandshake() throws IOException {
         if (log.isLoggable(Level.FINEST)) {
             log.info("Handshake done " + net.getIn().available());
         }
         synchronized(handshakeSync) {
             handshakeDone = true;
-            handshakeInProgress = false;            
+            handshakeInProgress = false;
         }
         if (flushing) {
             flushing = false;
@@ -401,16 +401,16 @@ class SslChannel extends IOChannel imple
             SSLEngineResult wrap = null;
 
             HandshakeStatus hstatus = sslEngine.getHandshakeStatus();
-            if (!closeHandshake && 
+            if (!closeHandshake &&
                     (hstatus == HandshakeStatus.NOT_HANDSHAKING || initial)) {
                 sslEngine.beginHandshake();
                 hstatus = sslEngine.getHandshakeStatus();
             }
-            
+
             long t0 = System.currentTimeMillis();
-            
-            while (hstatus != HandshakeStatus.NOT_HANDSHAKING 
-                    && hstatus != HandshakeStatus.FINISHED 
+
+            while (hstatus != HandshakeStatus.NOT_HANDSHAKING
+                    && hstatus != HandshakeStatus.FINISHED
                     && !net.getIn().isAppendClosed()) {
                 if (System.currentTimeMillis() - t0 > handshakeTimeout) {
                     throw new TimeoutException();
@@ -422,7 +422,7 @@ class SslChannel extends IOChannel imple
                     log.info("-->doHandshake() loop: status = " + hstatus + " " +
                             sslEngine.getHandshakeStatus());
                 }
-                
+
                 if (hstatus == HandshakeStatus.NEED_WRAP) {
                     // || initial - for client
                     initial = false;
@@ -463,8 +463,8 @@ class SslChannel extends IOChannel imple
                                 break;
                             }
                         }
-                        // Still need unwrap 
-                        if (wrap == null 
+                        // Still need unwrap
+                        if (wrap == null
                                 || wrap.getStatus() == Status.BUFFER_UNDERFLOW
                                 || (hstatus == HandshakeStatus.NEED_UNWRAP && myNetInData.remaining() == 0)) {
                             myNetInData.compact();
@@ -494,12 +494,12 @@ class SslChannel extends IOChannel imple
                             }
                         }
                         if (log.isLoggable(Level.FINEST)) {
-                            log.info("Unwrap chunk done " + hstatus + " " + wrap 
+                            log.info("Unwrap chunk done " + hstatus + " " + wrap
                                 + " " + sslEngine.getHandshakeStatus());
                         }
 
                     }
-                    
+
                     // rd may have some input bytes.
                 } else if (hstatus == HandshakeStatus.NEED_TASK) {
                     long t0task = System.currentTimeMillis();
@@ -513,7 +513,7 @@ class SslChannel extends IOChannel imple
                         log.info("Tasks done in " + (t1task - t0task) + " new status " +
                                 hstatus);
                     }
-                    
+
                 }
                 if (hstatus == HandshakeStatus.NOT_HANDSHAKING) {
                     //log.warning("NOT HANDSHAKING " + this);
@@ -529,7 +529,7 @@ class SslChannel extends IOChannel imple
                 net.close();
                 sendHandleReceivedCallback();
             } catch (IOException ex) {
-                log.log(Level.SEVERE, "Error closing", ex);                
+                log.log(Level.SEVERE, "Error closing", ex);
             }
         }
     }
@@ -546,12 +546,12 @@ class SslChannel extends IOChannel imple
         this.sslCtx = sslCtx;
         return this;
     }
-    
+
     SslChannel setSslProvider(JsseSslProvider con) {
         this.sslProvider = con;
         return this;
     }
-    
+
     public Object getAttribute(String name) {
         if (SslProvider.ATT_SSL_CERT.equals(name)) {
             try {
@@ -576,7 +576,7 @@ class SslChannel extends IOChannel imple
             return size;
         } else if (SslProvider.ATT_SSL_SESSION_ID.equals(name)) {
             byte [] ssl_session = sslEngine.getSession().getId();
-            if ( ssl_session == null) 
+            if ( ssl_session == null)
                 return null;
             StringBuilder buf=new StringBuilder();
             for(int x=0; x<ssl_session.length; x++) {
@@ -587,14 +587,14 @@ class SslChannel extends IOChannel imple
             }
             return buf.toString();
         }
-        
+
         if (net != null) {
             return net.getAttribute(name);
         }
-        return null;        
+        return null;
     }
-    
-    
+
+
      /**
       * Simple data class that represents the cipher being used, along with the
       * corresponding effective key size.  The specified phrase must appear in the
@@ -613,8 +613,8 @@ class SslChannel extends IOChannel imple
          }
 
      }
-     
-    
+
+
      /**
       * A mapping table to determine the number of effective bits in the key
       * when using a cipher suite containing the specified cipher name.  The
@@ -632,5 +632,5 @@ class SslChannel extends IOChannel imple
          new CipherData("_WITH_AES_128_CBC_", 128),
          new CipherData("_WITH_AES_256_CBC_", 256)
      };
-          
+
 }

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/CopyCallback.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/CopyCallback.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/CopyCallback.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/CopyCallback.java Sat Oct 22 21:30:59 2011
@@ -11,12 +11,12 @@ import org.apache.tomcat.lite.io.IOChann
 import org.apache.tomcat.lite.io.IOConnector;
 
 /**
- *  Used by socks and http proxy. Will copy received data to a different 
+ *  Used by socks and http proxy. Will copy received data to a different
  *  channel.
  */
 public class CopyCallback implements IOConnector.DataReceivedCallback {
         IOChannel mOutBuffer;
-        
+
         public CopyCallback(IOChannel sc) {
             mOutBuffer = sc;
         }
@@ -27,7 +27,7 @@ public class CopyCallback implements IOC
             IOChannel outBuffer = mOutBuffer;
             if (outBuffer == null &&
                     ch instanceof HttpChannel) {
-                outBuffer = 
+                outBuffer =
                     (IOChannel) ((HttpChannel)ch).getRequest().getAttribute("P");
             }
             // body.
@@ -52,6 +52,6 @@ public class CopyCallback implements IOC
                     outBuffer.startSending();
                     return;
                 }
-            }            
+            }
         }
     }
\ No newline at end of file

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/HttpProxyService.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/HttpProxyService.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/HttpProxyService.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/HttpProxyService.java Sat Oct 22 21:30:59 2011
@@ -19,62 +19,62 @@ import org.apache.tomcat.lite.io.IOConne
 import org.apache.tomcat.lite.io.CBuffer;
 import org.apache.tomcat.lite.io.SocketConnector;
 
-/** 
- * Http callback for the server-side. Will forward all requests to 
- * a remote http server - either using proxy mode ( GET http://... ) or 
+/**
+ * Http callback for the server-side. Will forward all requests to
+ * a remote http server - either using proxy mode ( GET http://... ) or
  * forward requests ( GET /foo -> will be served by the remote server ).
- * 
+ *
  * This is not blocking (except the connect, which currenly blocks on dns).
  */
 public class HttpProxyService implements HttpService {
 
-    // target - when used in forwarding mode. 
+    // target - when used in forwarding mode.
     String target = "localhost";
     int port = 8802;
-    
+
     static Logger log = Logger.getLogger("HttpProxy");
     public static boolean debug = false;
     boolean keepOpen = true;
-    
+
     // client side - this connect to the real server that generates the resp.
     ProxyClientCallback clientHeadersReceived = new ProxyClientCallback();
 
     HttpConnector httpConnector;
     IOConnector ioConnector;
-    
+
     public HttpProxyService withSelector(IOConnector pool) {
         this.ioConnector = pool;
         return this;
     }
-    
+
     public HttpProxyService withHttpClient(HttpConnector pool) {
         this.httpConnector = pool;
         return this;
     }
-    
+
     public HttpProxyService withTarget(String host, int port) {
         this.target = host;
         this.port = port;
         return this;
     }
-    
-    private IOConnector getSelector() { 
+
+    private IOConnector getSelector() {
         if (ioConnector == null) {
-            ioConnector = new SocketConnector(); 
+            ioConnector = new SocketConnector();
         }
         return ioConnector;
     }
 
-    private HttpConnector getHttpConnector() { 
+    private HttpConnector getHttpConnector() {
         if (httpConnector == null) {
             httpConnector = new HttpConnector(getSelector());
         }
         return httpConnector;
     }
-    
-    // Connects to the target CONNECT server, as client, forwards 
+
+    // Connects to the target CONNECT server, as client, forwards
     static class ProxyConnectClientConnection implements IOConnector.ConnectedCallback {
-        
+
         IOChannel serverNet;
         private HttpChannel serverHttp;
 
@@ -91,17 +91,17 @@ public class HttpProxyService implements
                 return;
             }
             afterClientConnect(ioch);
-            
+
             ioch.setDataReceivedCallback(new CopyCallback(serverNet));
             //ioch.setDataFlushedCallback(new ProxyFlushedCallback(serverNet, ioch));
             serverNet.setDataReceivedCallback(new CopyCallback(ioch));
             //serverNet.setDataFlushedCallback(new ProxyFlushedCallback(ioch, serverNet));
 
             ioch.sendHandleReceivedCallback();
-        }        
-        
+        }
+
         static byte[] OK = "HTTP/1.1 200 OK\r\n\r\n".getBytes();
-        
+
         protected void afterClientConnect(IOChannel clientCh) throws IOException {
             serverNet.getOut().queue(OK);
             serverNet.startSending();
@@ -109,17 +109,17 @@ public class HttpProxyService implements
             serverHttp.release(); // no longer used
         }
     }
-    
+
     /**
      * Parse the req, dispatch the connection.
      */
     @Override
-    public void service(HttpRequest serverHttpReq, HttpResponse serverHttpRes) 
+    public void service(HttpRequest serverHttpReq, HttpResponse serverHttpRes)
             throws IOException {
-        
+
         String dstHost = target; // default target ( for normal req ).
         int dstPort = port;
-        
+
         // TODO: more flexibility/callbacks on selecting the target, acl, etc
         if (serverHttpReq.method().equals("CONNECT")) {
             // SSL proxy - just connect and forward all packets
@@ -132,14 +132,14 @@ public class HttpProxyService implements
             }
             if (log.isLoggable(Level.FINE)) {
                 HttpChannel server = serverHttpReq.getHttpChannel();
-                log.info("NEW: " + server.getId() + " " + dstHost + " "  + 
-                        server.getRequest().getMethod() + 
+                log.info("NEW: " + server.getId() + " " + dstHost + " "  +
+                        server.getRequest().getMethod() +
                         " " + server.getRequest().getRequestURI() + " " +
                         server.getIn());
             }
-    
+
             try {
-                getSelector().connect(host, port, 
+                getSelector().connect(host, port,
                         new ProxyConnectClientConnection(serverHttpReq.getHttpChannel()));
             } catch (IOException e) {
                 // TODO Auto-generated catch block
@@ -147,8 +147,8 @@ public class HttpProxyService implements
             }
             return;
         }
-        
-        
+
+
         CBuffer origURIx = serverHttpReq.requestURI();
 //        String origURI = origURIx.toString();
 //        if (origURI.startsWith("http://")) {
@@ -161,7 +161,7 @@ public class HttpProxyService implements
 //            String[] hostPort = hostPortS.split(":");
 //
 //            dstHost = hostPort[0];
-//            dstPort = (hostPort.length > 1) ? Integer.parseInt(hostPort[1]) : 
+//            dstPort = (hostPort.length > 1) ? Integer.parseInt(hostPort[1]) :
 //                80;
 //
 //            if (start >= 0) {
@@ -171,7 +171,7 @@ public class HttpProxyService implements
 //            }
 //        } else {
             // Adjust the host header.
-            CBuffer hostHdr = 
+            CBuffer hostHdr =
                 serverHttpReq.getMimeHeaders().getHeader("host");
             if (hostHdr != null) {
                 hostHdr.recycle();
@@ -185,52 +185,52 @@ public class HttpProxyService implements
 //        }
         if (debug) {
             HttpChannel server = serverHttpReq.getHttpChannel();
-            log.info("START: " + server.getId() + " " + dstHost + " "  + 
-                    server.getRequest().getMethod() + 
+            log.info("START: " + server.getId() + " " + dstHost + " "  +
+                    server.getRequest().getMethod() +
                     " " + server.getRequest().getRequestURI() + " " +
                     server.getIn());
         }
-        
+
         // Send the request with a non-blocking write
-        HttpChannel serverHttp = serverHttpReq.getHttpChannel(); 
-        
+        HttpChannel serverHttp = serverHttpReq.getHttpChannel();
+
         // Client connection
         HttpChannel httpClient = getHttpConnector().get(dstHost, dstPort);
-        
+
         serverHttp.getRequest().setAttribute("CLIENT", httpClient);
         httpClient.getRequest().setAttribute("SERVER", serverHttp);
         serverHttp.getRequest().setAttribute("P", httpClient);
         httpClient.getRequest().setAttribute("P", serverHttp);
-        
+
         httpClient.setHttpService(clientHeadersReceived);
-        
-        // Will send the original request (TODO: small changes) 
+
+        // Will send the original request (TODO: small changes)
         // Response is not affected ( we use the callback )
         httpClient.getRequest().method().set(serverHttp.getRequest().method());
         httpClient.getRequest().requestURI().set(serverHttp.getRequest().requestURI());
         if (serverHttp.getRequest().queryString().length() != 0) {
             httpClient.getRequest().queryString().set(serverHttp.getRequest().queryString());
         }
-        
+
         httpClient.getRequest().protocol().set(serverHttp.getRequest().protocol());
-        
+
         //cstate.reqHeaders.addValue(name)
-        copyHeaders(serverHttp.getRequest().getMimeHeaders(), 
+        copyHeaders(serverHttp.getRequest().getMimeHeaders(),
                 httpClient.getRequest().getMimeHeaders() /*dest*/);
-        
+
         // For debug
         httpClient.getRequest().getMimeHeaders().remove("Accept-Encoding");
-        
+
         if (!keepOpen) {
             httpClient.getRequest().getMimeHeaders().setValue("Connection").set("Close");
         }
-        
+
         // Any data
         serverHttp.setDataReceivedCallback(copy);
         copy.handleReceived(serverHttp);
 
         httpClient.send();
-        
+
 
         //serverHttp.handleReceived(serverHttp.getSink());
         //httpClient.flush(); // send any data still there
@@ -238,14 +238,14 @@ public class HttpProxyService implements
         httpClient.setCompletedCallback(done);
         // Will call release()
         serverHttp.setCompletedCallback(done);
-        
+
         serverHttpReq.async();
     }
-    
+
     static HttpDoneCallback done = new HttpDoneCallback();
     static CopyCallback copy = new CopyCallback(null);
     // POST: after sendRequest(ch) we need to forward the body !!
-    
+
 
     static void copyHeaders(MultiMap mimeHeaders, MultiMap dest)
             throws IOException {
@@ -256,38 +256,38 @@ public class HttpProxyService implements
         }
     }
 
-    /** 
+    /**
      * HTTP _CLIENT_ callback - from tomcat to final target.
      */
     public class ProxyClientCallback implements HttpService {
-        /** 
+        /**
          * Headers received from the client (content http server).
          * TODO: deal with version missmatches.
          */
         @Override
         public void service(HttpRequest clientHttpReq, HttpResponse clientHttpRes) throws IOException {
-            HttpChannel serverHttp = (HttpChannel) clientHttpReq.getAttribute("SERVER"); 
-            
+            HttpChannel serverHttp = (HttpChannel) clientHttpReq.getAttribute("SERVER");
+
             try {
                 serverHttp.getResponse().setStatus(clientHttpRes.getStatus());
                 serverHttp.getResponse().getMessageBuffer().set(clientHttpRes.getMessageBuffer());
-                copyHeaders(clientHttpRes.getMimeHeaders(), 
+                copyHeaders(clientHttpRes.getMimeHeaders(),
                         serverHttp.getResponse().getMimeHeaders());
-                
+
                 serverHttp.getResponse().getMimeHeaders().addValue("TomcatProxy").set("True");
 
                 clientHttpReq.getHttpChannel().setDataReceivedCallback(copy);
                 copy.handleReceived(clientHttpReq.getHttpChannel());
 
                 serverHttp.startSending();
-                
-                
+
+
                 //clientHttpReq.flush(); // send any data still there
-                
+
                 //  if (clientHttpReq.getHttpChannel().getIn().isClosedAndEmpty()) {
                 //     serverHttp.getOut().close(); // all data from client already in buffers
                 //  }
-                
+
             } catch (IOException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
@@ -302,13 +302,13 @@ public class HttpProxyService implements
 
         @Override
         public void handle(HttpChannel doneCh, Object extraData) throws IOException {
-            HttpChannel serverCh = 
+            HttpChannel serverCh =
                 (HttpChannel) doneCh.getRequest().getAttribute("SERVER");
             HttpChannel clientCh = doneCh;
             String tgt = "C";
             if (serverCh == null) {
                  serverCh = doneCh;
-                 clientCh = 
+                 clientCh =
                     (HttpChannel) doneCh.getRequest().getAttribute("CLIENT");
                  tgt = "S";
             }
@@ -320,34 +320,34 @@ public class HttpProxyService implements
                 clientCh.abort("Proxy error");
                 return;
             }
-            
+
             if (log.isLoggable(Level.FINE)) {
-                HttpChannel peerCh = 
-                    (HttpChannel) doneCh.getRequest().getAttribute("SERVER"); 
+                HttpChannel peerCh =
+                    (HttpChannel) doneCh.getRequest().getAttribute("SERVER");
                 if (peerCh == null) {
-                    peerCh = 
+                    peerCh =
                         (HttpChannel) doneCh.getRequest().getAttribute("CLIENT");
                 } else {
-                    
+
                 }
                 log.info(tgt + " " + peerCh.getId() + " " +
                         doneCh.getTarget() + " " +
-                        doneCh.getRequest().getMethod() + 
+                        doneCh.getRequest().getMethod() +
                         " " + doneCh.getRequest().getRequestURI() + " " +
                         doneCh.getResponse().getStatus() + " IN:" + doneCh.getIn()
-                        + " OUT:" + doneCh.getOut() + 
-                        " SIN:" + peerCh.getIn() +  
-                        " SOUT:" + peerCh.getOut() ); 
+                        + " OUT:" + doneCh.getOut() +
+                        " SIN:" + peerCh.getIn() +
+                        " SOUT:" + peerCh.getOut() );
             }
             // stop forwarding. After this call the client object will be
             // recycled
             //clientCB.outBuffer = null;
-            
+
             // We must releaes both at same time
             synchronized (this) {
-                
+
                 serverCh.complete();
-                
+
                 if (clientCh.getRequest().getAttribute("SERVER") == null) {
                     return;
                 }
@@ -364,5 +364,5 @@ public class HttpProxyService implements
         }
     }
 
-    
+
 }

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/ProxyFlushedCallback.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/ProxyFlushedCallback.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/ProxyFlushedCallback.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/ProxyFlushedCallback.java Sat Oct 22 21:30:59 2011
@@ -9,7 +9,7 @@ import org.apache.tomcat.lite.io.IOConne
 
 public final class ProxyFlushedCallback implements IOConnector.DataFlushedCallback {
     IOChannel peerCh;
-    
+
     public ProxyFlushedCallback(IOChannel ch2, IOChannel clientChannel2) {
         peerCh = ch2;
     }

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/SocksServer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/SocksServer.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/SocksServer.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/SocksServer.java Sat Oct 22 21:30:59 2011
@@ -22,54 +22,54 @@ import org.apache.tomcat.lite.io.IOConne
 import org.apache.tomcat.lite.io.SocketConnector;
 
 /**
- * A test for the selector package, and helper for the proxy - 
+ * A test for the selector package, and helper for the proxy -
  * a SOCKS4a server.
- * 
- * Besides the connection initialization, it's almost the 
+ *
+ * Besides the connection initialization, it's almost the
  *  same as the CONNECT method in http proxy.
- * 
+ *
  * http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol
  * http://www.smartftp.com/Products/SmartFTP/RFC/socks4a.protocol
  * http://www.faqs.org/rfcs/rfc1928.html
  * https://svn.torproject.org/svn/tor/trunk/doc/spec/socks-extensions.txt
- * 
+ *
  * In firefox, set network.proxy.socks_remote_dns = true to do DNS via proxy.
- * 
+ *
  * Also interesting:
  * http://transocks.sourceforge.net/
- * 
+ *
  * @author Costin Manolache
  */
 public class SocksServer implements Runnable, IOConnector.ConnectedCallback {
     protected int port = 2080;
-    
+
     protected IOConnector ioConnector;
     protected static Logger log = Logger.getLogger("SocksServer");
-    
-    protected long idleTimeout = 10 * 60000; // 10 min 
-    
+
+    protected long idleTimeout = 10 * 60000; // 10 min
+
     protected long lastConnection = 0;
     protected long totalConTime = 0;
     protected AtomicInteger totalConnections = new AtomicInteger();
-    
+
     protected AtomicInteger active = new AtomicInteger();
-    
+
     protected long inBytes;
     protected long outBytes;
     protected static int sockets;
-    
+
     public int getPort() {
         return port;
     }
-    
+
     public int getActive() {
         return active.get();
     }
-    
+
     public int getTotal() {
         return totalConnections.get();
     }
-    
+
     public void setPort(int port) {
         this.port = port;
     }
@@ -83,46 +83,46 @@ public class SocksServer implements Runn
         final SocksServerConnection socksCon = new SocksServerConnection(accepted);
         socksCon.pool = ioConnector;
         socksCon.server = this;
-        
+
         accepted.setDataReceivedCallback(socksCon);
         socksCon.handleReceived(accepted);
     }
 
-    /** 
-     * Exit if no activity happens. 
+    /**
+     * Exit if no activity happens.
      */
     public void setIdleTimeout(long to) {
         idleTimeout = to;
     }
-    
+
     public long getIdleTimeout() {
         return idleTimeout;
     }
-    
+
     public void stop() {
         ioConnector.stop();
     }
-    
+
     public void initServer() throws IOException {
         if (ioConnector == null) {
             ioConnector = new SocketConnector();
         }
         ioConnector.acceptor(this, Integer.toString(port), null);
-        
+
         final Timer timer = new Timer(true /* daemon */);
         timer.scheduleAtFixedRate(new TimerTask() {
             @Override
             public void run() {
                 try {
                 // if lastConnection == 0 - it'll terminate on first timer
-                float avg = (totalConnections.get() > 0) ? 
+                float avg = (totalConnections.get() > 0) ?
                         totalConTime / totalConnections.get() : 0;
-                System.err.println("Socks:" 
+                System.err.println("Socks:"
                         + "\ttotal=" + totalConnections
-                        + "\tin=" + inBytes  
+                        + "\tin=" + inBytes
                         + "\tout=" + outBytes
                         + "\tavg=" + (int) avg);
-                if (active.get() <= 0 
+                if (active.get() <= 0
                         && idleTimeout > 0
                         && System.currentTimeMillis() - lastConnection > idleTimeout) {
                     System.err.println("Idle timeout");
@@ -135,21 +135,21 @@ public class SocksServer implements Runn
                 }
             }
         }, 5 * 60 * 1000, 5 * 60 * 1000); // 5
-        
-        
+
+
     }
 
 
     public static class SocksServerConnection implements IOConnector.DataReceivedCallback, IOConnector.ConnectedCallback {
-        
+
         protected SocksServer server;
 
         boolean headReceived;
         boolean head5Received = false;
-        
+
         ByteBuffer headBuffer = ByteBuffer.allocate(256);
         ByteBuffer headReadBuffer = headBuffer.duplicate();
-        
+
         ByteBuffer headResBuffer = ByteBuffer.allocate(256);
         IOConnector pool;
         byte ver;
@@ -158,18 +158,18 @@ public class SocksServer implements Runn
 
         static final int CMD_CONNECT = 0;
         static final byte CMD_RESOLVE = (byte) 0xF0;
-        
+
         int port;
         byte[] hostB = new byte[4];
         CharBuffer userId = CharBuffer.allocate(256);
         CharBuffer hostName = CharBuffer.allocate(256);
-        
+
         SocketAddress sa = null;
 
         private byte atyp;
 
         IOChannel serverCh;
-        
+
         public SocksServerConnection(IOChannel accepted) {
             this.serverCh = accepted;
         }
@@ -187,17 +187,17 @@ public class SocksServer implements Runn
                 headResBuffer.put((byte) 0);
                 headResBuffer.put((byte) 0);
                 headResBuffer.put((byte) 1); // ip
-                
+
                 headResBuffer.put(hostB);
                 int port2 = (Integer) clientCh.getAttribute(IOChannel.ATT_REMOTE_PORT);
                 headResBuffer.putShort((short) port2);
             }
-            
+
             headResBuffer.flip();
-            
+
             serverCh.getOut().queue(headResBuffer);
             log.fine("Connected " + sa.toString());
-            
+
             if (headReadBuffer.remaining() > 0) {
                 serverCh.getOut().queue(headReadBuffer);
             }
@@ -212,7 +212,7 @@ public class SocksServer implements Runn
                 server.active.set(0);
             }
 //            System.err.println(sa + "\tsR:" +
-//                    received 
+//                    received
 //                    + "\tcR:" + clientReceived
 //                    + "\tactive:" + a
 //                    + "\ttotC:" + server.totalConnections
@@ -222,16 +222,16 @@ public class SocksServer implements Runn
 //            server.outBytes += clientReceived;
         }
 
-        
+
         protected int parseHead() throws IOException {
-            // data is between 0 and pos. 
+            // data is between 0 and pos.
             int pos = headBuffer.position();
             headReadBuffer.clear();
             headReadBuffer.limit(pos);
             if (headReadBuffer.remaining() < 2) {
                 return -1;
             }
-            
+
             ByteBuffer bb = headReadBuffer;
             ver = bb.get();
             if (ver == 5) {
@@ -260,23 +260,23 @@ public class SocksServer implements Runn
             } else {
                 atyp = 1;
             }
-            
+
             headReceived = true;
-            
+
             return 4;
         }
 
         protected int parseHead5_2() throws IOException {
-            // data is between 0 and pos. 
+            // data is between 0 and pos.
             int pos = headBuffer.position();
-            
+
             headReadBuffer.clear();
             headReadBuffer.limit(pos);
-            
+
             if (headReadBuffer.remaining() < 7) {
                 return -1;
             }
-            
+
             ByteBuffer bb = headReadBuffer;
             ver = bb.get();
             cmd = bb.get();
@@ -291,11 +291,11 @@ public class SocksServer implements Runn
                     return rc;
                 }
             } // ip6 not supported right now, easy to add
-            
+
             port = bb.getShort();
-            
+
             head5Received = true;
-            
+
             return 5;
         }
 
@@ -306,7 +306,7 @@ public class SocksServer implements Runn
                 return -1;
             }
             for (int i = 0; i < nrMethods; i++) {
-                // ignore 
+                // ignore
                 bb.get();
             }
             return 5;
@@ -341,18 +341,18 @@ public class SocksServer implements Runn
             bc.flip();
             return len;
         }
-        
+
         static ExecutorService connectTP = Executors.newCachedThreadPool();
-        
+
         protected void startClientConnection() throws IOException {
             // TODO: use different thread ?
             if (atyp == 3) {
                 connectTP.execute(new Runnable() {
-                    
+
                     public void run() {
                         try {
                             sa = new InetSocketAddress(hostName.toString(), port);
-                            pool.connect(hostName.toString(), port, 
+                            pool.connect(hostName.toString(), port,
                                     SocksServerConnection.this);
                         } catch (Exception ex) {
                             log.severe("Error connecting");
@@ -361,10 +361,10 @@ public class SocksServer implements Runn
                 });
             } else {
                 InetAddress addr = InetAddress.getByAddress(hostB);
-                pool.connect(addr.toString(), port, this); 
+                pool.connect(addr.toString(), port, this);
             } // TODO: ip6
         }
-        
+
         public void handleConnected(IOChannel ioch) throws IOException {
             ioch.setDataReceivedCallback(new CopyCallback(serverCh));
             //ioch.setDataFlushedCallback(new ProxyFlushedCallback(serverCh, ioch));
@@ -375,7 +375,7 @@ public class SocksServer implements Runn
             afterClientConnect(ioch);
 
             ioch.sendHandleReceivedCallback();
-        }        
+        }
 
 
         @Override
@@ -390,7 +390,7 @@ public class SocksServer implements Runn
                     if (rd == -1) {
                         ch.close();
                     }
-                    
+
                     rd = parseHead();
                     if (rd < 0) {
                         return; // need more
@@ -411,7 +411,7 @@ public class SocksServer implements Runn
                         startClientConnection();
                     }
                 }
-                
+
                 if (!head5Received) {
                     int rd = ch.read(headBuffer);
                     if (rd == 0) {
@@ -420,17 +420,17 @@ public class SocksServer implements Runn
                     if (rd == -1) {
                         ch.close();
                     }
-                    
+
                     rd = parseHead5_2();
                     if (rd < 0) {
                         return; // need more
                     }
-                    
-                    startClientConnection();                
+
+                    startClientConnection();
                 }
-        }        
+        }
     }
-    
+
     @Override
     public void run() {
         try {

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/StaticContentService.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/StaticContentService.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/StaticContentService.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/proxy/StaticContentService.java Sat Oct 22 21:30:59 2011
@@ -5,9 +5,9 @@
  * 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.
@@ -28,22 +28,22 @@ import org.apache.tomcat.lite.io.BBucket
 import org.apache.tomcat.lite.io.IOBuffer;
 
 /*
- * 
- * Serve static content, from memory. 
+ *
+ * Serve static content, from memory.
  */
 public class StaticContentService implements HttpService  {
     protected Logger log = Logger.getLogger("coyote.static");
     protected BBucket mb;
-    
+
     protected boolean chunked = false;
     int code = 200;
-    
+
     protected String contentType = "text/plain";
 
 
     public StaticContentService() {
     }
-    
+
     /**
      * Used for testing chunked encoding.
      * @return
@@ -56,8 +56,8 @@ public class StaticContentService implem
     public StaticContentService setData(byte[] data) {
         mb = BBuffer.wrapper(data, 0, data.length);
         return this;
-    }    
-    
+    }
+
     public StaticContentService setStatus(int status) {
         this.code = status;
         return this;
@@ -71,7 +71,7 @@ public class StaticContentService implem
         mb = BBuffer.wrapper(data, 0, data.length);
         return this;
       }
-      
+
 
     public StaticContentService setData(CharSequence data) {
       try {
@@ -81,18 +81,18 @@ public class StaticContentService implem
       } catch (IOException e) {
       }
       return this;
-    }    
+    }
 
     public StaticContentService setContentType(String ct) {
       this.contentType = ct;
       return this;
     }
-    
+
     public void setFile(String path) {
       try {
         FileInputStream fis = new FileInputStream(path);
         BBuffer bc = BBuffer.allocate(4096);
-        
+
         byte b[] = new byte[4096];
         int rd = 0;
         while ((rd = fis.read(b)) > 0) {
@@ -103,20 +103,20 @@ public class StaticContentService implem
         throw new RuntimeException(e);
       }
     }
-    
+
     @Override
     public void service(HttpRequest httpReq, HttpResponse res) throws IOException {
-       
+
         res.setStatus(code);
-      
+
           if (!chunked) {
             res.setContentLength(mb.remaining());
           }
           res.setContentType(contentType);
-      
+
           int len = mb.remaining();
           int first = 0;
-          
+
           if (chunked) {
               first = len / 2;
               res.getBody()

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/IOStatus.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/IOStatus.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/IOStatus.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/IOStatus.java Sat Oct 22 21:30:59 2011
@@ -24,13 +24,13 @@ public class IOStatus implements HttpSer
     public IOStatus(HttpConnectionPool pool) {
         this.pool = pool;
     }
-    
+
     @Override
     public void service(HttpRequest httpReq, HttpResponse httpRes)
             throws IOException {
         HttpConnectionPool sc = pool;
         HttpWriter out = httpRes.getBodyWriter();
-        
+
         httpRes.setContentType("text/plain");
         // TODO: use JMX/DynamicObject to get all public info
         out.println("hosts=" + sc.getTargetCount());
@@ -45,7 +45,7 @@ public class IOStatus implements HttpSer
             out.println(Integer.toString(connections.size()));
 
             for (IOChannel ch: connections) {
-                out.println(ch.getId() + 
+                out.println(ch.getId() +
                         " " + ch.toString());
             }
             out.println();

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/LogConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/LogConfig.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/LogConfig.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/service/LogConfig.java Sat Oct 22 21:30:59 2011
@@ -6,15 +6,15 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */ 
+ */
 
 package org.apache.tomcat.lite.service;
 
@@ -28,14 +28,14 @@ import org.apache.tomcat.lite.http.HttpC
 
 /**
  * Log configuration
- * 
+ *
  */
 public class LogConfig implements HttpService {
-    
+
     /**
      * Framework can set this attribute with comma separated
      * list of loggers to set to debug level.
-     * This is used at startup. 
+     * This is used at startup.
      */
     public void setDebug(String debug) {
         for (String log : debug.split(",")) {
@@ -45,7 +45,7 @@ public class LogConfig implements HttpSe
     }
 
     /**
-     * 
+     *
      */
     public void setWarn(String nodebug) {
         for (String log : nodebug.split(",")) {

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/FastHttpDateFormat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/FastHttpDateFormat.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/FastHttpDateFormat.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/FastHttpDateFormat.java Sat Oct 22 21:30:59 2011
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHa
 
 /**
  * Utility class to generate HTTP dates.
- * 
+ *
  * @author Remy Maucherat
  */
 public final class FastHttpDateFormat {
@@ -36,14 +36,14 @@ public final class FastHttpDateFormat {
     // -------------------------------------------------------------- Variables
 
 
-    protected static final int CACHE_SIZE = 
+    protected static final int CACHE_SIZE =
         Integer.parseInt(System.getProperty("org.apache.tomcat.util.http.FastHttpDateFormat.CACHE_SIZE", "1000"));
 
-    
+
     /**
      * HTTP date format.
      */
-    protected static final SimpleDateFormat format = 
+    protected static final SimpleDateFormat format =
         new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
 
 
@@ -89,14 +89,14 @@ public final class FastHttpDateFormat {
     /**
      * Formatter cache.
      */
-    protected static final ConcurrentHashMap<Long, String> formatCache = 
+    protected static final ConcurrentHashMap<Long, String> formatCache =
         new ConcurrentHashMap<Long, String>(CACHE_SIZE);
 
 
     /**
      * Parser cache.
      */
-    protected static final ConcurrentHashMap<String, Long> parseCache = 
+    protected static final ConcurrentHashMap<String, Long> parseCache =
         new ConcurrentHashMap<String, Long>(CACHE_SIZE);
 
 
@@ -154,7 +154,7 @@ public final class FastHttpDateFormat {
     /**
      * Try to parse the given date as a HTTP date.
      */
-    public static final long parseDate(String value, 
+    public static final long parseDate(String value,
                                        DateFormat[] threadLocalformats) {
 
         Long cachedDate = parseCache.get(value);

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/LocaleParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/LocaleParser.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/LocaleParser.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/LocaleParser.java Sat Oct 22 21:30:59 2011
@@ -5,9 +5,9 @@
  * 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.
@@ -133,7 +133,7 @@ public final class LocaleParser {
 
       return locales;
     }
-    
+
     /**
      * The characters of the current string, as a character array.  Stored
      * when the string is first specified to speed up access to characters

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/MimeMap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/MimeMap.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/MimeMap.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/MimeMap.java Sat Oct 22 21:30:59 2011
@@ -32,7 +32,7 @@ public class MimeMap implements FileName
 
     // Defaults - all of them are "well-known" types,
     // you can add using normal web.xml.
-    
+
     public static Hashtable<String,String> defaultMap =
         new Hashtable<String,String>(101);
     static {
@@ -121,11 +121,11 @@ public class MimeMap implements FileName
         defaultMap.put("avx", "video/x-rad-screenplay");
         defaultMap.put("wrl", "x-world/x-vrml");
         defaultMap.put("mpv2", "video/mpeg2");
-        
+
         /* Add XML related MIMEs */
-        
+
         defaultMap.put("xml", "text/xml");
-        defaultMap.put("xsl", "text/xml");        
+        defaultMap.put("xsl", "text/xml");
         defaultMap.put("svg", "image/svg+xml");
         defaultMap.put("svgz", "image/svg+xml");
         defaultMap.put("wbmp", "image/vnd.wap.wbmp");
@@ -134,7 +134,7 @@ public class MimeMap implements FileName
         defaultMap.put("wmls", "text/vnd.wap.wmlscript");
         defaultMap.put("wmlscriptc", "application/vnd.wap.wmlscriptc");
     }
-    
+
 
     private Hashtable<String,String> map = new Hashtable<String,String>();
 
@@ -149,7 +149,7 @@ public class MimeMap implements FileName
     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 );
@@ -166,7 +166,7 @@ public class MimeMap implements FileName
         // play it safe and get rid of any fragment id
         // that might be there
         int length=fileName.length();
-        
+
         int newEnd = fileName.lastIndexOf('#');
         if( newEnd== -1 ) newEnd=length;
         // Instead of creating a new string.
@@ -181,7 +181,7 @@ public class MimeMap implements FileName
             return null;
         }
     }
-    
+
     public String getContentTypeFor(String fileName) {
         String extn=getExtension( fileName );
         if (extn!=null) {

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/Range.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/Range.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/Range.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/Range.java Sat Oct 22 21:30:59 2011
@@ -21,16 +21,16 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.StringTokenizer;
 
-/** 
- * Utils to process HTTP/1.1 ranges. Used by default servlet, could 
+/**
+ * Utils to process HTTP/1.1 ranges. Used by default servlet, could
  * be used by any servlet that needs to deal with ranges.
- * 
+ *
  * It is very good to support ranges if you have large content. In most
  * cases supporting one range is enough - getting multiple ranges doesn't
  * seem very common, and it's complex (multipart response).
- * 
+ *
  * @author Costin Manolache
- * @author Remy Maucherat 
+ * @author Remy Maucherat
  * @author - see DefaultServlet in Catalin for other contributors
  */
 public class Range {
@@ -54,12 +54,12 @@ public class Range {
         end = 0;
         length = 0;
     }
-    
-    /** Parse ranges. 
-     * 
+
+    /** Parse ranges.
+     *
      * @return null if the range is invalid or can't be parsed
      */
-    public static ArrayList parseRanges(long fileLength, 
+    public static ArrayList parseRanges(long fileLength,
                                         String rangeHeader) throws IOException {
         ArrayList result = new ArrayList();
         StringTokenizer commaTokenizer = new StringTokenizer(rangeHeader, ",");
@@ -112,7 +112,7 @@ public class Range {
 
     /**
      * Parse the Content-Range header. Used with PUT or in response.
-     * 
+     *
      * @return Range
      */
     public static Range parseContentRange(String rangeHeader)

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/URLEncoder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/URLEncoder.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/URLEncoder.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/URLEncoder.java Sat Oct 22 21:30:59 2011
@@ -5,9 +5,9 @@
  * 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.
@@ -26,7 +26,7 @@ import java.util.BitSet;
  *
  * This class is very similar to the java.net.URLEncoder class.
  *
- * Unfortunately, with java.net.URLEncoder there is no way to specify to the 
+ * Unfortunately, with java.net.URLEncoder there is no way to specify to the
  * java.net.URLEncoder which characters should NOT be encoded.
  *
  * This code was moved from DefaultServlet.java
@@ -80,7 +80,7 @@ public class URLEncoder {
 
     public String encodeURL(String path, String enc, boolean allowSlash) {
         int maxBytesPerChar = 10;
-        
+
         StringBuffer rewrittenPath = new StringBuffer(path.length());
         ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar);
         OutputStreamWriter writer = null;
@@ -89,7 +89,7 @@ public class URLEncoder {
         } catch (UnsupportedEncodingException e1) {
             // shouldn't happen.
         }
-        
+
         for (int i = 0; i < path.length(); i++) {
             int c = (int) path.charAt(i);
             if (c < 128 && safeChars.get(c) || allowSlash && c == '/') {
@@ -127,7 +127,7 @@ public class URLEncoder {
         }
         return rewrittenPath.toString();
     }
-    
+
     /**
      * Decode and return the specified URL-encoded String.
      *
@@ -156,8 +156,8 @@ public class URLEncoder {
         return URLDecode(bytes, enc);
 
     }
-    
-    
+
+
     /**
      * Decode and return the specified URL-encoded String.
      * When the byte array is converted to a string, the system default
@@ -174,7 +174,7 @@ public class URLEncoder {
         return URLDecode(str, null);
 
     }
-    
+
     /**
      * Decode and return the specified URL-encoded byte array.
      *
@@ -211,7 +211,7 @@ public class URLEncoder {
         return new String(bytes, 0, ox);
 
     }
-    
+
     /**
      * Convert a byte character value to hexidecimal digit value.
      *
@@ -223,5 +223,5 @@ public class URLEncoder {
         if ((b >= 'A') && (b <= 'F')) return (byte)(b - 'A' + 10);
         return 0;
     }
-    
+
 }

Modified: tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/UrlUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/UrlUtils.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/UrlUtils.java (original)
+++ tomcat/trunk/modules/tomcat-lite/java/org/apache/tomcat/lite/util/UrlUtils.java Sat Oct 22 21:30:59 2011
@@ -20,7 +20,7 @@ package org.apache.tomcat.lite.util;
 public class UrlUtils {
 
     /** Used by webdav.
-     * 
+     *
      * Return a context-relative path, beginning with a "/", that represents
      * the canonical version of the specified path after ".." and "." elements
      * are resolved out.  If the specified path attempts to go outside the
@@ -43,7 +43,7 @@ public class UrlUtils {
         // Normalize the slashes and add leading slash if necessary
         if (normalized.indexOf('\\') >= 0)
             normalized = normalized.replace('\\', '/');
-        
+
         if (!normalized.startsWith("/"))
             normalized = "/" + normalized;
 

Modified: tomcat/trunk/modules/tomcat-lite/pom.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/pom.xml?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/pom.xml (original)
+++ tomcat/trunk/modules/tomcat-lite/pom.xml Sat Oct 22 21:30:59 2011
@@ -1,11 +1,11 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  
+
   <groupId>org.apache.tomcat.lite</groupId>
   <artifactId>lite</artifactId>
-  
+
   <version>0.0.1-SNAPSHOT</version>
-  
+
   <dependencies>
         <dependency>
                 <groupId>com.jcraft</groupId>
@@ -53,7 +53,7 @@
                 <version>6.0.20</version>
                 <type>jar</type>
                 <scope>compile</scope>
-        </dependency>  
+        </dependency>
         <dependency>
                 <groupId>asm</groupId>
                 <artifactId>asm</artifactId>
@@ -79,11 +79,11 @@
         	<version>1.7.1</version>
         </dependency>
   </dependencies>
-   
+
    <build>
-  
+
     <sourceDirectory>java</sourceDirectory>
-    
+
     <testSourceDirectory>test</testSourceDirectory>
 
     <plugins>

Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/ServletTests.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/ServletTests.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/ServletTests.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/coyote/lite/ServletTests.java Sat Oct 22 21:30:59 2011
@@ -12,17 +12,17 @@ import org.apache.tomcat.test.watchdog.W
 
 import junit.framework.Test;
 
-/** 
+/**
  * Wrapper to run watchdog.
- * 
+ *
  */
 public class ServletTests extends WatchdogClient {
 
-    
+
     public ServletTests() {
         super();
         goldenDir = getWatchdogdir() + "/src/clients/org/apache/jcheck/servlet/client/";
-        testMatch = 
+        testMatch =
             //"HttpServletResponseWrapperSetStatusMsgTest";
             //"ServletContextAttributeAddedEventTest";
             null;
@@ -40,7 +40,7 @@ public class ServletTests extends Watchd
                 "ServletToJSPError502PageTest",
         };
     }
-    
+
     public ServletTests(String name) {
        this();
        super.single = name;
@@ -51,7 +51,7 @@ public class ServletTests extends Watchd
         // required for the tests
         System.setProperty("org.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER",
                 "true");
-        
+
         try {
             initServerWithWatchdog(getWatchdogdir());
         } catch (ServletException e) {
@@ -62,24 +62,24 @@ public class ServletTests extends Watchd
             e.printStackTrace();
         }
     }
-    
-    public void initServerWithWatchdog(String wdDir) throws ServletException, 
+
+    public void initServerWithWatchdog(String wdDir) throws ServletException,
             IOException {
         Tomcat tomcat = new Tomcat();
         tomcat.setPort(port);
-        
+
         File f = new File(wdDir + "/build/webapps");
         tomcat.setBaseDir(f.getAbsolutePath());
-        
-        for (String s : new String[] {      
-                "servlet-compat", 
+
+        for (String s : new String[] {
+                "servlet-compat",
                 "servlet-tests",
                 "jsp-tests"} ) {
             tomcat.addWebapp("/" + s, f.getCanonicalPath() + "/" + s);
         }
-        
+
         TomcatStandaloneMain.setUp(tomcat, port);
-        
+
         try {
             tomcat.start();
         } catch (LifecycleException e) {
@@ -89,8 +89,8 @@ public class ServletTests extends Watchd
         System.err.println("Init done");
     }
 
-    /** 
-     * Magic JUnit method 
+    /**
+     * Magic JUnit method
      */
     public static Test suite() {
         return new ServletTests().getSuite();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message