ioc uses executeHandler

This commit is contained in:
Tobe O 2018-08-20 22:44:32 -04:00
parent 2b1a548cf9
commit 6822657f26
11 changed files with 309 additions and 291 deletions

View file

@ -12,7 +12,7 @@
<entry key="angel_container">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.1/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.5/lib" />
</list>
</value>
</entry>
@ -454,7 +454,7 @@
</properties>
<CLASSES>
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.32.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_model-1.0.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/lib" />

View file

@ -2,13 +2,17 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_context.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/injection.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/injection.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/routable.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/routable.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/http/angel_http.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/angel_http.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/http/http_response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/http_response_context.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/routing_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/routing_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/util.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/hooked_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/hooked_test.dart" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
@ -34,8 +38,8 @@
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="301">
<caret line="24" column="16" selection-start-line="24" selection-start-column="16" selection-end-line="24" selection-end-column="16" />
<state relative-caret-position="150">
<caret line="35" column="7" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
@ -43,23 +47,32 @@
</provider>
</entry>
</file>
<file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/routing_test.dart">
<file leaf-file-name="routable.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="27" column="13" selection-start-line="27" selection-start-column="13" selection-end-line="27" selection-end-column="13" />
<state relative-caret-position="86">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="e#40#60#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<file leaf-file-name="util.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="286" column="39" selection-start-line="286" selection-start-column="39" selection-end-line="286" selection-end-column="39" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
<state relative-caret-position="256">
<caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="injection.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" column="65" selection-start-line="8" selection-start-column="65" selection-end-line="8" selection-end-column="65" />
</state>
</provider>
</entry>
@ -67,8 +80,8 @@
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1483">
<caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" />
<state relative-caret-position="129">
<caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
@ -76,51 +89,6 @@
</provider>
</entry>
</file>
<file leaf-file-name="json.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/json.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-282">
<caret column="20" selection-start-column="20" selection-end-column="20" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="http_response_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="56" column="19" lean-forward="true" selection-start-line="56" selection-start-column="19" selection-end-line="56" selection-end-column="19" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="283">
<caret line="62" column="49" selection-start-line="62" selection-start-column="49" selection-end-line="62" selection-end-column="49" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<caret line="119" column="9" selection-start-line="119" selection-start-column="9" selection-end-line="119" selection-end-column="9" />
<folding>
<element signature="e#48#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -133,15 +101,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>super</find>
<find>close()</find>
<find>DEFUNC</find>
<find>const</find>
<find>dart2_constant/convert.dart</find>
<find>dart2_constant/io.dart</find>
<find>package:dart:convert</find>
<find>package:dart:io</find>
<find>deprecated</find>
<find>parse</find>
<find>io</find>
<find>io.</find>
@ -163,6 +122,15 @@
<find>add(</find>
<find>close(</find>
<find>end()</find>
<find>stop</find>
<find>sto</find>
<find>sopw</find>
<find>stopw</find>
<find>release</find>
<find>handleRe</find>
<find>mirrors</find>
<find>get container</find>
<find>Parameter</find>
</findStrings>
<replaceStrings>
<replace>FutureOr</replace>
@ -218,8 +186,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/test/exception_test.dart" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0/lib/angel_http_exception.dart" />
<option value="$PROJECT_DIR$/test/common.dart" />
<option value="$PROJECT_DIR$/example/hm.dart" />
<option value="$PROJECT_DIR$/test/hm.dart" />
@ -234,7 +200,6 @@
<option value="$PROJECT_DIR$/lib/src/core/typed_service.dart" />
<option value="$PROJECT_DIR$/test/typed_service_test.dart" />
<option value="$PROJECT_DIR$/test/services_test.dart" />
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
<option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" />
<option value="$PROJECT_DIR$/lib/src/core/core.dart" />
@ -252,23 +217,26 @@
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/example/handle_error.dart" />
<option value="$PROJECT_DIR$/test/server_test.dart" />
<option value="$PROJECT_DIR$/example/json.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/test/routing_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/example/main.dart" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http_response_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.3/lib/src/mirrors/reflector.dart" />
<option value="$PROJECT_DIR$/lib/src/util.dart" />
<option value="$PROJECT_DIR$/example/main.dart" />
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
</list>
</option>
</component>
@ -278,12 +246,18 @@
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="MavenProjectNavigator">
<treeState>
<expand />
<select />
</treeState>
</component>
<component name="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="36" />
<option name="y" value="23" />
<option name="x" value="64" />
<option name="y" value="41" />
<option name="width" value="1342" />
<option name="height" value="784" />
</component>
@ -328,6 +302,18 @@
<item name="src" type="cbb8eebc:String" user="src" />
<item name="core" type="cbb8eebc:String" user="core" />
</path>
<path>
<item name="Root" type="cbb8eebc:String" user="Root" />
<item name="framework" type="cbb8eebc:String" user="framework" />
<item name="lib" type="cbb8eebc:String" user="lib" />
<item name="src" type="cbb8eebc:String" user="src" />
<item name="http" type="cbb8eebc:String" user="http" />
</path>
<path>
<item name="Root" type="cbb8eebc:String" user="Root" />
<item name="framework" type="cbb8eebc:String" user="framework" />
<item name="performance/hello" type="cbb8eebc:String" user="performance/hello" />
</path>
</expand>
<select />
</subPane>
@ -376,7 +362,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Dart Command Line App.main.dart">
<component name="RunManager" selected="Dart Test.Controller Tests">
<configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
<option name="scope" value="GROUP_OR_TEST_BY_NAME" />
@ -676,14 +662,7 @@
<workItem from="1534009494986" duration="594000" />
<workItem from="1534546784803" duration="353000" />
<workItem from="1534547885788" duration="9908000" />
<workItem from="1534793956753" duration="9486000" />
</task>
<task id="LOCAL-00108" summary="Removed random_string dependency">
<created>1534547008912</created>
<option name="number" value="00108" />
<option name="presentableId" value="LOCAL-00108" />
<option name="project" value="LOCAL" />
<updated>1534547008913</updated>
<workItem from="1534793956753" duration="12414000" />
</task>
<task id="LOCAL-00109" summary="Removed random_string dependency">
<created>1534547132671</created>
@ -1021,13 +1000,17 @@
<option name="project" value="LOCAL" />
<updated>1534815933898</updated>
</task>
<option name="localTasksCounter" value="157" />
<task id="LOCAL-00157" summary="Remove releaseCOrrespondingRequest">
<created>1534816646962</created>
<option name="number" value="00157" />
<option name="presentableId" value="LOCAL-00157" />
<option name="project" value="LOCAL" />
<updated>1534816646962</updated>
</task>
<option name="localTasksCounter" value="158" />
<servers />
</component>
<component name="TestHistory">
<history-entry file="All_Tests - 2018.07.09 at 11h 06m 50s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
@ -1055,9 +1038,12 @@
<history-entry file="tests_in_find_one_test_dart - 2018.08.19 at 11h 22m 50s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2018.08.20 at 22h 14m 22s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="181693000" />
<option name="totallyTimeSpent" value="184621000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -1069,7 +1055,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="36" y="23" width="1342" height="784" extended-state="0" />
<frame x="64" y="41" width="1342" height="784" extended-state="0" />
<editor active="true" />
<layout>
<window_info anchor="right" id="Palette" order="3" />
@ -1095,7 +1081,7 @@
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.4964476" visible="true" weight="0.3973799" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
<window_info content_ui="combo" id="Project" order="0" weight="0.27846155" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.27846155" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="SciView" order="4" />
<window_info anchor="right" id="Theme Preview" order="3" />
@ -1120,7 +1106,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="Make RequestContext generic" />
<MESSAGE value="Completely remove RequestContext.io" />
<MESSAGE value="Completely remove ResponseContext.io" />
<MESSAGE value="Rename HTTP request+response impl, drop the &quot;impl&quot;" />
@ -1145,7 +1130,8 @@
<MESSAGE value="ResponseContext.isBuffered" />
<MESSAGE value="Make LockableBytesBuilder public" />
<MESSAGE value="Remove ResponseContext.dispose" />
<option name="LAST_COMMIT_MESSAGE" value="Remove ResponseContext.dispose" />
<MESSAGE value="Remove releaseCOrrespondingRequest" />
<option name="LAST_COMMIT_MESSAGE" value="Remove releaseCOrrespondingRequest" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
@ -1153,53 +1139,6 @@
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/lib/src/core/typed_service.dart">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/angel_base.dart" />
<entry file="file://$PROJECT_DIR$/lib/src/core/core.dart">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1338">
<caret line="23" column="40" selection-start-line="23" selection-start-column="40" selection-end-line="23" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.7/lib/src/router.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="88">
<caret line="21" column="6" selection-start-line="21" selection-start-column="6" selection-end-line="21" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/safe_stream_controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1402" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
<caret line="6" column="36" selection-start-line="6" selection-start-column="36" selection-end-line="6" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="69">
<caret line="7" column="20" lean-forward="true" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.1/lib/src/container.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="406">
<caret line="96" column="33" lean-forward="true" selection-start-line="96" selection-start-column="33" selection-end-line="96" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/core/list.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
@ -1245,13 +1184,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/di_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="192">
<caret line="20" column="51" lean-forward="true" selection-start-line="20" selection-start-column="51" selection-end-line="20" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
@ -1294,20 +1226,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="9" column="23" selection-start-line="9" selection-start-column="23" selection-end-line="9" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="293">
<caret line="44" column="38" selection-start-line="44" selection-start-column="38" selection-end-line="44" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/src/utils.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181">
@ -1336,33 +1254,6 @@
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/lib/src/router.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
<caret line="42" column="28" lean-forward="true" selection-start-line="42" selection-start-column="28" selection-end-line="42" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="43" selection-start-column="43" selection-end-column="43" />
<folding>
<element signature="e#31#51#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="886">
<caret line="94" column="16" selection-start-line="94" selection-start-column="16" selection-end-line="94" selection-end-column="16" />
<folding>
<element signature="e#40#60#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/async/zone.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="859">
@ -1370,13 +1261,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/server_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="18" column="17" selection-start-line="18" selection-start-column="17" selection-end-line="18" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/opt/dart/libexec/lib/async/future_impl.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
@ -1391,13 +1275,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-369">
<caret line="45" column="34" lean-forward="true" selection-start-line="45" selection-start-column="34" selection-end-line="45" selection-end-column="34" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/handle_error.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
@ -1430,13 +1307,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="566">
<caret line="42" lean-forward="true" selection-start-line="42" selection-end-line="42" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="257">
@ -1454,12 +1324,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="468">
<caret line="33" column="69" selection-start-line="33" selection-start-column="69" selection-end-line="33" selection-end-column="69" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<caret line="119" column="9" selection-start-line="119" selection-start-column="9" selection-end-line="119" selection-end-column="9" />
<state relative-caret-position="99">
<caret line="54" column="34" lean-forward="true" selection-start-line="54" selection-start-column="34" selection-end-line="54" selection-end-column="34" />
<folding>
<element signature="e#48#68#0" expanded="true" />
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
@ -1478,53 +1358,181 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.dart">
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="301">
<caret line="24" column="16" selection-start-line="24" selection-start-column="16" selection-end-line="24" selection-end-column="16" />
<state relative-caret-position="51">
<caret line="278" column="3" selection-start-line="278" selection-start-column="3" selection-end-line="278" selection-end-column="3" />
<folding>
<element signature="e#0#46#0" expanded="true" />
<element signature="e#48#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<caret line="26" column="22" selection-start-line="26" selection-start-column="22" selection-end-line="26" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/async/future.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="156">
<caret line="259" column="17" selection-start-line="259" selection-start-column="17" selection-end-line="259" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-42">
<caret line="153" column="46" selection-start-line="153" selection-start-column="46" selection-end-line="153" selection-end-column="46" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/server_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="228">
<caret line="181" column="45" selection-start-line="181" selection-start-column="45" selection-end-line="181" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/hooked_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="326">
<caret line="99" column="68" selection-start-line="99" selection-start-column="68" selection-end-line="99" selection-end-column="68" />
<folding>
<element signature="e#46#66#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/hooked_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="185">
<caret line="100" column="75" selection-start-line="100" selection-start-column="75" selection-end-line="100" selection-end-column="75" />
<folding>
<element signature="e#0#22#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="263">
<caret line="49" column="29" selection-start-line="49" selection-start-column="29" selection-end-line="49" selection-end-column="29" />
<folding>
<element signature="e#39#59#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="304">
<caret line="45" column="27" selection-start-line="45" selection-start-column="27" selection-end-line="45" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/di_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
<caret line="19" column="18" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1483">
<caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" />
<state relative-caret-position="129">
<caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.2/lib/src/mirrors/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="286" column="39" selection-start-line="286" selection-start-column="39" selection-end-line="286" selection-end-column="39" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
<state relative-caret-position="220">
<caret line="32" column="40" selection-start-line="32" selection-start-column="40" selection-end-line="32" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.3/lib/src/mirrors/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="56" column="19" lean-forward="true" selection-start-line="56" selection-start-column="19" selection-end-line="56" selection-end-column="19" />
<caret line="188" column="26" selection-start-line="188" selection-start-column="26" selection-end-line="188" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/opt/dart/libexec/lib/internal/iterable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="413" column="28" selection-start-line="413" selection-start-column="28" selection-end-line="413" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.4/lib/src/mirrors/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="81">
<caret line="52" column="43" selection-start-line="52" selection-start-column="43" selection-end-line="52" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.4/lib/src/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="166" column="6" selection-start-line="166" selection-start-column="6" selection-end-line="166" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/lib/src/router.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
<caret line="361" column="11" selection-start-line="361" selection-start-column="11" selection-end-line="361" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="86">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#40#60#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="283">
<caret line="62" column="49" selection-start-line="62" selection-start-column="49" selection-end-line="62" selection-end-column="49" />
</first_editor>
<second_editor />
<entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="35" column="7" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" column="65" selection-start-line="8" selection-start-column="65" selection-end-line="8" selection-end-column="65" />
</state>
</provider>
</entry>

View file

@ -24,7 +24,9 @@ main() async {
'/greet/:name',
(req, res) {
var name = req.params['name'];
res.write('Hello, $name!');
res
..write('Hello, $name!')
..close();
},
);

View file

@ -6,6 +6,7 @@ import 'request_context.dart';
import 'response_context.dart';
import 'routable.dart';
import 'metadata.dart';
import 'server.dart';
import 'service.dart';
/// Wraps another service in a service that broadcasts events on actions.
@ -85,8 +86,8 @@ class HookedService extends Service {
}
/// Adds hooks to this instance.
void addHooks() {
Hooks hooks = getAnnotation(inner, Hooks);
void addHooks(Angel app) {
Hooks hooks = getAnnotation(inner, Hooks, app.container.reflector);
List<HookedServiceEventListener> before = [], after = [];
if (hooks != null) {
@ -96,7 +97,7 @@ class HookedService extends Service {
void applyListeners(Function fn, HookedServiceEventDispatcher dispatcher,
[bool isAfter]) {
Hooks hooks = getAnnotation(fn, Hooks);
Hooks hooks = getAnnotation(fn, Hooks, app.container.reflector);
final listeners = <HookedServiceEventListener>[]
..addAll(isAfter == true ? after : before);

View file

@ -5,10 +5,15 @@ const List<Type> _primitiveTypes = [String, int, num, double, Null];
/// Shortcut for calling [preInject], and then [handleContained].
///
/// Use this to instantly create a request handler for a DI-enabled method.
///
/// Calling [ioc] also auto-serializes the result of a [handler].
RequestHandler ioc(Function handler, {Iterable<String> optional: const []}) {
var injection = preInject(handler);
injection.optional.addAll(optional ?? []);
return handleContained(handler, injection);
var contained = handleContained(handler, injection);
return (req, res) {
return req.app.executeHandler(contained, req, res);
};
}
resolveInjection(requirement, InjectionRequest injection, RequestContext req,

View file

@ -2,6 +2,7 @@ library angel_framework.http.routable;
import 'dart:async';
import 'package:angel_container/angel_container.dart';
import 'package:angel_route/angel_route.dart';
import '../util.dart';
@ -45,7 +46,14 @@ class Routable extends Router<RequestHandler> {
final Map<Pattern, Service> _services = {};
final Map configuration = {};
Routable() : super();
final Container _container;
Routable([Reflector reflector])
: _container = reflector == null ? null : new Container(reflector),
super();
/// A [Container] used to inject dependencies.
Container get container => _container;
void close() {
_services.clear();
@ -75,7 +83,8 @@ class Routable extends Router<RequestHandler> {
{Iterable<RequestHandler> middleware: const <RequestHandler>[]}) {
final handlers = <RequestHandler>[];
// Merge @Middleware declaration, if any
Middleware middlewareDeclaration = getAnnotation(handler, Middleware);
Middleware middlewareDeclaration =
getAnnotation(handler, Middleware, _container?.reflector);
if (middlewareDeclaration != null) {
handlers.addAll(middlewareDeclaration.handlers);
}

View file

@ -104,8 +104,6 @@ class Angel extends Routable {
/// These will only not run if a response's `willCloseItself` is set to `true`.
final List<RequestHandler> responseFinalizers = [];
Container _container;
/// A [Map] of application-specific data that can be accessed by any
/// piece of code that can see this [Angel] instance.
///
@ -122,9 +120,6 @@ class Angel extends Routable {
/// on requests. `false` by default.
bool keepRawRequestBuffers = false;
/// A [Container] used to inject dependencies.
Container get container => _container;
/// A function that renders views.
///
/// Called by [ResponseContext]@`render`.
@ -199,7 +194,6 @@ class Angel extends Routable {
});
super.close();
_container = null;
viewGenerator = noViewEngineConfigured;
_preContained.clear();
handlerCache.clear();
@ -371,8 +365,8 @@ class Angel extends Routable {
this.allowMethodOverrides: true,
this.keepRawRequestBuffers: false,
this.serializer,
this.viewGenerator}) {
_container = new Container(reflector);
this.viewGenerator})
: super(reflector) {
bootstrapContainer();
viewGenerator ??= noViewEngineConfigured;
serializer ??= json.encode;

View file

@ -154,11 +154,11 @@ class Service extends Routable {
var handlers = new List<RequestHandler>.from(handlerss);
// Add global middleware if declared on the instance itself
Middleware before = getAnnotation(service, Middleware);
Middleware before = getAnnotation(service, Middleware, app.container.reflector);
if (before != null) handlers.addAll(before.handlers);
Middleware indexMiddleware = getAnnotation(service.index, Middleware);
Middleware indexMiddleware = getAnnotation(service.index, Middleware, app.container.reflector);
get('/', (req, res) {
return req.parseQuery().then((query) {
return this.index(mergeMap([
@ -172,7 +172,7 @@ class Service extends Routable {
..addAll(handlers)
..addAll((indexMiddleware == null) ? [] : indexMiddleware.handlers));
Middleware createMiddleware = getAnnotation(service.create, Middleware);
Middleware createMiddleware = getAnnotation(service.create, Middleware, app.container.reflector);
post('/', (req, ResponseContext res) {
return req.parseQuery().then((query) {
return req.parseBody().then((body) {
@ -196,7 +196,7 @@ class Service extends Routable {
..addAll(
(createMiddleware == null) ? [] : createMiddleware.handlers));
Middleware readMiddleware = getAnnotation(service.read, Middleware);
Middleware readMiddleware = getAnnotation(service.read, Middleware, app.container.reflector);
get('/:id', (req, res) {
return req.parseQuery().then((query) {
@ -213,7 +213,7 @@ class Service extends Routable {
..addAll(handlers)
..addAll((readMiddleware == null) ? [] : readMiddleware.handlers));
Middleware modifyMiddleware = getAnnotation(service.modify, Middleware);
Middleware modifyMiddleware = getAnnotation(service.modify, Middleware, app.container.reflector);
patch(
'/:id',
(req, res) => req.parseBody().then((body) {
@ -233,7 +233,7 @@ class Service extends Routable {
..addAll(
(modifyMiddleware == null) ? [] : modifyMiddleware.handlers));
Middleware updateMiddleware = getAnnotation(service.update, Middleware);
Middleware updateMiddleware = getAnnotation(service.update, Middleware, app.container.reflector);
post(
'/:id',
(req, res) => req.parseBody().then((body) {
@ -271,7 +271,7 @@ class Service extends Routable {
..addAll(
(updateMiddleware == null) ? [] : updateMiddleware.handlers));
Middleware removeMiddleware = getAnnotation(service.remove, Middleware);
Middleware removeMiddleware = getAnnotation(service.remove, Middleware, app.container.reflector);
delete('/', (req, res) {
return req.parseQuery().then((query) {
return this.remove(

View file

@ -141,18 +141,17 @@ class AngelHttp {
var pipeline = tuple.item1;
Future<bool> Function() runPipeline;
Future Function() runPipeline;
for (var handler in pipeline) {
if (handler == null) break;
if (runPipeline == null)
runPipeline = () => app.executeHandler(handler, req, res);
runPipeline = () => Future.sync(() => handler(req, res));
else {
var current = runPipeline;
runPipeline = () => current().then((result) => !result
? new Future.value(result)
: app.executeHandler(handler, req, res));
runPipeline = () => current().then((result) =>
!res.isOpen ? new Future.value(result) : handler(req, res));
}
}

View file

@ -1,26 +1,26 @@
import 'dart:async';
import 'dart:mirrors';
import 'package:angel_container/angel_container.dart';
final RegExp straySlashes = new RegExp(r'(^/+)|(/+$)');
matchingAnnotation(List<InstanceMirror> metadata, Type T) {
for (InstanceMirror metaDatum in metadata) {
if (metaDatum.hasReflectee) {
var reflectee = metaDatum.reflectee;
if (reflectee.runtimeType == T) {
return reflectee;
}
matchingAnnotation(List<ReflectedInstance> metadata, Type T) {
for (ReflectedInstance metaDatum in metadata) {
if (metaDatum.type == T) {
return metaDatum.reflectee;
}
}
return null;
}
getAnnotation(obj, Type T) {
if (obj is Function || obj is Future) {
MethodMirror methodMirror = (reflect(obj) as ClosureMirror).function;
return matchingAnnotation(methodMirror.metadata, T);
getAnnotation(obj, Type T, Reflector reflector) {
if (reflector == null) {
return null;
} else {
ClassMirror classMirror = reflectClass(obj.runtimeType as Type);
return matchingAnnotation(classMirror.metadata, T);
if (obj is Function) {
var methodMirror = reflector.reflectFunction(obj);
return matchingAnnotation(methodMirror.annotations, T);
} else {
var classMirror = reflector.reflectClass(obj.runtimeType as Type);
return matchingAnnotation(classMirror.annotations, T);
}
}
}

View file

@ -98,7 +98,7 @@ main() {
});
test('metadata', () async {
final service = new HookedService(new IncrementService())..addHooks();
final service = new HookedService(new IncrementService())..addHooks(app);
expect(service.inner, isNot(const IsInstanceOf<MapService>()));
IncrementService.TIMES = 0;
await service.index();