hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r937245 - in /httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging: LoggingNHttpClientConnection.java LoggingNHttpServerConnection.java
Date Fri, 23 Apr 2010 11:00:58 GMT
Author: olegk
Date: Fri Apr 23 11:00:57 2010
New Revision: 937245

URL: http://svn.apache.org/viewvc?rev=937245&view=rev
Log:
Fixed generics

Modified:
    httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java

Modified: httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java?rev=937245&r1=937244&r2=937245&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
Fri Apr 23 11:00:57 2010
@@ -34,7 +34,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.Header;
 import org.apache.http.HttpException;
-import org.apache.http.HttpMessage;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
@@ -52,7 +51,7 @@ public class LoggingNHttpClientConnectio
 
     private final Log log;
     private final Log headerlog;
-    
+
     public LoggingNHttpClientConnection(
         final IOSession session,
         final HttpResponseFactory responseFactory,
@@ -65,13 +64,13 @@ public class LoggingNHttpClientConnectio
 
     @Override
     public void close() throws IOException {
-        this.log.debug("Close connection");        
+        this.log.debug("Close connection");
         super.close();
     }
 
     @Override
     public void shutdown() throws IOException {
-        this.log.debug("Shutdown connection");        
+        this.log.debug("Shutdown connection");
         super.shutdown();
     }
 
@@ -85,69 +84,68 @@ public class LoggingNHttpClientConnectio
 
     @Override
     public void consumeInput(final NHttpClientHandler handler) {
-        this.log.debug("Consume input");        
+        this.log.debug("Consume input");
         super.consumeInput(handler);
     }
 
     @Override
     public void produceOutput(final NHttpClientHandler handler) {
-        this.log.debug("Produce output");        
+        this.log.debug("Produce output");
         super.produceOutput(handler);
     }
 
     @Override
-    protected NHttpMessageWriter createRequestWriter(
-            final SessionOutputBuffer buffer, 
+    protected NHttpMessageWriter<HttpRequest> createRequestWriter(
+            final SessionOutputBuffer buffer,
             final HttpParams params) {
         return new LoggingNHttpMessageWriter(
                 super.createRequestWriter(buffer, params));
     }
 
     @Override
-    protected NHttpMessageParser createResponseParser(
-            final SessionInputBuffer buffer, 
+    protected NHttpMessageParser<HttpResponse> createResponseParser(
+            final SessionInputBuffer buffer,
             final HttpResponseFactory responseFactory,
             final HttpParams params) {
         return new LoggingNHttpMessageParser(
                 super.createResponseParser(buffer, responseFactory, params));
     }
 
-    class LoggingNHttpMessageWriter implements NHttpMessageWriter {
+    class LoggingNHttpMessageWriter implements NHttpMessageWriter<HttpRequest> {
+
+        private final NHttpMessageWriter<HttpRequest> writer;
 
-        private final NHttpMessageWriter writer;
-        
-        public LoggingNHttpMessageWriter(final NHttpMessageWriter writer) {
+        public LoggingNHttpMessageWriter(final NHttpMessageWriter<HttpRequest> writer)
{
             super();
             this.writer = writer;
         }
-        
+
         public void reset() {
             this.writer.reset();
         }
 
-        public void write(final HttpMessage message) throws IOException, HttpException {
+        public void write(final HttpRequest message) throws IOException, HttpException {
             if (message != null && headerlog.isDebugEnabled()) {
-                HttpRequest request = (HttpRequest) message; 
-                headerlog.debug(">> " + request.getRequestLine().toString());
-                Header[] headers = request.getAllHeaders();
+                headerlog.debug(">> " + message.getRequestLine().toString());
+                Header[] headers = message.getAllHeaders();
                 for (int i = 0; i < headers.length; i++) {
                     headerlog.debug(">> " + headers[i].toString());
                 }
             }
             this.writer.write(message);
         }
-        
+
     }
-    
-    class LoggingNHttpMessageParser implements NHttpMessageParser {
 
-        private final NHttpMessageParser parser;
-        
-        public LoggingNHttpMessageParser(final NHttpMessageParser parser) {
+    class LoggingNHttpMessageParser implements NHttpMessageParser<HttpResponse> {
+
+        private final NHttpMessageParser<HttpResponse> parser;
+
+        public LoggingNHttpMessageParser(final NHttpMessageParser<HttpResponse> parser)
{
             super();
             this.parser = parser;
         }
-        
+
         public void reset() {
             this.parser.reset();
         }
@@ -156,21 +154,18 @@ public class LoggingNHttpClientConnectio
             return this.parser.fillBuffer(channel);
         }
 
-        public HttpMessage parse() throws IOException, HttpException {
-            HttpMessage message = this.parser.parse();
-            if (headerlog.isDebugEnabled()) {
-                HttpResponse response = (HttpResponse) message; 
-                if (response != null && headerlog.isDebugEnabled()) {
-                    headerlog.debug("<< " + response.getStatusLine().toString());
-                    Header[] headers = response.getAllHeaders();
-                    for (int i = 0; i < headers.length; i++) {
-                        headerlog.debug("<< " + headers[i].toString());
-                    }
+        public HttpResponse parse() throws IOException, HttpException {
+            HttpResponse message = this.parser.parse();
+            if (message != null && headerlog.isDebugEnabled()) {
+                headerlog.debug("<< " + message.getStatusLine().toString());
+                Header[] headers = message.getAllHeaders();
+                for (int i = 0; i < headers.length; i++) {
+                    headerlog.debug("<< " + headers[i].toString());
                 }
             }
             return message;
         }
-        
+
     }
 
 }
\ No newline at end of file

Modified: httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java?rev=937245&r1=937244&r2=937245&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
Fri Apr 23 11:00:57 2010
@@ -34,7 +34,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.Header;
 import org.apache.http.HttpException;
-import org.apache.http.HttpMessage;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestFactory;
 import org.apache.http.HttpResponse;
@@ -52,7 +51,7 @@ public class LoggingNHttpServerConnectio
 
     private final Log log;
     private final Log headerlog;
-    
+
     public LoggingNHttpServerConnection(
         final IOSession session,
         final HttpRequestFactory requestFactory,
@@ -65,16 +64,16 @@ public class LoggingNHttpServerConnectio
 
     @Override
     public void close() throws IOException {
-        this.log.debug("Close connection");        
+        this.log.debug("Close connection");
         super.close();
     }
 
     @Override
     public void shutdown() throws IOException {
-        this.log.debug("Shutdown connection");        
+        this.log.debug("Shutdown connection");
         super.shutdown();
     }
-    
+
     @Override
     public void submitResponse(final HttpResponse response) throws IOException, HttpException
{
         if (this.log.isDebugEnabled()) {
@@ -85,69 +84,68 @@ public class LoggingNHttpServerConnectio
 
     @Override
     public void consumeInput(final NHttpServiceHandler handler) {
-        this.log.debug("Consume input");        
+        this.log.debug("Consume input");
         super.consumeInput(handler);
     }
 
     @Override
     public void produceOutput(final NHttpServiceHandler handler) {
-        this.log.debug("Produce output");        
+        this.log.debug("Produce output");
         super.produceOutput(handler);
     }
-    
+
     @Override
-    protected NHttpMessageWriter createResponseWriter(
-            final SessionOutputBuffer buffer, 
+    protected NHttpMessageWriter<HttpResponse> createResponseWriter(
+            final SessionOutputBuffer buffer,
             final HttpParams params) {
         return new LoggingNHttpMessageWriter(
                 super.createResponseWriter(buffer, params));
     }
 
     @Override
-    protected NHttpMessageParser createRequestParser(
-            final SessionInputBuffer buffer, 
+    protected NHttpMessageParser<HttpRequest> createRequestParser(
+            final SessionInputBuffer buffer,
             final HttpRequestFactory requestFactory,
             final HttpParams params) {
         return new LoggingNHttpMessageParser(
                 super.createRequestParser(buffer, requestFactory, params));
     }
 
-    class LoggingNHttpMessageWriter implements NHttpMessageWriter {
+    class LoggingNHttpMessageWriter implements NHttpMessageWriter<HttpResponse> {
 
-        private final NHttpMessageWriter writer;
-        
-        public LoggingNHttpMessageWriter(final NHttpMessageWriter writer) {
+        private final NHttpMessageWriter<HttpResponse> writer;
+
+        public LoggingNHttpMessageWriter(final NHttpMessageWriter<HttpResponse> writer)
{
             super();
             this.writer = writer;
         }
-        
+
         public void reset() {
             this.writer.reset();
         }
 
-        public void write(final HttpMessage message) throws IOException, HttpException {
+        public void write(final HttpResponse message) throws IOException, HttpException {
             if (message != null && headerlog.isDebugEnabled()) {
-                HttpResponse response = (HttpResponse) message; 
-                headerlog.debug("<< " + response.getStatusLine().toString());
-                Header[] headers = response.getAllHeaders();
+                headerlog.debug("<< " + message.getStatusLine().toString());
+                Header[] headers = message.getAllHeaders();
                 for (int i = 0; i < headers.length; i++) {
                     headerlog.debug("<< " + headers[i].toString());
                 }
             }
             this.writer.write(message);
         }
-        
+
     }
-    
-    class LoggingNHttpMessageParser implements NHttpMessageParser {
 
-        private final NHttpMessageParser parser;
-        
-        public LoggingNHttpMessageParser(final NHttpMessageParser parser) {
+    class LoggingNHttpMessageParser implements NHttpMessageParser<HttpRequest> {
+
+        private final NHttpMessageParser<HttpRequest> parser;
+
+        public LoggingNHttpMessageParser(final NHttpMessageParser<HttpRequest> parser)
{
             super();
             this.parser = parser;
         }
-        
+
         public void reset() {
             this.parser.reset();
         }
@@ -156,19 +154,18 @@ public class LoggingNHttpServerConnectio
             return this.parser.fillBuffer(channel);
         }
 
-        public HttpMessage parse() throws IOException, HttpException {
-            HttpMessage message = this.parser.parse();
+        public HttpRequest parse() throws IOException, HttpException {
+            HttpRequest message = this.parser.parse();
             if (message != null && headerlog.isDebugEnabled()) {
-                HttpRequest request = (HttpRequest) message; 
-                headerlog.debug(">> " + request.getRequestLine().toString());
-                Header[] headers = request.getAllHeaders();
+                headerlog.debug(">> " + message.getRequestLine().toString());
+                Header[] headers = message.getAllHeaders();
                 for (int i = 0; i < headers.length; i++) {
                     headerlog.debug(">> " + headers[i].toString());
                 }
             }
             return message;
         }
-        
+
     }
 
 }
\ No newline at end of file



Mime
View raw message