hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1730525 - in /httpcomponents/httpcore/trunk/httpcore5/src: main/java/org/apache/hc/core5/http/ main/java/org/apache/hc/core5/http/message/ test/java/org/apache/hc/core5/http/impl/io/ test/java/org/apache/hc/core5/http/message/
Date Mon, 15 Feb 2016 13:34:31 GMT
Author: olegk
Date: Mon Feb 15 13:34:31 2016
New Revision: 1730525

URL: http://svn.apache.org/viewvc?rev=1730525&view=rev
Log:
Removed #getElements from Header interface

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Header.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHeader.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BufferedHeader.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Header.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Header.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Header.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Header.java
Mon Feb 15 13:34:31 2016
@@ -48,11 +48,4 @@ public interface Header {
      */
     String getValue();
 
-    /**
-     * Parses the value.
-     *
-     * @return an array of {@link HeaderElement} entries, may be empty, but is never {@code
null}
-     */
-    HeaderElement[] getElements();
-
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHeader.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHeader.java
Mon Feb 15 13:34:31 2016
@@ -32,19 +32,16 @@ import java.util.Objects;
 
 import org.apache.hc.core5.annotation.Immutable;
 import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HeaderElement;
 import org.apache.hc.core5.util.Args;
 
 /**
- * Basic implementation of {@link Header}.
+ * Immutable {@link Header}.
  *
  * @since 4.0
  */
 @Immutable
 public class BasicHeader implements Header, Serializable {
 
-    private static final HeaderElement[] EMPTY_HEADER_ELEMENT_ARRAY = new HeaderElement[0];
-
     private static final long serialVersionUID = -5427236326487562174L;
 
     private final String name;
@@ -82,13 +79,4 @@ public class BasicHeader implements Head
         return buf.toString();
     }
 
-    @Override
-    public HeaderElement[] getElements() {
-        if (this.value != null) {
-            final ParserCursor cursor = new ParserCursor(0, this.value.length());
-            return BasicHeaderValueParser.INSTANCE.parseElements(this.value, cursor);
-        }
-        return EMPTY_HEADER_ELEMENT_ARRAY;
-    }
-
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BufferedHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BufferedHeader.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BufferedHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BufferedHeader.java
Mon Feb 15 13:34:31 2016
@@ -31,7 +31,6 @@ import java.io.Serializable;
 
 import org.apache.hc.core5.annotation.NotThreadSafe;
 import org.apache.hc.core5.http.FormattedHeader;
-import org.apache.hc.core5.http.HeaderElement;
 import org.apache.hc.core5.http.ParseException;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.CharArrayBuffer;
@@ -116,13 +115,6 @@ public class BufferedHeader implements F
     }
 
     @Override
-    public HeaderElement[] getElements() {
-        final ParserCursor cursor = new ParserCursor(0, this.buffer.length());
-        cursor.updatePos(this.valuePos);
-        return BasicHeaderValueParser.INSTANCE.parseElements(this.buffer, cursor);
-    }
-
-    @Override
     public int getValuePos() {
         return this.valuePos;
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestMessageParser.java
Mon Feb 15 13:34:31 2016
@@ -32,8 +32,6 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HeaderElement;
-import org.apache.hc.core5.http.NameValuePair;
 import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.http.io.SessionInputBuffer;
 import org.junit.Assert;
@@ -77,18 +75,6 @@ public class TestMessageParser {
         Assert.assertNotNull(headers);
         Assert.assertEquals(1, headers.length);
         Assert.assertEquals("header1: stuff; param1 = value1; param2 = \"value 2\" ", headers[0].toString());
-        final HeaderElement[] elements = headers[0].getElements();
-        Assert.assertNotNull(elements);
-        Assert.assertEquals(1, elements.length);
-        Assert.assertEquals("stuff", elements[0].getName());
-        Assert.assertEquals(null, elements[0].getValue());
-        final NameValuePair[] params = elements[0].getParameters();
-        Assert.assertNotNull(params);
-        Assert.assertEquals(2, params.length);
-        Assert.assertEquals("param1", params[0].getName());
-        Assert.assertEquals("value1", params[0].getValue());
-        Assert.assertEquals("param2", params[1].getName());
-        Assert.assertEquals("value 2", params[1].getValue());
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBufferedHeader.java
Mon Feb 15 13:34:31 2016
@@ -32,7 +32,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import org.apache.hc.core5.http.HeaderElement;
 import org.apache.hc.core5.http.ParseException;
 import org.apache.hc.core5.util.CharArrayBuffer;
 import org.junit.Assert;
@@ -56,23 +55,6 @@ public class TestBufferedHeader {
     }
 
     @Test
-    public void testHeaderElements()  throws Exception {
-        final CharArrayBuffer buf = new CharArrayBuffer(32);
-        buf.append("name: element1 = value1, element2; param1 = value1, element3");
-        final BufferedHeader header = new BufferedHeader(buf, false);
-        final HeaderElement[] elements = header.getElements();
-        Assert.assertNotNull(elements);
-        Assert.assertEquals(3, elements.length);
-        Assert.assertEquals("element1", elements[0].getName());
-        Assert.assertEquals("value1", elements[0].getValue());
-        Assert.assertEquals("element2", elements[1].getName());
-        Assert.assertEquals(null, elements[1].getValue());
-        Assert.assertEquals("element3", elements[2].getName());
-        Assert.assertEquals(null, elements[2].getValue());
-        Assert.assertEquals(1, elements[1].getParameters().length);
-    }
-
-    @Test
     public void testSerialization() throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(32);
         buf.append("name: value");

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java?rev=1730525&r1=1730524&r2=1730525&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
Mon Feb 15 13:34:31 2016
@@ -33,7 +33,6 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
 import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HeaderElement;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -75,26 +74,6 @@ public class TestHeader {
     }
 
     @Test
-    public void testHeaderElements() {
-        Header header = new BasicHeader("name", "element1 = value1, element2; param1 = value1,
element3");
-        HeaderElement[] elements = header.getElements();
-        Assert.assertNotNull(elements);
-        Assert.assertEquals(3, elements.length);
-        Assert.assertEquals("element1", elements[0].getName());
-        Assert.assertEquals("value1", elements[0].getValue());
-        Assert.assertEquals("element2", elements[1].getName());
-        Assert.assertEquals(null, elements[1].getValue());
-        Assert.assertEquals("element3", elements[2].getName());
-        Assert.assertEquals(null, elements[2].getValue());
-        Assert.assertEquals(1, elements[1].getParameters().length);
-
-        header = new BasicHeader("name", null);
-        elements = header.getElements();
-        Assert.assertNotNull(elements);
-        Assert.assertEquals(0, elements.length);
-    }
-
-    @Test
     public void testSerialization() throws Exception {
         final BasicHeader orig = new BasicHeader("name1", "value1");
         final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();



Mime
View raw message