OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of http_server; | 5 part of http_server; |
6 | 6 |
7 | 7 |
8 /** | 8 /** |
9 * [HttpBodyHandler] is a helper class for processing and collecting | 9 * [HttpBodyHandler] is a helper class for processing and collecting |
10 * HTTP message data in an easy-to-use [HttpBody] object. The content | 10 * HTTP message data in an easy-to-use [HttpBody] object. The content |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 /** | 97 /** |
98 * Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>, | 98 * Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>, |
99 * e.g. a [HttpServer]. | 99 * e.g. a [HttpServer]. |
100 * | 100 * |
101 * If the page is served using different encoding than UTF-8, set | 101 * If the page is served using different encoding than UTF-8, set |
102 * [defaultEncoding] accordingly. This is required for parsing | 102 * [defaultEncoding] accordingly. This is required for parsing |
103 * `multipart/form-data` content correctly. See the class comment | 103 * `multipart/form-data` content correctly. See the class comment |
104 * for more information on `multipart/form-data`. | 104 * for more information on `multipart/form-data`. |
105 */ | 105 */ |
106 HttpBodyHandler({Encoding defaultEncoding: Encoding.UTF_8}) | 106 HttpBodyHandler({Encoding defaultEncoding: UTF8}) |
107 : _transformer = new _HttpBodyHandlerTransformer(defaultEncoding); | 107 : _transformer = new _HttpBodyHandlerTransformer(defaultEncoding); |
108 | 108 |
109 /** | 109 /** |
110 * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody] | 110 * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody] |
111 * contains a [response] field for accessing the [HttpResponse]. | 111 * contains a [response] field for accessing the [HttpResponse]. |
112 * | 112 * |
113 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. | 113 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. |
114 */ | 114 */ |
115 static Future<HttpRequestBody> processRequest( | 115 static Future<HttpRequestBody> processRequest( |
116 HttpRequest request, | 116 HttpRequest request, |
117 {Encoding defaultEncoding: Encoding.UTF_8}) { | 117 {Encoding defaultEncoding: UTF8}) { |
118 return _HttpBodyHandler.processRequest(request, defaultEncoding); | 118 return _HttpBodyHandler.processRequest(request, defaultEncoding); |
119 } | 119 } |
120 | 120 |
121 /** | 121 /** |
122 * Process and parse an incoming [HttpClientResponse]. | 122 * Process and parse an incoming [HttpClientResponse]. |
123 * | 123 * |
124 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. | 124 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. |
125 */ | 125 */ |
126 static Future<HttpClientResponseBody> processResponse( | 126 static Future<HttpClientResponseBody> processResponse( |
127 HttpClientResponse response, | 127 HttpClientResponse response, |
128 {Encoding defaultEncoding: Encoding.UTF_8}) { | 128 {Encoding defaultEncoding: UTF8}) { |
129 return _HttpBodyHandler.processResponse(response, defaultEncoding); | 129 return _HttpBodyHandler.processResponse(response, defaultEncoding); |
130 } | 130 } |
131 | 131 |
132 Stream<HttpRequestBody> bind(Stream<HttpRequest> stream) { | 132 Stream<HttpRequestBody> bind(Stream<HttpRequest> stream) { |
133 return _transformer.bind(stream); | 133 return _transformer.bind(stream); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 /** | 138 /** |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 * The [ContentType] of the uploaded file. For 'text/\*' and | 229 * The [ContentType] of the uploaded file. For 'text/\*' and |
230 * 'application/json' the [data] field will a String. | 230 * 'application/json' the [data] field will a String. |
231 */ | 231 */ |
232 ContentType get contentType; | 232 ContentType get contentType; |
233 | 233 |
234 /** | 234 /** |
235 * The content of the file. Either a [String] or a [List<int>]. | 235 * The content of the file. Either a [String] or a [List<int>]. |
236 */ | 236 */ |
237 dynamic get content; | 237 dynamic get content; |
238 } | 238 } |
OLD | NEW |