Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: pkg/http_multi_server/lib/src/multi_headers.dart

Issue 469583002: Add support for HttpServer.defaultResponseHeaders to HttpMultiServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/http_multi_server/lib/http_multi_server.dart ('k') | pkg/http_multi_server/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library http_multi_server.multi_headers;
6
7 import 'dart:io';
8
9 /// A class that delegates header access and setting to many [HttpHeaders]
10 /// instances.
11 class MultiHeaders implements HttpHeaders {
12 /// The wrapped headers.
13 final Set<HttpHeaders> _headers;
14
15 bool get chunkedTransferEncoding => _headers.first.chunkedTransferEncoding;
16 set chunkedTransferEncoding(bool value) {
17 for (var headers in _headers) {
18 headers.chunkedTransferEncoding = value;
19 }
20 }
21
22 int get contentLength => _headers.first.contentLength;
23 set contentLength(int value) {
24 for (var headers in _headers) {
25 headers.contentLength = value;
26 }
27 }
28
29 ContentType get contentType => _headers.first.contentType;
30 set contentType(ContentType value) {
31 for (var headers in _headers) {
32 headers.contentType = value;
33 }
34 }
35
36 DateTime get date => _headers.first.date;
37 set date(DateTime value) {
38 for (var headers in _headers) {
39 headers.date = value;
40 }
41 }
42
43 DateTime get expires => _headers.first.expires;
44 set expires(DateTime value) {
45 for (var headers in _headers) {
46 headers.expires = value;
47 }
48 }
49
50 String get host => _headers.first.host;
51 set host(String value) {
52 for (var headers in _headers) {
53 headers.host = value;
54 }
55 }
56
57 DateTime get ifModifiedSince => _headers.first.ifModifiedSince;
58 set ifModifiedSince(DateTime value) {
59 for (var headers in _headers) {
60 headers.ifModifiedSince = value;
61 }
62 }
63
64 bool get persistentConnection => _headers.first.persistentConnection;
65 set persistentConnection(bool value) {
66 for (var headers in _headers) {
67 headers.persistentConnection = value;
68 }
69 }
70
71 int get port => _headers.first.port;
72 set port(int value) {
73 for (var headers in _headers) {
74 headers.port = value;
75 }
76 }
77
78 MultiHeaders(Iterable<HttpHeaders> headers)
79 : _headers = headers.toSet();
80
81 void add(String name, Object value) {
82 for (var headers in _headers) {
83 headers.add(name, value);
84 }
85 }
86
87 void forEach(void f(String name, List<String> values)) =>
88 _headers.first.forEach(f);
89
90 void noFolding(String name) {
91 for (var headers in _headers) {
92 headers.noFolding(name);
93 }
94 }
95
96 void remove(String name, Object value) {
97 for (var headers in _headers) {
98 headers.remove(name);
99 }
100 }
101
102 void removeAll(String name) {
103 for (var headers in _headers) {
104 headers.removeAll(name, value);
105 }
106 }
107
108 void set(String name, Object value) {
109 for (var headers in _headers) {
110 headers.set(name, value);
111 }
112 }
113
114 String value(String name) => _headers.first.value(name);
115
116 List<String> operator[](String name) => _headers.first[name];
117 }
OLDNEW
« no previous file with comments | « pkg/http_multi_server/lib/http_multi_server.dart ('k') | pkg/http_multi_server/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698