1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.spdy;
17
18 import io.netty.handler.codec.http.HttpHeaders;
19 import io.netty.handler.codec.http.HttpMessage;
20
21
22
23
24
25 public final class SpdyHttpHeaders {
26
27
28
29
30 public static final class Names {
31
32
33
34 public static final String STREAM_ID = "x-spdy-stream-id";
35
36
37
38 public static final String ASSOCIATED_TO_STREAM_ID = "x-spdy-associated-to-stream-id";
39
40
41
42 public static final String PRIORITY = "x-spdy-priority";
43
44
45
46 public static final String SCHEME = "x-spdy-scheme";
47
48 private Names() { }
49 }
50
51 private SpdyHttpHeaders() {
52 }
53
54
55
56
57 public static void removeStreamId(HttpMessage message) {
58 message.headers().remove(Names.STREAM_ID);
59 }
60
61
62
63
64 public static int getStreamId(HttpMessage message) {
65 return HttpHeaders.getIntHeader(message, Names.STREAM_ID);
66 }
67
68
69
70
71 public static void setStreamId(HttpMessage message, int streamId) {
72 HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamId);
73 }
74
75
76
77
78 public static void removeAssociatedToStreamId(HttpMessage message) {
79 message.headers().remove(Names.ASSOCIATED_TO_STREAM_ID);
80 }
81
82
83
84
85
86
87
88 public static int getAssociatedToStreamId(HttpMessage message) {
89 return HttpHeaders.getIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, 0);
90 }
91
92
93
94
95 public static void setAssociatedToStreamId(HttpMessage message, int associatedToStreamId) {
96 HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamId);
97 }
98
99
100
101
102 public static void removePriority(HttpMessage message) {
103 message.headers().remove(Names.PRIORITY);
104 }
105
106
107
108
109
110
111
112 public static byte getPriority(HttpMessage message) {
113 return (byte) HttpHeaders.getIntHeader(message, Names.PRIORITY, 0);
114 }
115
116
117
118
119 public static void setPriority(HttpMessage message, byte priority) {
120 HttpHeaders.setIntHeader(message, Names.PRIORITY, priority);
121 }
122
123
124
125
126 public static void removeScheme(HttpMessage message) {
127 message.headers().remove(Names.SCHEME);
128 }
129
130
131
132
133 public static String getScheme(HttpMessage message) {
134 return message.headers().get(Names.SCHEME);
135 }
136
137
138
139
140 public static void setScheme(HttpMessage message, String scheme) {
141 message.headers().set(Names.SCHEME, scheme);
142 }
143 }