From c1704039f0a40d56d13a5fef348148150809b913 Mon Sep 17 00:00:00 2001 From: Bill Gallagher Date: Fri, 11 Oct 2013 15:49:33 -0400 Subject: [PATCH] bring back entries() --- .../codec/spdy/DefaultSpdyHeaders.java | 13 +++++++++++++ .../netty/handler/codec/spdy/SpdyHeaders.java | 19 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyHeaders.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyHeaders.java index 13b210554e..afba8ed707 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyHeaders.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyHeaders.java @@ -239,6 +239,19 @@ public class DefaultSpdyHeaders extends SpdyHeaders { return values; } + @Override + public List> entries() { + List> all = + new LinkedList>(); + + HeaderEntry e = head.after; + while (e != head) { + all.add(e); + e = e.after; + } + return all; + } + @Override public Iterator> iterator() { return new HeaderIterator(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHeaders.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHeaders.java index 447d7d07f5..3e073370d2 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHeaders.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHeaders.java @@ -38,6 +38,11 @@ public abstract class SpdyHeaders implements Iterable> return Collections.emptyList(); } + @Override + public List> entries() { + return Collections.emptyList(); + } + @Override public boolean contains(String name) { return false; @@ -85,7 +90,7 @@ public abstract class SpdyHeaders implements Iterable> @Override public Iterator> iterator() { - return Collections.>emptyList().iterator(); + return entries().iterator(); } @Override @@ -415,6 +420,10 @@ public abstract class SpdyHeaders implements Iterable> frame.headers().set(HttpNames.VERSION, httpVersion.text()); } } + @Override + public Iterator> iterator() { + return entries().iterator(); + } /** * Returns the header value with the specified header name. If there is @@ -433,6 +442,14 @@ public abstract class SpdyHeaders implements Iterable> */ public abstract List getAll(String name); + /** + * Returns all header names and values that this frame contains. + * + * @return the {@link List} of the header name-value pairs. An empty list + * if there is no header in this message. + */ + public abstract List> entries(); + /** * Returns {@code true} if and only if there is a header with the specified * header name.