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"> <entry key="angel_container">
<value> <value>
<list> <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> </list>
</value> </value>
</entry> </entry>
@ -454,7 +454,7 @@
</properties> </properties>
<CLASSES> <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/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_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_model-1.0.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/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"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment=""> <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$/.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$/example/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/main.dart" 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$/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/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/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$/lib/src/util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/util.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$/test/hooked_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/hooked_test.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
@ -34,8 +38,8 @@
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/main.dart"> <entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="301"> <state relative-caret-position="150">
<caret line="24" column="16" selection-start-line="24" selection-start-column="16" selection-end-line="24" selection-end-column="16" /> <caret line="35" column="7" selection-start-line="35" selection-start-column="7" selection-end-line="35" selection-end-column="7" />
<folding> <folding>
<element signature="e#0#46#0" expanded="true" /> <element signature="e#0#46#0" expanded="true" />
</folding> </folding>
@ -43,23 +47,32 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="routable.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/routing_test.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182"> <state relative-caret-position="86">
<caret line="27" column="13" selection-start-line="27" selection-start-column="13" selection-end-line="27" selection-end-column="13" /> <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> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="util.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart"> <entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252"> <state relative-caret-position="256">
<caret line="286" column="39" selection-start-line="286" selection-start-column="39" selection-end-line="286" selection-end-column="39" /> <caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
<folding> </state>
<element signature="e#0#20#0" expanded="true" /> </provider>
</folding> </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> </state>
</provider> </provider>
</entry> </entry>
@ -67,8 +80,8 @@
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart"> <entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1483"> <state relative-caret-position="129">
<caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" /> <caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<folding> <folding>
<element signature="e#38#58#0" expanded="true" /> <element signature="e#38#58#0" expanded="true" />
</folding> </folding>
@ -76,51 +89,6 @@
</provider> </provider>
</entry> </entry>
</file> </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> </leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
@ -133,15 +101,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <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>parse</find>
<find>io</find> <find>io</find>
<find>io.</find> <find>io.</find>
@ -163,6 +122,15 @@
<find>add(</find> <find>add(</find>
<find>close(</find> <find>close(</find>
<find>end()</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> </findStrings>
<replaceStrings> <replaceStrings>
<replace>FutureOr</replace> <replace>FutureOr</replace>
@ -218,8 +186,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <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$/test/common.dart" />
<option value="$PROJECT_DIR$/example/hm.dart" /> <option value="$PROJECT_DIR$/example/hm.dart" />
<option value="$PROJECT_DIR$/test/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$/lib/src/core/typed_service.dart" />
<option value="$PROJECT_DIR$/test/typed_service_test.dart" /> <option value="$PROJECT_DIR$/test/typed_service_test.dart" />
<option value="$PROJECT_DIR$/test/services_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$/test/all.dart" />
<option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" /> <option value="$PROJECT_DIR$/lib/src/core/angel_base.dart" />
<option value="$PROJECT_DIR$/lib/src/core/core.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$/performance/hello/main.dart" />
<option value="$PROJECT_DIR$/test/precontained_test.dart" /> <option value="$PROJECT_DIR$/test/precontained_test.dart" />
<option value="$PROJECT_DIR$/test/primitives_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/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/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$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/example/handle_error.dart" /> <option value="$PROJECT_DIR$/example/handle_error.dart" />
<option value="$PROJECT_DIR$/test/server_test.dart" /> <option value="$PROJECT_DIR$/test/server_test.dart" />
<option value="$PROJECT_DIR$/example/json.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$/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/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$/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> </list>
</option> </option>
</component> </component>
@ -278,12 +246,18 @@
<detection-done>true</detection-done> <detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting> <sorting>DEFINITION_ORDER</sorting>
</component> </component>
<component name="MavenProjectNavigator">
<treeState>
<expand />
<select />
</treeState>
</component>
<component name="NodePackageJsonFileManager"> <component name="NodePackageJsonFileManager">
<packageJsonPaths /> <packageJsonPaths />
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="36" /> <option name="x" value="64" />
<option name="y" value="23" /> <option name="y" value="41" />
<option name="width" value="1342" /> <option name="width" value="1342" />
<option name="height" value="784" /> <option name="height" value="784" />
</component> </component>
@ -328,6 +302,18 @@
<item name="src" type="cbb8eebc:String" user="src" /> <item name="src" type="cbb8eebc:String" user="src" />
<item name="core" type="cbb8eebc:String" user="core" /> <item name="core" type="cbb8eebc:String" user="core" />
</path> </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> </expand>
<select /> <select />
</subPane> </subPane>
@ -376,7 +362,7 @@
</list> </list>
</option> </option>
</component> </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"> <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="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
<option name="scope" value="GROUP_OR_TEST_BY_NAME" /> <option name="scope" value="GROUP_OR_TEST_BY_NAME" />
@ -676,14 +662,7 @@
<workItem from="1534009494986" duration="594000" /> <workItem from="1534009494986" duration="594000" />
<workItem from="1534546784803" duration="353000" /> <workItem from="1534546784803" duration="353000" />
<workItem from="1534547885788" duration="9908000" /> <workItem from="1534547885788" duration="9908000" />
<workItem from="1534793956753" duration="9486000" /> <workItem from="1534793956753" duration="12414000" />
</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>
</task> </task>
<task id="LOCAL-00109" summary="Removed random_string dependency"> <task id="LOCAL-00109" summary="Removed random_string dependency">
<created>1534547132671</created> <created>1534547132671</created>
@ -1021,13 +1000,17 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1534815933898</updated> <updated>1534815933898</updated>
</task> </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 /> <servers />
</component> </component>
<component name="TestHistory"> <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"> <history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" /> <configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry> </history-entry>
@ -1055,9 +1038,12 @@
<history-entry file="tests_in_find_one_test_dart - 2018.08.19 at 11h 22m 50s.xml"> <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" /> <configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry> </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>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="181693000" /> <option name="totallyTimeSpent" value="184621000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -1069,7 +1055,7 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <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" /> <editor active="true" />
<layout> <layout>
<window_info anchor="right" id="Palette" order="3" /> <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 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 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 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="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="SciView" order="4" /> <window_info anchor="right" id="SciView" order="4" />
<window_info anchor="right" id="Theme Preview" order="3" /> <window_info anchor="right" id="Theme Preview" order="3" />
@ -1120,7 +1106,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /> <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 RequestContext.io" />
<MESSAGE value="Completely remove ResponseContext.io" /> <MESSAGE value="Completely remove ResponseContext.io" />
<MESSAGE value="Rename HTTP request+response impl, drop the &quot;impl&quot;" /> <MESSAGE value="Rename HTTP request+response impl, drop the &quot;impl&quot;" />
@ -1145,7 +1130,8 @@
<MESSAGE value="ResponseContext.isBuffered" /> <MESSAGE value="ResponseContext.isBuffered" />
<MESSAGE value="Make LockableBytesBuilder public" /> <MESSAGE value="Make LockableBytesBuilder public" />
<MESSAGE value="Remove ResponseContext.dispose" /> <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>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -1153,53 +1139,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <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"> <entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/core/list.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149"> <state relative-caret-position="149">
@ -1245,13 +1184,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/test/encoders_buffer_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160"> <state relative-caret-position="160">
@ -1294,20 +1226,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181"> <state relative-caret-position="181">
@ -1336,33 +1254,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/async/zone.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="859"> <state relative-caret-position="859">
@ -1370,13 +1261,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file:///usr/local/opt/dart/libexec/lib/async/future_impl.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129"> <state relative-caret-position="129">
@ -1391,13 +1275,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/example/handle_error.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144"> <state relative-caret-position="144">
@ -1430,13 +1307,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="257"> <state relative-caret-position="257">
@ -1454,12 +1324,22 @@
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258"> <state relative-caret-position="99">
<caret line="119" column="9" selection-start-line="119" selection-start-column="9" selection-end-line="119" selection-end-column="9" /> <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> <folding>
<element signature="e#48#68#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1478,53 +1358,181 @@
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="301"> <state relative-caret-position="51">
<caret line="24" column="16" selection-start-line="24" selection-start-column="16" selection-end-line="24" selection-end-column="16" /> <caret line="278" column="3" selection-start-line="278" selection-start-column="3" selection-end-line="278" selection-end-column="3" />
<folding> <folding>
<element signature="e#0#46#0" expanded="true" /> <element signature="e#48#68#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1483"> <state relative-caret-position="129">
<caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" /> <caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<folding> <folding>
<element signature="e#38#58#0" expanded="true" /> <element signature="e#38#58#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252"> <state relative-caret-position="220">
<caret line="286" column="39" selection-start-line="286" selection-start-column="39" selection-end-line="286" selection-end-column="39" /> <caret line="32" column="40" selection-start-line="32" selection-start-column="40" selection-end-line="32" selection-end-column="40" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129"> <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> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#40#60#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="text-editor">
<state split_layout="SPLIT"> <state relative-caret-position="256">
<first_editor relative-caret-position="283"> <caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
<caret line="62" column="49" selection-start-line="62" selection-start-column="49" selection-end-line="62" selection-end-column="49" /> </state>
</first_editor> </provider>
<second_editor /> </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> </state>
</provider> </provider>
</entry> </entry>

View file

@ -24,7 +24,9 @@ main() async {
'/greet/:name', '/greet/:name',
(req, res) { (req, res) {
var name = req.params['name']; 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 'response_context.dart';
import 'routable.dart'; import 'routable.dart';
import 'metadata.dart'; import 'metadata.dart';
import 'server.dart';
import 'service.dart'; import 'service.dart';
/// Wraps another service in a service that broadcasts events on actions. /// Wraps another service in a service that broadcasts events on actions.
@ -85,8 +86,8 @@ class HookedService extends Service {
} }
/// Adds hooks to this instance. /// Adds hooks to this instance.
void addHooks() { void addHooks(Angel app) {
Hooks hooks = getAnnotation(inner, Hooks); Hooks hooks = getAnnotation(inner, Hooks, app.container.reflector);
List<HookedServiceEventListener> before = [], after = []; List<HookedServiceEventListener> before = [], after = [];
if (hooks != null) { if (hooks != null) {
@ -96,7 +97,7 @@ class HookedService extends Service {
void applyListeners(Function fn, HookedServiceEventDispatcher dispatcher, void applyListeners(Function fn, HookedServiceEventDispatcher dispatcher,
[bool isAfter]) { [bool isAfter]) {
Hooks hooks = getAnnotation(fn, Hooks); Hooks hooks = getAnnotation(fn, Hooks, app.container.reflector);
final listeners = <HookedServiceEventListener>[] final listeners = <HookedServiceEventListener>[]
..addAll(isAfter == true ? after : before); ..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]. /// Shortcut for calling [preInject], and then [handleContained].
/// ///
/// Use this to instantly create a request handler for a DI-enabled method. /// 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 []}) { RequestHandler ioc(Function handler, {Iterable<String> optional: const []}) {
var injection = preInject(handler); var injection = preInject(handler);
injection.optional.addAll(optional ?? []); 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, resolveInjection(requirement, InjectionRequest injection, RequestContext req,

View file

@ -2,6 +2,7 @@ library angel_framework.http.routable;
import 'dart:async'; import 'dart:async';
import 'package:angel_container/angel_container.dart';
import 'package:angel_route/angel_route.dart'; import 'package:angel_route/angel_route.dart';
import '../util.dart'; import '../util.dart';
@ -45,7 +46,14 @@ class Routable extends Router<RequestHandler> {
final Map<Pattern, Service> _services = {}; final Map<Pattern, Service> _services = {};
final Map configuration = {}; 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() { void close() {
_services.clear(); _services.clear();
@ -75,7 +83,8 @@ class Routable extends Router<RequestHandler> {
{Iterable<RequestHandler> middleware: const <RequestHandler>[]}) { {Iterable<RequestHandler> middleware: const <RequestHandler>[]}) {
final handlers = <RequestHandler>[]; final handlers = <RequestHandler>[];
// Merge @Middleware declaration, if any // Merge @Middleware declaration, if any
Middleware middlewareDeclaration = getAnnotation(handler, Middleware); Middleware middlewareDeclaration =
getAnnotation(handler, Middleware, _container?.reflector);
if (middlewareDeclaration != null) { if (middlewareDeclaration != null) {
handlers.addAll(middlewareDeclaration.handlers); 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`. /// These will only not run if a response's `willCloseItself` is set to `true`.
final List<RequestHandler> responseFinalizers = []; final List<RequestHandler> responseFinalizers = [];
Container _container;
/// A [Map] of application-specific data that can be accessed by any /// A [Map] of application-specific data that can be accessed by any
/// piece of code that can see this [Angel] instance. /// piece of code that can see this [Angel] instance.
/// ///
@ -122,9 +120,6 @@ class Angel extends Routable {
/// on requests. `false` by default. /// on requests. `false` by default.
bool keepRawRequestBuffers = false; bool keepRawRequestBuffers = false;
/// A [Container] used to inject dependencies.
Container get container => _container;
/// A function that renders views. /// A function that renders views.
/// ///
/// Called by [ResponseContext]@`render`. /// Called by [ResponseContext]@`render`.
@ -199,7 +194,6 @@ class Angel extends Routable {
}); });
super.close(); super.close();
_container = null;
viewGenerator = noViewEngineConfigured; viewGenerator = noViewEngineConfigured;
_preContained.clear(); _preContained.clear();
handlerCache.clear(); handlerCache.clear();
@ -371,8 +365,8 @@ class Angel extends Routable {
this.allowMethodOverrides: true, this.allowMethodOverrides: true,
this.keepRawRequestBuffers: false, this.keepRawRequestBuffers: false,
this.serializer, this.serializer,
this.viewGenerator}) { this.viewGenerator})
_container = new Container(reflector); : super(reflector) {
bootstrapContainer(); bootstrapContainer();
viewGenerator ??= noViewEngineConfigured; viewGenerator ??= noViewEngineConfigured;
serializer ??= json.encode; serializer ??= json.encode;

View file

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

View file

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

View file

@ -1,26 +1,26 @@
import 'dart:async'; import 'package:angel_container/angel_container.dart';
import 'dart:mirrors';
final RegExp straySlashes = new RegExp(r'(^/+)|(/+$)'); final RegExp straySlashes = new RegExp(r'(^/+)|(/+$)');
matchingAnnotation(List<InstanceMirror> metadata, Type T) { matchingAnnotation(List<ReflectedInstance> metadata, Type T) {
for (InstanceMirror metaDatum in metadata) { for (ReflectedInstance metaDatum in metadata) {
if (metaDatum.hasReflectee) { if (metaDatum.type == T) {
var reflectee = metaDatum.reflectee; return metaDatum.reflectee;
if (reflectee.runtimeType == T) {
return reflectee;
}
} }
} }
return null; return null;
} }
getAnnotation(obj, Type T) { getAnnotation(obj, Type T, Reflector reflector) {
if (obj is Function || obj is Future) { if (reflector == null) {
MethodMirror methodMirror = (reflect(obj) as ClosureMirror).function; return null;
return matchingAnnotation(methodMirror.metadata, T);
} else { } else {
ClassMirror classMirror = reflectClass(obj.runtimeType as Type); if (obj is Function) {
return matchingAnnotation(classMirror.metadata, T); 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 { 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>())); expect(service.inner, isNot(const IsInstanceOf<MapService>()));
IncrementService.TIMES = 0; IncrementService.TIMES = 0;
await service.index(); await service.index();