OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 library appengine; | 5 library appengine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 export 'package:gcloud/http.dart'; | |
10 import 'package:gcloud/service_scope.dart' as ss; | 11 import 'package:gcloud/service_scope.dart' as ss; |
11 | 12 |
12 import 'src/appengine_internal.dart' as appengine_internal; | 13 import 'src/appengine_internal.dart' as appengine_internal; |
13 import 'src/app_engine_request_handler.dart'; | 14 import 'src/app_engine_request_handler.dart'; |
14 import 'src/client_context.dart'; | 15 import 'src/client_context.dart'; |
15 | 16 |
16 export 'package:gcloud/http.dart'; | |
17 export 'api/errors.dart'; | 17 export 'api/errors.dart'; |
18 export 'api/logging.dart'; | 18 export 'api/logging.dart'; |
19 export 'api/modules.dart'; | 19 export 'api/modules.dart'; |
20 export 'api/memcache.dart'; | 20 export 'api/memcache.dart'; |
21 export 'api/remote_api.dart'; | 21 export 'api/remote_api.dart'; |
22 export 'api/users.dart'; | 22 export 'api/users.dart'; |
23 export 'src/app_engine_request_handler.dart'; | 23 export 'src/app_engine_request_handler.dart'; |
24 export 'src/client_context.dart'; | 24 export 'src/client_context.dart'; |
25 | 25 |
26 const Symbol _APPENGINE_CONTEXT = #_appengine.context; | 26 const Symbol _APPENGINE_CONTEXT = #_appengine.context; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 } | 62 } |
63 | 63 |
64 return appengine_internal.runAppEngine((HttpRequest request, | 64 return appengine_internal.runAppEngine((HttpRequest request, |
65 ClientContext context) { | 65 ClientContext context) { |
66 ss.register(_APPENGINE_CONTEXT, context); | 66 ss.register(_APPENGINE_CONTEXT, context); |
67 handler(request); | 67 handler(request); |
68 }, errorHandler); | 68 }, errorHandler); |
69 } | 69 } |
70 | 70 |
71 /** | 71 /** |
72 * Runs [callback] inside a new service scope with appengine services added. | |
73 * | |
74 * The services available to `callback` are all non-request specific appengine | |
75 * services e.g. `memcacheService`, `dbService`. | |
76 * | |
77 * See `package:gcloud/service_scope.dart` for more information on service | |
78 * scopes. | |
Søren Gjesse
2014/12/03 11:17:42
Please add the example from the code-review here.
kustermann
2014/12/03 11:55:29
Done -- added sample code.
Actually I think it's
Søren Gjesse
2014/12/03 13:09:01
In principle I am fine with this change to what th
| |
79 */ | |
80 Future withAppEngineServices(Future callback()) { | |
81 return appengine_internal.withAppEngineServices(callback); | |
82 } | |
83 | |
84 /** | |
72 * Returns the [ClientContext] of the current request. | 85 * Returns the [ClientContext] of the current request. |
73 * | 86 * |
74 * This getter can only be called inside a request handler which was passed to | 87 * This getter can only be called inside a request handler which was passed to |
75 * [runAppEngine]. | 88 * [runAppEngine]. |
76 */ | 89 */ |
77 ClientContext get context => ss.lookup(_APPENGINE_CONTEXT); | 90 ClientContext get context => ss.lookup(_APPENGINE_CONTEXT); |
OLD | NEW |