Anonymous avatar Anonymous committed beed784

use new dispatch api in wmtrace

Comments (0)

Files changed (1)

src/wmtrace_resource.erl

 add_dispatch_rule(BasePath, TracePath) when is_list(BasePath),
                                             is_list(TracePath) ->
     Parts = string:tokens(BasePath, "/"),
-    webmachine_dispatcher:set_dispatch_list(
+    set_dispatch_list(
       [{Parts++['*'], ?MODULE, [{trace_dir, TracePath}]}
-       |webmachine_dispatcher:get_dispatch_list()]).
+       |get_dispatch_list()]).
 
 %% @spec remove_dispatch_rules() -> ok
 %% @doc Remove all dispatch rules pointing to wmtrace_resource.
 remove_dispatch_rules() ->
-    webmachine_dispatcher:set_dispatch_list(
-      [ D || D={_,M,_} <- webmachine_dispatcher:get_dispatch_list(),
+    set_dispatch_list(
+      [ D || D={_,M,_} <- get_dispatch_list(),
              M /= ?MODULE ]).
 
+get_dispatch_list() ->
+    {ok, Dispatch} = application:get_env(webmachine, dispatch_list),
+    Dispatch.
+
+set_dispatch_list(NewList) when is_list(NewList) ->
+    application:set_env(webmachine, dispatch_list, NewList).
+
 %%
 %% Resource
 %%
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.