1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.handler.codec.spdy;
17
18 import java.util.List;
19 import java.util.Map;
20 import java.util.Set;
21
22 import org.jboss.netty.util.internal.StringUtil;
23
24
25
26
27 public class DefaultSpdyHeaderBlock implements SpdyHeaderBlock {
28
29 private boolean invalid;
30 private final SpdyHeaders headers = new SpdyHeaders();
31
32
33
34
35 protected DefaultSpdyHeaderBlock() {
36 }
37
38 public boolean isInvalid() {
39 return invalid;
40 }
41
42 public void setInvalid() {
43 invalid = true;
44 }
45
46 public void addHeader(final String name, final Object value) {
47 headers.addHeader(name, value);
48 }
49
50 public void setHeader(final String name, final Object value) {
51 headers.setHeader(name, value);
52 }
53
54 public void setHeader(final String name, final Iterable<?> values) {
55 headers.setHeader(name, values);
56 }
57
58 public void removeHeader(final String name) {
59 headers.removeHeader(name);
60 }
61
62 public void clearHeaders() {
63 headers.clearHeaders();
64 }
65
66 public String getHeader(final String name) {
67 return headers.getHeader(name);
68 }
69
70 public List<String> getHeaders(final String name) {
71 return headers.getHeaders(name);
72 }
73
74 public List<Map.Entry<String, String>> getHeaders() {
75 return headers.getHeaders();
76 }
77
78 public boolean containsHeader(final String name) {
79 return headers.containsHeader(name);
80 }
81
82 public Set<String> getHeaderNames() {
83 return headers.getHeaderNames();
84 }
85
86 protected void appendHeaders(StringBuilder buf) {
87 for (Map.Entry<String, String> e: getHeaders()) {
88 buf.append(" ");
89 buf.append(e.getKey());
90 buf.append(": ");
91 buf.append(e.getValue());
92 buf.append(StringUtil.NEWLINE);
93 }
94 }
95 }