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

Side by Side Diff: pkg/http_server/lib/src/http_body.dart

Issue 756493002: pkg/http_server: move to multi-lib layout (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: readme fixup Created 6 years 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_server/lib/http_server.dart ('k') | pkg/http_server/lib/src/http_body_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library http_server.http_body;
6 6
7 import 'dart:async';
8 import 'dart:convert';
9 import 'dart:io';
10
11 import 'http_body_impl.dart';
7 12
8 /** 13 /**
9 * [HttpBodyHandler] is a helper class for processing and collecting 14 * [HttpBodyHandler] is a helper class for processing and collecting
10 * HTTP message data in an easy-to-use [HttpBody] object. The content 15 * HTTP message data in an easy-to-use [HttpBody] object. The content
11 * body is parsed, depending on the `Content-Type` header field. When 16 * body is parsed, depending on the `Content-Type` header field. When
12 * the full body is read and parsed the body content is made 17 * the full body is read and parsed the body content is made
13 * available. The class can be used to process both server requests 18 * available. The class can be used to process both server requests
14 * and client responses. 19 * and client responses.
15 * 20 *
16 * The following content types are recognized: 21 * The following content types are recognized:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 /** 102 /**
98 * Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>, 103 * Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>,
99 * e.g. a [HttpServer]. 104 * e.g. a [HttpServer].
100 * 105 *
101 * If the page is served using different encoding than UTF-8, set 106 * If the page is served using different encoding than UTF-8, set
102 * [defaultEncoding] accordingly. This is required for parsing 107 * [defaultEncoding] accordingly. This is required for parsing
103 * `multipart/form-data` content correctly. See the class comment 108 * `multipart/form-data` content correctly. See the class comment
104 * for more information on `multipart/form-data`. 109 * for more information on `multipart/form-data`.
105 */ 110 */
106 HttpBodyHandler({Encoding defaultEncoding: UTF8}) 111 HttpBodyHandler({Encoding defaultEncoding: UTF8})
107 : _transformer = new _HttpBodyHandlerTransformer(defaultEncoding); 112 : _transformer = new HttpBodyHandlerTransformer(defaultEncoding);
108 113
109 /** 114 /**
110 * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody] 115 * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody]
111 * contains a [response] field for accessing the [HttpResponse]. 116 * contains a [response] field for accessing the [HttpResponse].
112 * 117 *
113 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. 118 * See [HttpBodyHandler] constructor for more info on [defaultEncoding].
114 */ 119 */
115 static Future<HttpRequestBody> processRequest( 120 static Future<HttpRequestBody> processRequest(
116 HttpRequest request, 121 HttpRequest request,
117 {Encoding defaultEncoding: UTF8}) { 122 {Encoding defaultEncoding: UTF8}) {
118 return _HttpBodyHandler.processRequest(request, defaultEncoding); 123 return HttpBodyHandlerImpl.processRequest(request, defaultEncoding);
119 } 124 }
120 125
121 /** 126 /**
122 * Process and parse an incoming [HttpClientResponse]. 127 * Process and parse an incoming [HttpClientResponse].
123 * 128 *
124 * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. 129 * See [HttpBodyHandler] constructor for more info on [defaultEncoding].
125 */ 130 */
126 static Future<HttpClientResponseBody> processResponse( 131 static Future<HttpClientResponseBody> processResponse(
127 HttpClientResponse response, 132 HttpClientResponse response,
128 {Encoding defaultEncoding: UTF8}) { 133 {Encoding defaultEncoding: UTF8}) {
129 return _HttpBodyHandler.processResponse(response, defaultEncoding); 134 return HttpBodyHandlerImpl.processResponse(response, defaultEncoding);
130 } 135 }
131 136
132 Stream<HttpRequestBody> bind(Stream<HttpRequest> stream) { 137 Stream<HttpRequestBody> bind(Stream<HttpRequest> stream) {
133 return _transformer.bind(stream); 138 return _transformer.bind(stream);
134 } 139 }
135 } 140 }
136 141
137 142
138 /** 143 /**
139 * A HTTP content body produced by [HttpBodyHandler] for either [HttpRequest] 144 * A HTTP content body produced by [HttpBodyHandler] for either [HttpRequest]
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 * The [ContentType] of the uploaded file. For 'text/\*' and 202 * The [ContentType] of the uploaded file. For 'text/\*' and
198 * 'application/json' the [data] field will a String. 203 * 'application/json' the [data] field will a String.
199 */ 204 */
200 ContentType get contentType; 205 ContentType get contentType;
201 206
202 /** 207 /**
203 * The content of the file. Either a [String] or a [List<int>]. 208 * The content of the file. Either a [String] or a [List<int>].
204 */ 209 */
205 dynamic get content; 210 dynamic get content;
206 } 211 }
OLDNEW
« no previous file with comments | « pkg/http_server/lib/http_server.dart ('k') | pkg/http_server/lib/src/http_body_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698