hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r531839 - in /jakarta/httpcomponents/httpcore/trunk: ./ module-nio/src/examples/org/apache/http/examples/nio/ module-nio/src/main/java/org/apache/http/nio/protocol/ module-nio/src/test/java/org/apache/http/nio/mockup/ module-niossl/src/exam...
Date Tue, 24 Apr 2007 09:00:07 GMT
Author: olegk
Date: Tue Apr 24 02:00:05 2007
New Revision: 531839

URL: http://svn.apache.org/viewvc?view=rev&rev=531839
Log:
HTTPCORE-67: Improved event listener interface

Modified:
    jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/AsyncHttpServer.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/EventListener.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/nio/mockup/TestHttpServiceBase.java
    jakarta/httpcomponents/httpcore/trunk/module-niossl/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
    jakarta/httpcomponents/httpcore/trunk/module-niossl/src/test/java/org/apache/http/impl/nio/mockup/TestHttpSSLServiceBase.java

Modified: jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Apr 24 02:00:05 2007
@@ -1,5 +1,8 @@
 Changes since 4.0 Alpha 4
 
+* [HTTPCORE-67]: Improved event listener interface
+  Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCORE-43]: Support for FileChannel#transferFrom() and 
   FileChannel#transferTo() methods. Direct coping from and to FileChannel is 
   expected to improve performance of file bound operations

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/AsyncHttpServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/AsyncHttpServer.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/AsyncHttpServer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/AsyncHttpServer.java
Tue Apr 24 02:00:05 2007
@@ -35,7 +35,6 @@
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.URLDecoder;
 
@@ -55,6 +54,7 @@
 import org.apache.http.util.concurrent.Executor;
 import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.params.HttpNIOParams;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.protocol.ThrottlingHttpServiceHandler;
@@ -203,23 +203,23 @@
     
     static class EventLogger implements EventListener {
 
-        public void connectionOpen(final InetAddress address) {
-            System.out.println("Connection open: " + address);
+        public void connectionOpen(final NHttpConnection conn) {
+            System.out.println("Connection open: " + conn);
         }
 
-        public void connectionTimeout(final InetAddress address) {
-            System.out.println("Connection timed out: " + address);
+        public void connectionTimeout(final NHttpConnection conn) {
+            System.out.println("Connection timed out: " + conn);
         }
 
-        public void connectionClosed(InetAddress address) {
-            System.out.println("Connection closed: " + address);
+        public void connectionClosed(final NHttpConnection conn) {
+            System.out.println("Connection closed: " + conn);
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             System.err.println("I/O error: " + ex.getMessage());
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, final NHttpConnection
conn) {
             System.err.println("HTTP error: " + ex.getMessage());
         }
         

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
Tue Apr 24 02:00:05 2007
@@ -32,7 +32,6 @@
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 
 import org.apache.http.HttpEntity;
@@ -45,6 +44,7 @@
 import org.apache.http.impl.nio.DefaultClientIOEventDispatch;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
 import org.apache.http.message.BasicHttpRequest;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.BufferingHttpClientHandler;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.protocol.HttpRequestExecutionHandler;
@@ -181,28 +181,28 @@
         private int openNo = 0;
         private int closedNo = 0;
         
-        public void connectionOpen(final InetAddress address) {
+        public void connectionOpen(final NHttpConnection conn) {
             this.openNo++;
-            System.out.println("Connection open: " + address);
+            System.out.println("Connection open: " + conn);
         }
 
-        public void connectionTimeout(final InetAddress address) {
-            System.out.println("Connection timed out: " + address);
+        public void connectionTimeout(final NHttpConnection conn) {
+            System.out.println("Connection timed out: " + conn);
         }
 
-        public void connectionClosed(InetAddress address) {
-            System.out.println("Connection closed: " + address);
+        public void connectionClosed(final NHttpConnection conn) {
+            System.out.println("Connection closed: " + conn);
             this.closedNo++;
             if (this.openNo == this.closedNo) {
                 System.exit(0);
             }
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             System.err.println("I/O error: " + ex.getMessage());
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, final NHttpConnection
conn) {
             System.err.println("HTTP error: " + ex.getMessage());
         }
         

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
Tue Apr 24 02:00:05 2007
@@ -35,7 +35,6 @@
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.URLDecoder;
 
@@ -54,6 +53,7 @@
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.impl.nio.DefaultServerIOEventDispatch;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.protocol.BufferingHttpServiceHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
@@ -199,23 +199,23 @@
     
     static class EventLogger implements EventListener {
 
-        public void connectionOpen(final InetAddress address) {
-            System.out.println("Connection open: " + address);
+        public void connectionOpen(final NHttpConnection conn) {
+            System.out.println("Connection open: " + conn);
         }
 
-        public void connectionTimeout(final InetAddress address) {
-            System.out.println("Connection timed out: " + address);
+        public void connectionTimeout(final NHttpConnection conn) {
+            System.out.println("Connection timed out: " + conn);
         }
 
-        public void connectionClosed(InetAddress address) {
-            System.out.println("Connection closed: " + address);
+        public void connectionClosed(final NHttpConnection conn) {
+            System.out.println("Connection closed: " + conn);
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             System.err.println("I/O error: " + ex.getMessage());
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, final NHttpConnection
conn) {
             System.err.println("HTTP error: " + ex.getMessage());
         }
         

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
Tue Apr 24 02:00:05 2007
@@ -134,11 +134,7 @@
         context.setAttribute(CONN_STATE, connState);
 
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionOpen(address);
+            this.eventListener.connectionOpen(conn);
         }
         
         requestReady(conn);        
@@ -146,25 +142,21 @@
 
     public void closed(final NHttpClientConnection conn) {
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionClosed(address);
+            this.eventListener.connectionClosed(conn);
         }
     }
 
     public void exception(final NHttpClientConnection conn, final HttpException ex) {
         shutdownConnection(conn);
         if (this.eventListener != null) {
-            this.eventListener.fatalProtocolException(ex);
+            this.eventListener.fatalProtocolException(ex, conn);
         }
     }
 
     public void exception(final NHttpClientConnection conn, final IOException ex) {
         shutdownConnection(conn);
         if (this.eventListener != null) {
-            this.eventListener.fatalIOException(ex);
+            this.eventListener.fatalIOException(ex, conn);
         }
     }
     
@@ -183,12 +175,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
     }
@@ -214,12 +206,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
     }
@@ -249,7 +241,7 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         }
     }
@@ -288,12 +280,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
     }
@@ -312,17 +304,13 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         }
         
         shutdownConnection(conn);
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionTimeout(address);
+            this.eventListener.connectionTimeout(conn);
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
Tue Apr 24 02:00:05 2007
@@ -33,13 +33,11 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.net.InetAddress;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
-import org.apache.http.HttpInetConnection;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
@@ -136,11 +134,7 @@
         context.setAttribute(CONN_STATE, connState);
 
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionOpen(address);
+            this.eventListener.connectionOpen(conn);
         }
     }
 
@@ -207,12 +201,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
         
@@ -220,11 +214,7 @@
 
     public void closed(final NHttpServerConnection conn) {
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionClosed(address);
+            this.eventListener.connectionClosed(conn);
         }
     }
 
@@ -240,12 +230,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
     }
@@ -253,7 +243,7 @@
     public void exception(final NHttpServerConnection conn, final IOException ex) {
         shutdownConnection(conn);
         if (this.eventListener != null) {
-            this.eventListener.fatalIOException(ex);
+            this.eventListener.fatalIOException(ex, conn);
         }
     }
 
@@ -287,12 +277,12 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         } catch (HttpException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalProtocolException(ex);
+                this.eventListener.fatalProtocolException(ex, conn);
             }
         }
     }
@@ -327,7 +317,7 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         }
     }
@@ -335,11 +325,7 @@
     public void timeout(final NHttpServerConnection conn) {
         shutdownConnection(conn);
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionTimeout(address);
+            this.eventListener.connectionTimeout(conn);
         }
     }
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/EventListener.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/EventListener.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/EventListener.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/EventListener.java
Tue Apr 24 02:00:05 2007
@@ -32,9 +32,9 @@
 package org.apache.http.nio.protocol;
 
 import java.io.IOException;
-import java.net.InetAddress;
 
 import org.apache.http.HttpException;
+import org.apache.http.nio.NHttpConnection;
 
 /**
  * Event listener used by HTTP protocol layer to report fatal
@@ -44,14 +44,14 @@
  */
 public interface EventListener {
 
-    void fatalIOException(IOException ex);
+    void fatalIOException(IOException ex, NHttpConnection conn);
 
-    void fatalProtocolException(HttpException ex);
+    void fatalProtocolException(HttpException ex, NHttpConnection conn);
 
-    void connectionOpen(InetAddress address);
+    void connectionOpen(NHttpConnection conn);
 
-    void connectionClosed(InetAddress address);
+    void connectionClosed(NHttpConnection conn);
 
-    void connectionTimeout(InetAddress address);
+    void connectionTimeout(NHttpConnection conn);
     
 }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
Tue Apr 24 02:00:05 2007
@@ -34,13 +34,11 @@
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
-import java.net.InetAddress;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
-import org.apache.http.HttpInetConnection;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
@@ -56,7 +54,6 @@
 import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.nio.NHttpServiceHandler;
-import org.apache.http.util.concurrent.Executor;
 import org.apache.http.nio.params.HttpNIOParams;
 import org.apache.http.nio.util.ContentInputBuffer;
 import org.apache.http.nio.util.ContentOutputBuffer;
@@ -70,6 +67,7 @@
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.protocol.HttpRequestHandlerResolver;
 import org.apache.http.util.EncodingUtils;
+import org.apache.http.util.concurrent.Executor;
 
 /**
  * HTTP service handler implementation that allocates content buffers of limited 
@@ -157,11 +155,7 @@
         context.setAttribute(CONN_STATE, connState);
 
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionOpen(address);
+            this.eventListener.connectionOpen(conn);
         }
     }
 
@@ -173,11 +167,7 @@
         connState.shutdown();
         
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionClosed(address);
+            this.eventListener.connectionClosed(conn);
         }
     }
     
@@ -199,12 +189,12 @@
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                     if (eventListener != null) {
-                        eventListener.fatalIOException(ex);
+                        eventListener.fatalIOException(ex, conn);
                     }
                 } catch (HttpException ex) {
                     shutdownConnection(conn);
                     if (eventListener != null) {
-                        eventListener.fatalProtocolException(ex);
+                        eventListener.fatalProtocolException(ex, conn);
                     }
                 }
             }
@@ -216,7 +206,7 @@
         shutdownConnection(conn);
         
         if (this.eventListener != null) {
-            this.eventListener.fatalIOException(ex);
+            this.eventListener.fatalIOException(ex, conn);
         }
     }
 
@@ -224,11 +214,7 @@
         shutdownConnection(conn);
 
         if (this.eventListener != null) {
-            InetAddress address = null;
-            if (conn instanceof HttpInetConnection) {
-                address = ((HttpInetConnection) conn).getRemoteAddress();
-            }
-            this.eventListener.connectionTimeout(address);
+            this.eventListener.connectionTimeout(conn);
         }
     }
 
@@ -254,12 +240,12 @@
                 } catch (IOException ex) {
                     shutdownConnection(conn);
                     if (eventListener != null) {
-                        eventListener.fatalIOException(ex);
+                        eventListener.fatalIOException(ex, conn);
                     }
                 } catch (HttpException ex) {
                     shutdownConnection(conn);
                     if (eventListener != null) {
-                        eventListener.fatalProtocolException(ex);
+                        eventListener.fatalProtocolException(ex, conn);
                     }
                 }
             }
@@ -287,7 +273,7 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         }
     }
@@ -313,12 +299,12 @@
             } catch (IOException ex) {
                 shutdownConnection(conn);
                 if (eventListener != null) {
-                    eventListener.fatalIOException(ex);
+                    eventListener.fatalIOException(ex, conn);
                 }
             } catch (HttpException ex) {
                 shutdownConnection(conn);
                 if (eventListener != null) {
-                    eventListener.fatalProtocolException(ex);
+                    eventListener.fatalProtocolException(ex, conn);
                 }
             }
         }
@@ -354,7 +340,7 @@
         } catch (IOException ex) {
             shutdownConnection(conn);
             if (this.eventListener != null) {
-                this.eventListener.fatalIOException(ex);
+                this.eventListener.fatalIOException(ex, conn);
             }
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/nio/mockup/TestHttpServiceBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/nio/mockup/TestHttpServiceBase.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/nio/mockup/TestHttpServiceBase.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/nio/mockup/TestHttpServiceBase.java
Tue Apr 24 02:00:05 2007
@@ -32,10 +32,10 @@
 package org.apache.http.nio.mockup;
 
 import java.io.IOException;
-import java.net.InetAddress;
 
 import org.apache.http.HttpException;
 import org.apache.http.params.BasicHttpParams;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.reactor.IOReactor;
 import org.apache.http.params.HttpParams;
@@ -107,21 +107,21 @@
 
     protected class EventLogger implements EventListener {
 
-        public void connectionOpen(final InetAddress address) {
+        public void connectionOpen(final NHttpConnection conn) {
         }
 
-        public void connectionTimeout(final InetAddress address) {
+        public void connectionTimeout(final NHttpConnection conn) {
         }
 
-        public void connectionClosed(InetAddress address) {
+        public void connectionClosed(final NHttpConnection conn) {
             incrementConnCount();
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             ex.printStackTrace();
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, NHttpConnection conn)
{
             ex.printStackTrace();
         }
         

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
Tue Apr 24 02:00:05 2007
@@ -36,7 +36,6 @@
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.URL;
 import java.net.URLDecoder;
@@ -61,6 +60,7 @@
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
 import org.apache.http.impl.nio.reactor.SSLServerIOEventDispatch;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.protocol.BufferingHttpServiceHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
@@ -223,23 +223,23 @@
     
     static class EventLogger implements EventListener {
 
-        public void connectionOpen(final InetAddress address) {
-            System.out.println("Connection open: " + address);
+        public void connectionOpen(final NHttpConnection conn) {
+            System.out.println("Connection open: " + conn);
         }
 
-        public void connectionTimeout(final InetAddress address) {
-            System.out.println("Connection timed out: " + address);
+        public void connectionTimeout(final NHttpConnection conn) {
+            System.out.println("Connection timed out: " + conn);
         }
 
-        public void connectionClosed(InetAddress address) {
-            System.out.println("Connection closed: " + address);
+        public void connectionClosed(final NHttpConnection conn) {
+            System.out.println("Connection closed: " + conn);
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             System.err.println("I/O error: " + ex.getMessage());
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, final NHttpConnection
conn) {
             System.err.println("HTTP error: " + ex.getMessage());
         }
         

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/test/java/org/apache/http/impl/nio/mockup/TestHttpSSLServiceBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/test/java/org/apache/http/impl/nio/mockup/TestHttpSSLServiceBase.java?view=diff&rev=531839&r1=531838&r2=531839
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/test/java/org/apache/http/impl/nio/mockup/TestHttpSSLServiceBase.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/test/java/org/apache/http/impl/nio/mockup/TestHttpSSLServiceBase.java
Tue Apr 24 02:00:05 2007
@@ -32,10 +32,10 @@
 package org.apache.http.impl.nio.mockup;
 
 import java.io.IOException;
-import java.net.InetAddress;
 
 import org.apache.http.HttpException;
 import org.apache.http.params.BasicHttpParams;
+import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.EventListener;
 import org.apache.http.nio.reactor.IOReactor;
 import org.apache.http.params.HttpParams;
@@ -107,21 +107,21 @@
 
     protected class EventLogger implements EventListener {
 
-        public void connectionOpen(final InetAddress address) {
+        public void connectionOpen(final NHttpConnection conn) {
         }
 
-        public void connectionTimeout(final InetAddress address) {
+        public void connectionTimeout(final NHttpConnection conn) {
         }
 
-        public void connectionClosed(InetAddress address) {
+        public void connectionClosed(final NHttpConnection conn) {
             incrementConnCount();
         }
 
-        public void fatalIOException(IOException ex) {
+        public void fatalIOException(final IOException ex, final NHttpConnection conn) {
             ex.printStackTrace();
         }
 
-        public void fatalProtocolException(HttpException ex) {
+        public void fatalProtocolException(final HttpException ex, final NHttpConnection
conn) {
             ex.printStackTrace();
         }
         



Mime
View raw message