hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r418570 - in /jakarta/httpcomponents/httpcore/trunk/src: contrib/org/apache/http/contrib/benchmark/ contrib/org/apache/http/contrib/compress/ java/org/apache/http/ java/org/apache/http/entity/ java/org/apache/http/impl/ java/org/apache/http...
Date Sun, 02 Jul 2006 11:04:51 GMT
Author: olegk
Date: Sun Jul  2 04:04:49 2006
New Revision: 418570

URL: http://svn.apache.org/viewvc?rev=418570&view=rev
Log:
[HTTPCORE-5] Made Header an interface

Added:
    jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java   (with props)
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/BasicHeader.java
      - copied, changed from r418566, jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java
Removed:
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/GeneratedHeader.java
Modified:
    jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
    jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java
    jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java
    jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/RequestAcceptEncoding.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/HttpMessage.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/entity/AbstractHttpEntity.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/HeaderGroup.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/AbstractHttpMessage.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestConnControl.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestContent.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestExpectContinue.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestTargetHost.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestUserAgent.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseConnControl.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseContent.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseDate.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseServer.java
    jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/util/HeaderUtils.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/TestHeader.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/entity/TestAbstractHttpEntity.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestHeaderGroup.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntitySerializer.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/protocol/TestStandardInterceptors.java
    jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/util/TestEntityUtils.java

Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/BenchmarkWorker.java Sun Jul  2 04:04:49 2006
@@ -40,7 +40,6 @@
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
-import org.apache.http.protocol.GeneratedHeader;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.util.EntityUtils;
@@ -146,7 +145,7 @@
     private static void resetHeader(final HttpRequest request) {
         for (Iterator it = request.headerIterator(); it.hasNext(); ) {
             Header header = (Header) it.next();
-            if (header instanceof GeneratedHeader) {
+            if (!(header instanceof DefaultHeader)) {
                 it.remove();
             }
         }

Added: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java?rev=418570&view=auto
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java (added)
+++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java Sun Jul  2 04:04:49 2006
@@ -0,0 +1,40 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ *  Copyright 1999-2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.benchmark;
+
+import org.apache.http.message.BasicHeader;
+
+public class DefaultHeader extends BasicHeader {
+
+    public DefaultHeader(final String name, final String value) {
+        super(name, value);
+    }
+
+}

Propchange: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/DefaultHeader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/benchmark/HttpBenchmark.java Sun Jul  2 04:04:49 2006
@@ -233,7 +233,7 @@
             request = httpget;
         }
         if (!keepAlive) {
-            request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
+            request.addHeader(new DefaultHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
         }
 
         if(cmd.hasOption('H')) {
@@ -242,7 +242,7 @@
                 String s = strs[i];
                 int pos = s.indexOf(':');
                 if (pos != -1) {
-                    Header header = new Header(
+                    Header header = new DefaultHeader(
                             s.substring(0, pos).trim(),
                             s.substring(pos + 1));
                     request.addHeader(header);

Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java Sun Jul  2 04:04:49 2006
@@ -37,6 +37,7 @@
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.protocol.HTTP;
 
 /**
@@ -57,7 +58,7 @@
     }
 
     public Header getContentEncoding() {
-        return new Header(HTTP.CONTENT_ENCODING, GZIP_CODEC);
+        return new BasicHeader(HTTP.CONTENT_ENCODING, GZIP_CODEC);
     }
 
     public long getContentLength() {

Modified: jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/RequestAcceptEncoding.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/RequestAcceptEncoding.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/RequestAcceptEncoding.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/RequestAcceptEncoding.java Sun Jul  2 04:04:49 2006
@@ -31,7 +31,6 @@
 
 import java.io.IOException;
 
-import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
@@ -54,7 +53,7 @@
     public void process(final HttpRequest request, final HttpContext context) 
             throws HttpException, IOException {
         if (!request.containsHeader(ACCEPT_ENCODING)) {
-            request.addHeader(new Header(ACCEPT_ENCODING, GZIP_CODEC));
+            request.addHeader(ACCEPT_ENCODING, GZIP_CODEC);
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java Sun Jul  2 04:04:49 2006
@@ -29,8 +29,6 @@
 
 package org.apache.http;
 
-import org.apache.http.io.CharArrayBuffer;
-
 /**
  * Represents an HTTP header field.
  * 
@@ -50,116 +48,15 @@
  *</pre>
  * 
  * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
- * @version $Revision$ $Date$
+ * @version $Revision$
  */
-public class Header {
+public interface Header {
 
-    /**
-     * Header name.
-     */
-    private final String name;
-    
-    /**
-     * Header value.
-     */
-    private final String value;
+    String getName();
     
-    /**
-     * Constructor with name and value
-     *
-     * @param name the header name
-     * @param value the header value
-     */
-    public Header(final String name, final String value) {
-        super();
-        if (name == null) {
-            throw new IllegalArgumentException("Name may not be null");
-        }
-        this.name = name;
-        this.value = value;
-    }
-
-    /**
-     * Returns the header name.
-     *
-     * @return String name The name
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * Returns the header value.
-     *
-     * @return String value The current value.
-     */
-    public String getValue() {
-        return this.value;
-    }
-
-    /**
-     * Returns a {@link String} representation of the header.
-     *
-     * @return a string
-     */
-    public String toString() {
-        CharArrayBuffer buffer = new CharArrayBuffer(32);
-        buffer.append(this.name);
-        buffer.append(": ");
-        if (this.value != null) {
-            buffer.append(this.value);
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * Returns an array of {@link HeaderElement}s constructed from my value.
-     *
-     * @see HeaderElement#parseAll
-     * 
-     * @return an array of header elements
-     * 
-     * @since 3.0
-     */
-    public HeaderElement[] getElements() {
-        if (this.value != null) {
-            return HeaderElement.parseAll(this.value);
-        } else {
-            return new HeaderElement[] {}; 
-        }
-    }
-
-    /**
-     * Formats a Header into a header line. The <code>header</code> is
-     * directly appended to <code>buffer</code>; no newline characters are
-     * inserted (folding).
-     * 
-     * @param buffer the buffer to append to
-     * @param header the header to format
-     */
-    public static void format(final CharArrayBuffer buffer, final Header header) {
-        if (buffer == null) {
-            throw new IllegalArgumentException("String buffer may not be null");
-        }
-        if (header == null) {
-            throw new IllegalArgumentException("Header may not be null");
-        }
-        buffer.append(header.getName());
-        buffer.append(": ");
-        if (header.getValue() != null) {
-            buffer.append(header.getValue());
-        }
-    }
- 
-    /**
-     * @see #format(CharArrayBuffer, Header)
-     */
-    public static String format(final Header header) {
-        CharArrayBuffer buffer = new CharArrayBuffer(32);
-        format(buffer, header);
-        return buffer.toString();
-    }
+    String getValue();
 
+    HeaderElement[] getElements();
+    
 }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/HttpMessage.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/HttpMessage.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/HttpMessage.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/HttpMessage.java Sun Jul  2 04:04:49 2006
@@ -108,12 +108,30 @@
     void addHeader(Header header);
 
     /**
+     * Adds a header to this message. The header will be appended to the end of
+     * the list.
+     * 
+     * @param name the name of the header.
+     * @param value the value of the header.
+     */
+    void addHeader(String name, String value);
+
+    /**
      * Overwrites the first header with the same name. The new header will be appended to 
      * the end of the list, if no header with the given name can be found.
      * 
      * @param header the header to set.
      */
     void setHeader(Header header);
+
+    /**
+     * Overwrites the first header with the same name. The new header will be appended to 
+     * the end of the list, if no header with the given name can be found.
+     * 
+     * @param name the name of the header.
+     * @param value the value of the header.
+     */
+    void setHeader(String name, String value);
 
     /**
      * Overwrites all the headers in the message.

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/entity/AbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/entity/AbstractHttpEntity.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/entity/AbstractHttpEntity.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/entity/AbstractHttpEntity.java Sun Jul  2 04:04:49 2006
@@ -33,6 +33,7 @@
 
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.protocol.HTTP;
 
 /**
@@ -138,7 +139,7 @@
     public void setContentType(final String ctString) {
         Header h = null;
         if (ctString != null) {
-            h = new Header(HTTP.CONTENT_TYPE, ctString);
+            h = new BasicHeader(HTTP.CONTENT_TYPE, ctString);
         }
         setContentType(h);
     }
@@ -167,7 +168,7 @@
     public void setContentEncoding(final String ceString) {
         Header h = null;
         if (ceString != null) {
-            h = new Header(HTTP.CONTENT_ENCODING, ceString);
+            h = new BasicHeader(HTTP.CONTENT_ENCODING, ceString);
         }
         setContentEncoding(h);
     }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpClientConnection.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpClientConnection.java Sun Jul  2 04:04:49 2006
@@ -53,6 +53,7 @@
 import org.apache.http.impl.entity.DefaultEntityDeserializer;
 import org.apache.http.io.CharArrayBuffer;
 import org.apache.http.io.SocketFactory;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
@@ -206,7 +207,7 @@
             throws HttpException, IOException {
         for (Iterator it = request.headerIterator(); it.hasNext(); ) {
             this.buffer.clear();
-            Header.format(this.buffer, (Header) it.next());
+            BasicHeader.format(this.buffer, (Header) it.next());
             this.datatransmitter.writeLine(this.buffer);
         }
         this.buffer.clear();

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpServerConnection.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/DefaultHttpServerConnection.java Sun Jul  2 04:04:49 2006
@@ -49,6 +49,7 @@
 import org.apache.http.impl.entity.DefaultEntityDeserializer;
 import org.apache.http.impl.entity.DefaultEntitySerializer;
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.util.HeaderUtils;
@@ -187,7 +188,7 @@
             throws HttpException, IOException {
         for (Iterator it = response.headerIterator(); it.hasNext(); ) {
             this.buffer.clear();
-            Header.format(this.buffer, (Header) it.next());
+            BasicHeader.format(this.buffer, (Header) it.next());
             this.datatransmitter.writeLine(this.buffer);
         }
         this.buffer.clear();

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/HeaderGroup.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/HeaderGroup.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/HeaderGroup.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/impl/HeaderGroup.java Sun Jul  2 04:04:49 2006
@@ -35,6 +35,7 @@
 
 import org.apache.http.Header;
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 
 /**
  * A class for combining a set of headers.  This class allows for multiple
@@ -153,7 +154,7 @@
                 valueBuffer.append(headers[i].getValue());
             }
             
-            return new Header(name.toLowerCase(), valueBuffer.toString());
+            return new BasicHeader(name.toLowerCase(), valueBuffer.toString());
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/AbstractHttpMessage.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/AbstractHttpMessage.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/AbstractHttpMessage.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/AbstractHttpMessage.java Sun Jul  2 04:04:49 2006
@@ -82,11 +82,25 @@
         this.headergroup.addHeader(header);
     }
 
+    public void addHeader(final String name, final String value) {
+        if (name == null) {
+            throw new IllegalArgumentException("Header name may not be null");
+        }
+        this.headergroup.addHeader(new BasicHeader(name, value));
+    }
+
     public void setHeader(final Header header) {
         if (header == null) {
             return;
         }
         this.headergroup.updateHeader(header);
+    }
+
+    public void setHeader(final String name, final String value) {
+        if (name == null) {
+            throw new IllegalArgumentException("Header name may not be null");
+        }
+        this.headergroup.updateHeader(new BasicHeader(name, value));
     }
 
     public void setHeaders(final Header[] headers) {

Copied: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/BasicHeader.java (from r418566, jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java)
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/BasicHeader.java?p2=jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/BasicHeader.java&p1=jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java&r1=418566&r2=418570&rev=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/Header.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/message/BasicHeader.java Sun Jul  2 04:04:49 2006
@@ -27,8 +27,10 @@
  *
  */
 
-package org.apache.http;
+package org.apache.http.message;
 
+import org.apache.http.Header;
+import org.apache.http.HeaderElement;
 import org.apache.http.io.CharArrayBuffer;
 
 /**
@@ -54,7 +56,7 @@
  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
  * @version $Revision$ $Date$
  */
-public class Header {
+public class BasicHeader implements Header {
 
     /**
      * Header name.
@@ -72,7 +74,7 @@
      * @param name the header name
      * @param value the header value
      */
-    public Header(final String name, final String value) {
+    public BasicHeader(final String name, final String value) {
         super();
         if (name == null) {
             throw new IllegalArgumentException("Name may not be null");

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestConnControl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestConnControl.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestConnControl.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestConnControl.java Sun Jul  2 04:04:49 2006
@@ -58,7 +58,7 @@
         if (!request.containsHeader(HTTP.CONN_DIRECTIVE)) {
             // Default policy is to keep connection alive
             // whenever possible
-            request.addHeader(new GeneratedHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+            request.addHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestContent.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestContent.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestContent.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestContent.java Sun Jul  2 04:04:49 2006
@@ -69,7 +69,7 @@
             HttpVersion ver = request.getRequestLine().getHttpVersion();
             HttpEntity entity = ((HttpEntityEnclosingRequest)request).getEntity();
             if (entity == null) {
-                request.addHeader(new GeneratedHeader(HTTP.CONTENT_LEN, "0"));
+                request.addHeader(HTTP.CONTENT_LEN, "0");
                 return;
             }
             // Must specify a transfer encoding or a content length 
@@ -78,11 +78,9 @@
                     throw new ProtocolException(
                             "Chunked transfer encoding not allowed for " + ver);
                 }
-                request.addHeader(new GeneratedHeader(HTTP.TRANSFER_ENCODING, 
-                        HTTP.CHUNK_CODING));
+                request.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
             } else {
-                request.addHeader(new GeneratedHeader(HTTP.CONTENT_LEN, 
-                        Long.toString(entity.getContentLength())));
+                request.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
             }
             // Specify a content type if known
             if (entity.getContentType() != null && !request.containsHeader(

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestExpectContinue.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestExpectContinue.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestExpectContinue.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestExpectContinue.java Sun Jul  2 04:04:49 2006
@@ -66,8 +66,7 @@
                 HttpVersion ver = request.getRequestLine().getHttpVersion();
                 if (HttpProtocolParams.useExpectContinue(request.getParams()) 
                         && ver.greaterEquals(HttpVersion.HTTP_1_1)) {
-                    request.addHeader(new GeneratedHeader(HTTP.EXPECT_DIRECTIVE, 
-                            HTTP.EXPECT_CONTINUE));
+                    request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
                 }
             }
         }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestTargetHost.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestTargetHost.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestTargetHost.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestTargetHost.java Sun Jul  2 04:04:49 2006
@@ -78,7 +78,7 @@
                 targethost = new HttpHost(virtualhost, 
                         targethost.getPort(), targethost.getScheme());
             }
-            request.addHeader(new GeneratedHeader(HTTP.TARGET_HOST, targethost.toHostString()));
+            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestUserAgent.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestUserAgent.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestUserAgent.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/RequestUserAgent.java Sun Jul  2 04:04:49 2006
@@ -59,7 +59,7 @@
         if (!request.containsHeader(HTTP.USER_AGENT)) {
             String useragent = HttpProtocolParams.getUserAgent(request.getParams());
             if (useragent != null) {
-                request.addHeader(new GeneratedHeader(HTTP.USER_AGENT, useragent));
+                request.addHeader(HTTP.USER_AGENT, useragent);
             }
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseConnControl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseConnControl.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseConnControl.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseConnControl.java Sun Jul  2 04:04:49 2006
@@ -74,7 +74,7 @@
         		status == HttpStatus.SC_INTERNAL_SERVER_ERROR ||
         		status == HttpStatus.SC_SERVICE_UNAVAILABLE ||
         		status == HttpStatus.SC_NOT_IMPLEMENTED) {
-            response.setHeader(new GeneratedHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
+            response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
             return;
         }
         // Always drop connection for HTTP/1.0 responses and below
@@ -84,7 +84,7 @@
             HttpVersion ver = response.getStatusLine().getHttpVersion();
             if (entity.getContentLength() < 0 && 
                     (!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0))) {
-                response.setHeader(new GeneratedHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
+                response.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
                 return;
             }
         }
@@ -93,7 +93,7 @@
         if (request != null) {
             Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
             if (header != null) {
-                response.setHeader(new GeneratedHeader(HTTP.CONN_DIRECTIVE, header.getValue()));
+                response.setHeader(HTTP.CONN_DIRECTIVE, header.getValue());
             }
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseContent.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseContent.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseContent.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseContent.java Sun Jul  2 04:04:49 2006
@@ -71,11 +71,9 @@
         if (entity != null) {
             long len = entity.getContentLength();
             if (entity.isChunked() && ver.greaterEquals(HttpVersion.HTTP_1_1)) {
-                response.addHeader(new GeneratedHeader(HTTP.TRANSFER_ENCODING, 
-                        HTTP.CHUNK_CODING));
+                response.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
             } else if (len >= 0) {
-                response.addHeader(new GeneratedHeader(HTTP.CONTENT_LEN, 
-                        Long.toString(entity.getContentLength())));
+                response.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
             }
             // Specify a content type if known
             if (entity.getContentType() != null && !response.containsHeader(
@@ -92,7 +90,7 @@
             if (status != HttpStatus.SC_NO_CONTENT 
                     && status != HttpStatus.SC_NOT_MODIFIED
                     && status != HttpStatus.SC_RESET_CONTENT) {
-                response.addHeader(new GeneratedHeader(HTTP.CONTENT_LEN, "0"));
+                response.addHeader(HTTP.CONTENT_LEN, "0");
             }
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseDate.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseDate.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseDate.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseDate.java Sun Jul  2 04:04:49 2006
@@ -62,7 +62,7 @@
         int status = response.getStatusLine().getStatusCode();
         if (status >= HttpStatus.SC_OK) {
             String httpdate = DATE_GENERATOR.getCurrentDate();
-            response.setHeader(new GeneratedHeader(HTTP.DATE_DIRECTIVE, httpdate)); 
+            response.setHeader(HTTP.DATE_DIRECTIVE, httpdate); 
         }
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseServer.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseServer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/protocol/ResponseServer.java Sun Jul  2 04:04:49 2006
@@ -61,7 +61,7 @@
             String s = (String) response.getParams().getParameter(
                     HttpProtocolParams.ORIGIN_SERVER);
             if (s != null) {
-                response.addHeader(new GeneratedHeader(HTTP.SERVER_DIRECTIVE, s)); 
+                response.addHeader(HTTP.SERVER_DIRECTIVE, s); 
             }
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/util/HeaderUtils.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/util/HeaderUtils.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/util/HeaderUtils.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/java/org/apache/http/util/HeaderUtils.java Sun Jul  2 04:04:49 2006
@@ -54,15 +54,20 @@
      * This class represents a raw HTTP header whose content is parsed
      * 'on demand' only when the header value needs to be consumed  
      */
-    static class BufferedHeader extends Header {
+    static class BufferedHeader implements Header {
         
+        private final String name;
         private final CharArrayBuffer buffer;
         private final int posValue;
         
         public BufferedHeader(final String name, final CharArrayBuffer buffer, int posValue) {
-            super(name, null);
+            this.name = name;
             this.buffer = buffer;
             this.posValue = posValue;
+        }
+
+        public String getName() {
+            return this.name;
         }
         
         public String getValue() {

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/TestHeader.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/TestHeader.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/TestHeader.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/TestHeader.java Sun Jul  2 04:04:49 2006
@@ -30,6 +30,7 @@
 package org.apache.http;
 
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -56,20 +57,20 @@
     }
 
     public void testBasicConstructor() {
-        Header header = new Header("name", "value");
+        Header header = new BasicHeader("name", "value");
         assertEquals("name", header.getName()); 
         assertEquals("value", header.getValue()); 
     }
     
     public void testBasicConstructorNullValue() {
-        Header header = new Header("name", null);
+        Header header = new BasicHeader("name", null);
         assertEquals("name", header.getName()); 
         assertEquals(null, header.getValue()); 
     }
     
     public void testInvalidName() {
         try {
-            new Header(null, null);
+            new BasicHeader(null, null);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             //expected
@@ -77,14 +78,14 @@
     }
     
     public void testToString() {
-        Header header1 = new Header("name1", "value1");
+        Header header1 = new BasicHeader("name1", "value1");
         assertEquals("name1: value1", header1.toString());
-        Header header2 = new Header("name2", null);
+        Header header2 = new BasicHeader("name2", null);
         assertEquals("name2: ", header2.toString());
     }
     
     public void testHeaderElements() {
-        Header header = new Header("name", "element1 = value1, element2; param1 = value1, element3");
+        Header header = new BasicHeader("name", "element1 = value1, element2; param1 = value1, element3");
         HeaderElement[] elements = header.getElements(); 
         assertNotNull(elements); 
         assertEquals(3, elements.length); 
@@ -96,30 +97,30 @@
         assertEquals(null, elements[2].getValue()); 
         assertEquals(1, elements[1].getParameters().length); 
         
-        header = new Header("name", null);
+        header = new BasicHeader("name", null);
         elements = header.getElements();
         assertNotNull(elements); 
         assertEquals(0, elements.length); 
     }    
  
     public void testHeaderFormatting() throws Exception {
-        Header header1 = new Header("name", "value");
-        String s = Header.format(header1); 
+        Header header1 = new BasicHeader("name", "value");
+        String s = BasicHeader.format(header1); 
         assertEquals("name: value", s);
-        Header header2 = new Header("name", null);
-        s = Header.format(header2); 
+        Header header2 = new BasicHeader("name", null);
+        s = BasicHeader.format(header2); 
         assertEquals("name: ", s);
     }
     
     public void testHeaderFormattingInvalidInput() throws Exception {
         try {
-            Header.format(null, new Header("name", "value"));
+            BasicHeader.format(null, new BasicHeader("name", "value"));
             fail("IllegalArgumentException should habe been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
-            Header.format(new CharArrayBuffer(10), (Header) null);
+            BasicHeader.format(new CharArrayBuffer(10), (Header) null);
             fail("IllegalArgumentException should habe been thrown");
         } catch (IllegalArgumentException ex) {
             // expected

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/entity/TestAbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/entity/TestAbstractHttpEntity.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/entity/TestAbstractHttpEntity.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/entity/TestAbstractHttpEntity.java Sun Jul  2 04:04:49 2006
@@ -30,6 +30,7 @@
 package org.apache.http.entity;
 
 import org.apache.http.Header;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.mockup.HttpEntityMockup;
 import org.apache.http.protocol.HTTP;
 
@@ -59,7 +60,7 @@
 
     public void testContentType() throws Exception {
     	HttpEntityMockup httpentity = new HttpEntityMockup();
-        httpentity.setContentType(new Header(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
+        httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
         assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
         assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());
 
@@ -75,7 +76,7 @@
 
     public void testContentEncoding() throws Exception {
         HttpEntityMockup httpentity = new HttpEntityMockup();
-        httpentity.setContentEncoding(new Header(HTTP.CONTENT_ENCODING, "gzip"));
+        httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
         assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
         assertEquals("gzip", httpentity.getContentEncoding().getValue());
 

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java Sun Jul  2 04:04:49 2006
@@ -29,7 +29,6 @@
 package org.apache.http.impl;
 
 import org.apache.http.ConnectionReuseStrategy;
-import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.StatusLine;
@@ -110,7 +109,7 @@
         entity.setContentLength(-1);
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.addHeader(new Header("Connection", "keep-alive"));
+        response.addHeader("Connection", "keep-alive");
         response.setEntity(entity);
 
         ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
@@ -124,7 +123,7 @@
         // Use HTTP 1.1
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.addHeader(new Header("Connection", "close"));
+        response.addHeader("Connection", "close");
         response.setEntity(entity);
 
         ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
@@ -138,7 +137,7 @@
         // Use HTTP 1.0
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK"); 
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.addHeader(new Header("Connection", "keep-alive"));
+        response.addHeader("Connection", "keep-alive");
         response.setEntity(entity);
 
         ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
@@ -173,7 +172,7 @@
         // Use HTTP 1.0
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK"); 
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.addHeader(new Header("Connection", "keep--alive"));
+        response.addHeader("Connection", "keep--alive");
 
         ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
         assertFalse(s.keepAlive(response));
@@ -183,7 +182,7 @@
         // Use HTTP 1.0
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK"); 
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.addHeader(new Header("Connection", null));
+        response.addHeader("Connection", null);
 
         ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
         assertFalse(s.keepAlive(response));

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestHeaderGroup.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestHeaderGroup.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestHeaderGroup.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/TestHeaderGroup.java Sun Jul  2 04:04:49 2006
@@ -32,6 +32,7 @@
 import java.util.Iterator;
 
 import org.apache.http.Header;
+import org.apache.http.message.BasicHeader;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -65,7 +66,7 @@
     
     public void testClear() {
         HeaderGroup headergroup = new HeaderGroup();
-        headergroup.addHeader(new Header("name", "value"));
+        headergroup.addHeader(new BasicHeader("name", "value"));
         assertEquals(1, headergroup.getAllHeaders().length);
         headergroup.clear();
         assertEquals(0, headergroup.getAllHeaders().length);
@@ -73,7 +74,7 @@
     
     public void testAddRemoveHeader() {
         HeaderGroup headergroup = new HeaderGroup();
-        Header header = new Header("name", "value");
+        Header header = new BasicHeader("name", "value");
         headergroup.addHeader(header);
         headergroup.addHeader(null);
         assertEquals(1, headergroup.getAllHeaders().length);
@@ -84,14 +85,14 @@
 
     public void testUpdateHeader() {
         HeaderGroup headergroup = new HeaderGroup();
-        Header header1 = new Header("name1", "value1");
-        Header header2 = new Header("name2", "value2");
-        Header header3 = new Header("name3", "value3");
+        Header header1 = new BasicHeader("name1", "value1");
+        Header header2 = new BasicHeader("name2", "value2");
+        Header header3 = new BasicHeader("name3", "value3");
         headergroup.addHeader(header1);
         headergroup.addHeader(header2);
         headergroup.addHeader(header3);
-        headergroup.updateHeader(new Header("name2", "newvalue"));
-        headergroup.updateHeader(new Header("name4", "value4"));
+        headergroup.updateHeader(new BasicHeader("name2", "newvalue"));
+        headergroup.updateHeader(new BasicHeader("name4", "value4"));
         headergroup.updateHeader(null);
         assertEquals(4, headergroup.getAllHeaders().length);
         assertEquals("newvalue", headergroup.getFirstHeader("name2").getValue());
@@ -99,9 +100,9 @@
 
     public void testSetHeaders() {
         HeaderGroup headergroup = new HeaderGroup();
-        Header header1 = new Header("name1", "value1");
-        Header header2 = new Header("name2", "value2");
-        Header header3 = new Header("name3", "value3");
+        Header header1 = new BasicHeader("name1", "value1");
+        Header header2 = new BasicHeader("name2", "value2");
+        Header header3 = new BasicHeader("name3", "value3");
         headergroup.addHeader(header1);
         headergroup.setHeaders(new Header[] { header2, header3 });
         assertEquals(2, headergroup.getAllHeaders().length);
@@ -117,9 +118,9 @@
 
     public void testFirstLastHeaders() {
         HeaderGroup headergroup = new HeaderGroup();
-        Header header1 = new Header("name", "value1");
-        Header header2 = new Header("name", "value2");
-        Header header3 = new Header("name", "value3");
+        Header header1 = new BasicHeader("name", "value1");
+        Header header2 = new BasicHeader("name", "value2");
+        Header header3 = new BasicHeader("name", "value3");
         headergroup.setHeaders(new Header[] { header1, header2, header3 });
         
         assertNull(headergroup.getFirstHeader("whatever"));
@@ -133,9 +134,9 @@
         HeaderGroup headergroup = new HeaderGroup();
         assertNull(headergroup.getCondensedHeader("name"));
         
-        Header header1 = new Header("name", "value1");
-        Header header2 = new Header("name", "value2");
-        Header header3 = new Header("name", "value3");
+        Header header1 = new BasicHeader("name", "value1");
+        Header header2 = new BasicHeader("name", "value2");
+        Header header3 = new BasicHeader("name", "value3");
         headergroup.setHeaders(new Header[] { header1, header2, header3 });
         
         assertEquals("value1, value2, value3", headergroup.getCondensedHeader("name").getValue());

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java Sun Jul  2 04:04:49 2006
@@ -30,7 +30,6 @@
 
 import java.io.InputStream;
 
-import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpMessage;
 import org.apache.http.ProtocolException;
@@ -88,9 +87,9 @@
         
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Transfer-Encoding", "identity, chunked"));
-        message.addHeader(new Header("Content-Length", "plain wrong"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Transfer-Encoding", "identity, chunked");
+        message.addHeader("Content-Length", "plain wrong");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -114,9 +113,9 @@
         
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Transfer-Encoding", "identity"));
-        message.addHeader(new Header("Content-Length", "plain wrong"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Transfer-Encoding", "identity");
+        message.addHeader("Content-Length", "plain wrong");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -130,9 +129,9 @@
         
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Transfer-Encoding", "whatever; param=value, chunked"));
-        message.addHeader(new Header("Content-Length", "plain wrong"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Transfer-Encoding", "whatever; param=value, chunked");
+        message.addHeader("Content-Length", "plain wrong");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -156,9 +155,9 @@
         
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Transfer-Encoding", "chunked, identity"));
-        message.addHeader(new Header("Content-Length", "plain wrong"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Transfer-Encoding", "chunked, identity");
+        message.addHeader("Content-Length", "plain wrong");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -182,8 +181,8 @@
         
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Content-Length", "0"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Content-Length", "0");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -198,10 +197,10 @@
 
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Content-Length", "0"));
-        message.addHeader(new Header("Content-Length", "0"));
-        message.addHeader(new Header("Content-Length", "1"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Content-Length", "0");
+        message.addHeader("Content-Length", "0");
+        message.addHeader("Content-Length", "1");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -227,10 +226,10 @@
 
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Content-Length", "1"));
-        message.addHeader(new Header("Content-Length", "yyy"));
-        message.addHeader(new Header("Content-Length", "xxx"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Content-Length", "1");
+        message.addHeader("Content-Length", "yyy");
+        message.addHeader("Content-Length", "xxx");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -256,9 +255,9 @@
 
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Content-Length", "yyy"));
-        message.addHeader(new Header("Content-Length", "xxx"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Content-Length", "yyy");
+        message.addHeader("Content-Length", "xxx");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -285,8 +284,8 @@
 
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
-        message.addHeader(new Header("Content-Type", "unknown"));
-        message.addHeader(new Header("Content-Length", "xxx"));
+        message.addHeader("Content-Type", "unknown");
+        message.addHeader("Content-Length", "xxx");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -329,7 +328,7 @@
         HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
         HttpMessage message = new HttpMessageMockup();
 
-        message.addHeader(new Header("Content-Type", "stuff"));
+        message.addHeader("Content-Type", "stuff");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -341,7 +340,7 @@
         HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
         HttpMessage message = new HttpMessageMockup();
 
-        message.addHeader(new Header("Content-Encoding", "what not"));
+        message.addHeader("Content-Encoding", "what not");
         EntityDeserializer entitygen = new DefaultEntityDeserializer();
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntitySerializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntitySerializer.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntitySerializer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/impl/entity/TestDefaultEntitySerializer.java Sun Jul  2 04:04:49 2006
@@ -34,7 +34,6 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.http.Header;
 import org.apache.http.HttpMessage;
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolException;
@@ -91,7 +90,7 @@
     public void testEntityWithChunkTransferEncoding() throws Exception {
         HttpDataTransmitter datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Transfer-Encoding", "Chunked"));
+        message.addHeader("Transfer-Encoding", "Chunked");
 
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         OutputStream outstream = entitywriter.doSerialize(datatransmitter, message);
@@ -102,7 +101,7 @@
     public void testEntityWithIdentityTransferEncoding() throws Exception {
         HttpDataTransmitter datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Transfer-Encoding", "Identity"));
+        message.addHeader("Transfer-Encoding", "Identity");
 
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         OutputStream outstream = entitywriter.doSerialize(datatransmitter, message);
@@ -113,7 +112,7 @@
     public void testEntityWithInvalidTransferEncoding() throws Exception {
         HttpDataTransmitter datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Transfer-Encoding", "whatever"));
+        message.addHeader("Transfer-Encoding", "whatever");
 
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         try {
@@ -129,7 +128,7 @@
         HttpMessage message = new HttpMessageMockup();
         message.getParams().setParameter(HttpProtocolParams.PROTOCOL_VERSION, 
                 HttpVersion.HTTP_1_0);
-        message.addHeader(new Header("Transfer-Encoding", "chunked"));
+        message.addHeader("Transfer-Encoding", "chunked");
 
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         try {
@@ -143,7 +142,7 @@
     public void testEntityWithContentLength() throws Exception {
         HttpDataTransmitter datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Content-Length", "100"));
+        message.addHeader("Content-Length", "100");
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         OutputStream outstream = entitywriter.doSerialize(datatransmitter, message);
         assertNotNull(outstream);
@@ -153,7 +152,7 @@
     public void testEntityWithInvalidContentLength() throws Exception {
         HttpDataTransmitter datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Content-Length", "whatever"));
+        message.addHeader("Content-Length", "whatever");
 
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         try {
@@ -179,7 +178,7 @@
         
         HttpDataTransmitterMockup datatransmitter = new HttpDataTransmitterMockup();
         HttpMessage message = new HttpMessageMockup();
-        message.addHeader(new Header("Content-Length", Integer.toString(content.length)));
+        message.addHeader("Content-Length", Integer.toString(content.length));
         
         DefaultEntitySerializer entitywriter = new DefaultEntitySerializer();
         entitywriter.serialize(datatransmitter, message, entity);

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/protocol/TestStandardInterceptors.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/protocol/TestStandardInterceptors.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/protocol/TestStandardInterceptors.java Sun Jul  2 04:04:49 2006
@@ -40,6 +40,7 @@
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.io.PlainSocketFactory;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
@@ -75,13 +76,12 @@
         Header header = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
         assertNotNull(header);
         assertEquals(HTTP.CONN_KEEP_ALIVE, header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
     
     public void testRequestConnControlCustom() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        Header myheader = new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
+        Header myheader = new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
         request.addHeader(myheader);
         RequestConnControl interceptor = new RequestConnControl();
         interceptor.process(request, context);
@@ -104,9 +104,9 @@
     public void testRequestContentProtocolException() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request1.addHeader(new Header(HTTP.TRANSFER_ENCODING, "chunked"));
+        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
         BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request2.addHeader(new Header(HTTP.CONTENT_LEN, "12"));
+        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));
 
         RequestContent interceptor = new RequestContent();
         try {
@@ -132,7 +132,6 @@
         Header header = request.getFirstHeader(HTTP.CONTENT_LEN);
         assertNotNull(header);
         assertEquals("0", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
         assertNull(request.getFirstHeader(HTTP.TRANSFER_ENCODING));
    }
     
@@ -148,7 +147,6 @@
         Header header = request.getFirstHeader(HTTP.CONTENT_LEN);
         assertNotNull(header);
         assertEquals(s.length(), Integer.parseInt(header.getValue()));
-        assertTrue(header instanceof GeneratedHeader);
         assertNull(request.getFirstHeader(HTTP.TRANSFER_ENCODING));
    }
     
@@ -165,7 +163,6 @@
         Header header = request.getFirstHeader(HTTP.TRANSFER_ENCODING);
         assertNotNull(header);
         assertEquals("chunked", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
         assertNull(request.getFirstHeader(HTTP.CONTENT_LEN));
    }
     
@@ -182,7 +179,6 @@
         Header header = request.getFirstHeader(HTTP.TRANSFER_ENCODING);
         assertNotNull(header);
         assertEquals("chunked", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
         assertNull(request.getFirstHeader(HTTP.CONTENT_LEN));
     }
 
@@ -282,7 +278,6 @@
         Header header = request.getFirstHeader(HTTP.EXPECT_DIRECTIVE);
         assertNotNull(header);
         assertEquals(HTTP.EXPECT_CONTINUE, header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
 
     public void testRequestExpectContinueNotGenerated() throws Exception {
@@ -354,7 +349,6 @@
         Header header = request.getFirstHeader(HTTP.TARGET_HOST);
         assertNotNull(header);
         assertEquals("somehost:8080", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
 
     public void testRequestTargetHostNotGenerated() throws Exception {
@@ -363,13 +357,12 @@
         HttpHost host = new HttpHost("somehost", 8080, http);
         context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, host);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new Header(HTTP.TARGET_HOST, "whatever"));
+        request.addHeader(new BasicHeader(HTTP.TARGET_HOST, "whatever"));
         RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         Header header = request.getFirstHeader(HTTP.TARGET_HOST);
         assertNotNull(header);
         assertEquals("whatever", header.getValue());
-        assertFalse(header instanceof GeneratedHeader);
     }
 
     public void testRequestTargetHostMissingHostHTTP10() throws Exception {
@@ -406,7 +399,6 @@
         Header header = request.getFirstHeader(HTTP.TARGET_HOST);
         assertNotNull(header);
         assertEquals("whatever:8080", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
 
     public void testRequestTargetHostInvalidInput() throws Exception {
@@ -434,20 +426,18 @@
         Header header = request.getFirstHeader(HTTP.USER_AGENT);
         assertNotNull(header);
         assertEquals("some agent", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
 
     public void testRequestUserAgentNotGenerated() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         request.getParams().setParameter(HttpProtocolParams.USER_AGENT, "some agent");
-        request.addHeader(new Header(HTTP.USER_AGENT, "whatever"));
+        request.addHeader(new BasicHeader(HTTP.USER_AGENT, "whatever"));
         RequestUserAgent interceptor = new RequestUserAgent();
         interceptor.process(request, context);
         Header header = request.getFirstHeader(HTTP.USER_AGENT);
         assertNotNull(header);
         assertEquals("whatever", header.getValue());
-        assertFalse(header instanceof GeneratedHeader);
     }
 
     public void testRequestUserAgentMissingUserAgent() throws Exception {
@@ -492,7 +482,7 @@
     public void testResponseConnControlEntityUnknownContentLength() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
         context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
         BasicHttpResponse response = new BasicHttpResponse();
         BasicHttpEntity entity = new BasicHttpEntity();
@@ -502,7 +492,6 @@
         Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
         assertNotNull(header);
         assertEquals(HTTP.CONN_CLOSE, header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
     
     public void testResponseConnControlEntityChunked() throws Exception {
@@ -520,7 +509,7 @@
     public void testResponseConnControlEntityUnknownContentLengthHTTP10() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
         context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
 
         BasicHttpResponse response = new BasicHttpResponse(
@@ -532,13 +521,12 @@
         Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
         assertNotNull(header);
         assertEquals(HTTP.CONN_CLOSE, header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
 
     public void testResponseConnControlClientRequest() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
         context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
 
         BasicHttpResponse response = new BasicHttpResponse();
@@ -549,7 +537,6 @@
         Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
         assertNotNull(header);
         assertEquals(HTTP.CONN_KEEP_ALIVE, header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
     
     public void testResponseConnControlClientRequest2() throws Exception {
@@ -569,7 +556,7 @@
     public void testResponseConnControlStatusCode() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
+        request.addHeader(new BasicHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE));
         context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
 
         ResponseConnControl interceptor = new ResponseConnControl();
@@ -591,7 +578,6 @@
             Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
             assertNotNull(header);
             assertEquals(HTTP.CONN_CLOSE, header.getValue());
-            assertTrue(header instanceof GeneratedHeader);
         }
         
     }
@@ -620,7 +606,6 @@
         Header header = response.getFirstHeader(HTTP.CONTENT_LEN);
         assertNotNull(header);
         assertEquals("0", header.getValue());
-        assertTrue(header instanceof GeneratedHeader);
     }
     
     public void testResponseContentStatusNoContent() throws Exception {
@@ -664,7 +649,6 @@
         Header h1 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
         assertNotNull(h1);
         assertEquals(HTTP.CHUNK_CODING, h1.getValue());
-        assertTrue(h1 instanceof GeneratedHeader);
         Header h2 = response.getFirstHeader(HTTP.CONTENT_LEN);
         assertNull(h2);
     }
@@ -680,7 +664,6 @@
         Header h1 = response.getFirstHeader(HTTP.CONTENT_LEN);
         assertNotNull(h1);
         assertEquals("10", h1.getValue());
-        assertTrue(h1 instanceof GeneratedHeader);
         Header h2 = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
         assertNull(h2);
     }
@@ -758,7 +741,7 @@
         HttpContext context = new HttpExecutionContext(null);
         try {
             BasicHttpResponse response = new BasicHttpResponse();
-            response.addHeader(new Header(HTTP.CONTENT_LEN, "10"));
+            response.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "10"));
             interceptor.process(response, context);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
@@ -766,7 +749,7 @@
         }
         try {
             BasicHttpResponse response = new BasicHttpResponse();
-            response.addHeader(new Header(HTTP.TRANSFER_ENCODING, "stuff"));
+            response.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "stuff"));
             interceptor.process(response, context);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
@@ -815,20 +798,18 @@
         Header h1 = response.getFirstHeader(HTTP.SERVER_DIRECTIVE);
         assertNotNull(h1);
         assertEquals("some server", h1.getValue());
-        assertTrue(h1 instanceof GeneratedHeader);
     }
         
     public void testResponseServerNotGenerated() throws Exception {
         HttpContext context = new HttpExecutionContext(null);
         BasicHttpResponse response = new BasicHttpResponse();
         response.getParams().setParameter(HttpProtocolParams.ORIGIN_SERVER, "some server");
-        response.addHeader(new Header(HTTP.SERVER_DIRECTIVE, "whatever"));
+        response.addHeader(new BasicHeader(HTTP.SERVER_DIRECTIVE, "whatever"));
         ResponseServer interceptor = new ResponseServer();
         interceptor.process(response, context);
         Header h1 = response.getFirstHeader(HTTP.SERVER_DIRECTIVE);
         assertNotNull(h1);
         assertEquals("whatever", h1.getValue());
-        assertFalse(h1 instanceof GeneratedHeader);
     }
         
     public void testResponseServerMissing() throws Exception {

Modified: jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/util/TestEntityUtils.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/util/TestEntityUtils.java?rev=418570&r1=418569&r2=418570&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/util/TestEntityUtils.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/src/test/org/apache/http/util/TestEntityUtils.java Sun Jul  2 04:04:49 2006
@@ -34,6 +34,7 @@
 
 import org.apache.http.Header;
 import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHeader;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -131,13 +132,13 @@
     
     public void testNoCharsetGetContentCharset() throws Exception {
         BasicHttpEntity httpentity = new BasicHttpEntity();
-        httpentity.setContentType(new Header("Content-Type", "text/plain; param=yadayada"));
+        httpentity.setContentType(new BasicHeader("Content-Type", "text/plain; param=yadayada"));
         assertNull(EntityUtils.getContentCharSet(httpentity));
     }
     
     public void testGetContentCharset() throws Exception {
         BasicHttpEntity httpentity = new BasicHttpEntity();
-        httpentity.setContentType(new Header("Content-Type", "text/plain; charset = UTF-8"));
+        httpentity.setContentType(new BasicHeader("Content-Type", "text/plain; charset = UTF-8"));
         assertEquals("UTF-8", EntityUtils.getContentCharSet(httpentity));
     }
     
@@ -212,7 +213,7 @@
         byte[] bytes = content.getBytes("ISO-8859-1");
         BasicHttpEntity httpentity = new BasicHttpEntity();
         httpentity.setContent(new ByteArrayInputStream(bytes));
-        httpentity.setContentType(new Header("Content-Type", "text/plain"));
+        httpentity.setContentType(new BasicHeader("Content-Type", "text/plain"));
         String s = EntityUtils.toString(httpentity);
         assertEquals(content, s);
     }
@@ -222,7 +223,7 @@
         byte[] bytes = content.getBytes("KOI8-R");
         BasicHttpEntity httpentity = new BasicHttpEntity();
         httpentity.setContent(new ByteArrayInputStream(bytes));
-        httpentity.setContentType(new Header("Content-Type", "text/plain"));
+        httpentity.setContentType(new BasicHeader("Content-Type", "text/plain"));
         String s = EntityUtils.toString(httpentity, "KOI8-R");
         assertEquals(content, s);
     }
@@ -232,7 +233,7 @@
         byte[] bytes = content.getBytes("UTF-8");
         BasicHttpEntity httpentity = new BasicHttpEntity();
         httpentity.setContent(new ByteArrayInputStream(bytes));
-        httpentity.setContentType(new Header("Content-Type", "text/plain; charset=UTF-8"));
+        httpentity.setContentType(new BasicHeader("Content-Type", "text/plain; charset=UTF-8"));
         String s = EntityUtils.toString(httpentity, "ISO-8859-1");
         assertEquals(content, s);
     }



Mime
View raw message