You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2009/02/11 21:28:04 UTC

svn commit: r743486 - in /httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio: DefaultClientIOEventDispatch.java DefaultServerIOEventDispatch.java SSLClientIOEventDispatch.java SSLServerIOEventDispatch.java

Author: olegk
Date: Wed Feb 11 20:28:03 2009
New Revision: 743486

URL: http://svn.apache.org/viewvc?rev=743486&view=rev
Log:
Use ExecutionContext#HTTP_CONNECTION as attribute name for the connection object in the session context

Modified:
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLServerIOEventDispatch.java

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java?rev=743486&r1=743485&r2=743486&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultClientIOEventDispatch.java Wed Feb 11 20:28:03 2009
@@ -41,6 +41,7 @@
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 
 /**
  * Default implementation of {@link IOEventDispatch} interface for plain 
@@ -52,8 +53,6 @@
  */
 public class DefaultClientIOEventDispatch implements IOEventDispatch {
 
-    private static final String NHTTP_CONN = "NHTTP_CONN";
-    
     protected final ByteBufferAllocator allocator;
     protected final NHttpClientHandler handler;
     protected final HttpParams params;
@@ -128,13 +127,13 @@
     public void connected(final IOSession session) {
         NHttpClientIOTarget conn = createConnection(session);
         Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
-        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         this.handler.connected(conn, attachment);
     }
 
     public void disconnected(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         if (conn != null) {
             this.handler.closed(conn);
         }
@@ -142,19 +141,19 @@
 
     public void inputReady(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         conn.consumeInput(this.handler);
     }
 
     public void outputReady(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         conn.produceOutput(this.handler);
     }
 
     public void timeout(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         this.handler.timeout(conn);
     }
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java?rev=743486&r1=743485&r2=743486&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultServerIOEventDispatch.java Wed Feb 11 20:28:03 2009
@@ -41,6 +41,7 @@
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 
 /**
  * Default implementation of {@link IOEventDispatch} interface for plain 
@@ -52,8 +53,6 @@
  */
 public class DefaultServerIOEventDispatch implements IOEventDispatch {
 
-    private static final String NHTTP_CONN = "NHTTP_CONN";
-    
     protected final ByteBufferAllocator allocator;
     protected final NHttpServiceHandler handler;
     protected final HttpParams params;
@@ -127,13 +126,13 @@
         
     public void connected(final IOSession session) {
         NHttpServerIOTarget conn = createConnection(session);
-        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         this.handler.connected(conn);
     }
 
     public void disconnected(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         if (conn != null) {
             this.handler.closed(conn);
         }
@@ -141,19 +140,19 @@
 
     public void inputReady(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         conn.consumeInput(this.handler);
     }
 
     public void outputReady(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         conn.produceOutput(this.handler);
     }
 
     public void timeout(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         this.handler.timeout(conn);
     }
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLClientIOEventDispatch.java?rev=743486&r1=743485&r2=743486&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLClientIOEventDispatch.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLClientIOEventDispatch.java Wed Feb 11 20:28:03 2009
@@ -49,6 +49,7 @@
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 
 /**
  * Default implementation of {@link IOEventDispatch} interface for SSL
@@ -60,7 +61,6 @@
  */
 public class SSLClientIOEventDispatch implements IOEventDispatch {
 
-    private static final String NHTTP_CONN = "NHTTP_CONN";
     private static final String SSL_SESSION = "SSL_SESSION";
     
     protected final NHttpClientHandler handler;
@@ -191,7 +191,7 @@
         NHttpClientIOTarget conn = createConnection(
                 sslSession);
         
-        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         session.setAttribute(SSL_SESSION, sslSession);
         
         Object attachment = session.getAttribute(IOSession.ATTACHMENT_KEY);
@@ -207,7 +207,7 @@
 
     public void disconnected(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         if (conn != null) {
             this.handler.closed(conn);
         }
@@ -215,7 +215,7 @@
 
     public void inputReady(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);
 
@@ -232,7 +232,7 @@
 
     public void outputReady(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);
 
@@ -249,7 +249,7 @@
 
     public void timeout(final IOSession session) {
         NHttpClientIOTarget conn = 
-            (NHttpClientIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpClientIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLServerIOEventDispatch.java?rev=743486&r1=743485&r2=743486&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLServerIOEventDispatch.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/SSLServerIOEventDispatch.java Wed Feb 11 20:28:03 2009
@@ -49,6 +49,7 @@
 import org.apache.http.nio.util.ByteBufferAllocator;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 
 /**
  * Default implementation of {@link IOEventDispatch} interface for SSL
@@ -60,7 +61,6 @@
  */
 public class SSLServerIOEventDispatch implements IOEventDispatch {
 
-    private static final String NHTTP_CONN = "NHTTP_CONN";
     private static final String SSL_SESSION = "SSL_SESSION";
    
     protected final NHttpServiceHandler handler;
@@ -191,7 +191,7 @@
         NHttpServerIOTarget conn = createConnection(
                 sslSession); 
         
-        session.setAttribute(NHTTP_CONN, conn);
+        session.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         session.setAttribute(SSL_SESSION, sslSession);
 
         this.handler.connected(conn);
@@ -206,7 +206,7 @@
 
     public void disconnected(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
 
         if (conn != null) {
             this.handler.closed(conn);
@@ -215,7 +215,7 @@
 
     public void inputReady(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);
 
@@ -232,7 +232,7 @@
 
     public void outputReady(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);
 
@@ -249,7 +249,7 @@
 
     public void timeout(final IOSession session) {
         NHttpServerIOTarget conn = 
-            (NHttpServerIOTarget) session.getAttribute(NHTTP_CONN);
+            (NHttpServerIOTarget) session.getAttribute(ExecutionContext.HTTP_CONNECTION);
         SSLIOSession sslSession = 
             (SSLIOSession) session.getAttribute(SSL_SESSION);