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

Side by Side Diff: lib/appengine.dart

Issue 775043002: Add withAppEngineService() to package:appengine (Closed) Base URL: git@github.com:dart-lang/appengine.git@master
Patch Set: 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
« no previous file with comments | « no previous file | lib/src/appengine_internal.dart » ('j') | lib/src/appengine_internal.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
OLDNEW
« no previous file with comments | « no previous file | lib/src/appengine_internal.dart » ('j') | lib/src/appengine_internal.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698