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 org.jboss.netty.handler.codec.http.HttpHeaders;
19 import org.jboss.netty.handler.codec.http.HttpMessage;
20
21
22
23
24
25
26 public final class SpdyHttpHeaders {
27
28
29
30
31
32 public static final class Names {
33
34
35
36 public static final String STREAM_ID = "X-SPDY-Stream-ID";
37
38
39
40 public static final String ASSOCIATED_TO_STREAM_ID = "X-SPDY-Associated-To-Stream-ID";
41
42
43
44 public static final String PRIORITY = "X-SPDY-Priority";
45
46
47
48 public static final String URL = "X-SPDY-URL";
49
50
51
52 public static final String SCHEME = "X-SPDY-Scheme";
53
54 private Names() {
55 }
56 }
57
58 private SpdyHttpHeaders() {
59 }
60
61
62
63
64 public static void removeStreamId(HttpMessage message) {
65 message.headers().remove(Names.STREAM_ID);
66 }
67
68
69
70
71 public static int getStreamId(HttpMessage message) {
72 return HttpHeaders.getIntHeader(message, Names.STREAM_ID);
73 }
74
75
76
77
78 public static void setStreamId(HttpMessage message, int streamId) {
79 HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamId);
80 }
81
82
83
84
85 public static void removeAssociatedToStreamId(HttpMessage message) {
86 message.headers().remove(Names.ASSOCIATED_TO_STREAM_ID);
87 }
88
89
90
91
92
93
94
95 public static int getAssociatedToStreamId(HttpMessage message) {
96 return HttpHeaders.getIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, 0);
97 }
98
99
100
101
102 public static void setAssociatedToStreamId(HttpMessage message, int associatedToStreamId) {
103 HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamId);
104 }
105
106
107
108
109 public static void removePriority(HttpMessage message) {
110 message.headers().remove(Names.PRIORITY);
111 }
112
113
114
115
116
117
118
119 public static byte getPriority(HttpMessage message) {
120 return (byte) HttpHeaders.getIntHeader(message, Names.PRIORITY, 0);
121 }
122
123
124
125
126 public static void setPriority(HttpMessage message, byte priority) {
127 HttpHeaders.setIntHeader(message, Names.PRIORITY, priority);
128 }
129
130
131
132
133 public static void removeUrl(HttpMessage message) {
134 message.headers().remove(Names.URL);
135 }
136
137
138
139
140 public static String getUrl(HttpMessage message) {
141 return message.headers().get(Names.URL);
142 }
143
144
145
146
147 public static void setUrl(HttpMessage message, String url) {
148 message.headers().set(Names.URL, url);
149 }
150
151
152
153
154 public static void removeScheme(HttpMessage message) {
155 message.headers().remove(Names.SCHEME);
156 }
157
158
159
160
161 public static String getScheme(HttpMessage message) {
162 return message.headers().get(Names.SCHEME);
163 }
164
165
166
167
168 public static void setScheme(HttpMessage message, String scheme) {
169 message.headers().set(Names.SCHEME, scheme);
170 }
171 }