diff --git a/deps/rabbitmq_web_dispatch/README.md b/deps/rabbitmq_web_dispatch/README.md index 6051903642..425ef6ddc9 100644 --- a/deps/rabbitmq_web_dispatch/README.md +++ b/deps/rabbitmq_web_dispatch/README.md @@ -1,7 +1,7 @@ -rabbitmq-mochiweb ------------------ +rabbitmq-web-dispatch +--------------------- -rabbitmq-mochiweb is a thin veneer around mochiweb that provides the +rabbitmq-web-dispatch is a thin veneer around mochiweb that provides the ability for multiple applications to co-exist on mochiweb listeners. Applications can register static docroots or dynamic handlers to be executed, dispatched by URL path prefix. @@ -10,14 +10,14 @@ See http://www.rabbitmq.com/mochiweb.html for information on configuring web plugins. The most general registration procedure is -`rabbit_mochiweb:register_context_handler/5`. This takes a callback +`rabbit_web_dispatch:register_context_handler/5`. This takes a callback procedure of the form loop(Request) -> ... The module `rabbit_webmachine` provides a means of running more than -one webmachine in a VM, and understands rabbitmq-mochiweb contexts. To +one webmachine in a VM, and understands rabbitmq-web-dispatch contexts. To use it, supply a dispatch table term of the kind usually given to webmachine in the file `priv/dispatch.conf`. diff --git a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb.erl b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch.erl similarity index 96% rename from deps/rabbitmq_web_dispatch/src/rabbit_mochiweb.erl rename to deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch.erl index 97cd1ec897..1dcf3404d1 100644 --- a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb.erl +++ b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch.erl @@ -14,20 +14,18 @@ %% Copyright (c) 2010-2013 VMware, Inc. All rights reserved. %% --module(rabbit_mochiweb). +-module(rabbit_web_dispatch). -export([register_context_handler/5, register_static_context/6]). -export([register_port_redirect/4]). -export([unregister_context/1]). --define(APP, rabbitmq_mochiweb). - %% Handler Registration %% Registers a dynamic selector and handler combination, with a link %% to display in lists. register_handler(Name, Listener, Selector, Handler, Link) -> - rabbit_mochiweb_registry:add(Name, Listener, Selector, Handler, Link). + rabbit_web_dispatch_registry:add(Name, Listener, Selector, Handler, Link). %% Methods for standard use cases @@ -112,5 +110,5 @@ serve_file(Req, Path, LocalPath) -> %% The opposite of all those register_* functions. unregister_context(Name) -> - rabbit_mochiweb_registry:remove(Name). + rabbit_web_dispatch_registry:remove(Name). diff --git a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_app.erl b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_app.erl similarity index 79% rename from deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_app.erl rename to deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_app.erl index ef2aaac62c..97603a0d54 100644 --- a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_app.erl +++ b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_app.erl @@ -14,19 +14,17 @@ %% Copyright (c) 2010-2013 VMware, Inc. All rights reserved. %% --module(rabbit_mochiweb_app). +-module(rabbit_web_dispatch_app). -behaviour(application). -export([start/2,stop/1]). --define(APP, rabbitmq_mochiweb). - %% @spec start(_Type, _StartArgs) -> ServerRet -%% @doc application start callback for rabbit_mochiweb. +%% @doc application start callback for rabbit_web_dispatch. start(_Type, _StartArgs) -> - rabbit_mochiweb_sup:start_link(). + rabbit_web_dispatch_sup:start_link(). %% @spec stop(_State) -> ServerRet -%% @doc application stop callback for rabbit_mochiweb. +%% @doc application stop callback for rabbit_web_dispatch. stop(_State) -> ok. diff --git a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_registry.erl b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_registry.erl similarity index 94% rename from deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_registry.erl rename to deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_registry.erl index ccbb10fba0..777ef123db 100644 --- a/deps/rabbitmq_web_dispatch/src/rabbit_mochiweb_registry.erl +++ b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_registry.erl @@ -14,7 +14,7 @@ %% Copyright (c) 2010-2013 VMware, Inc. All rights reserved. %% --module(rabbit_mochiweb_registry). +-module(rabbit_web_dispatch_registry). -behaviour(gen_server). @@ -23,7 +23,7 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). --define(ETS, rabbitmq_mochiweb). +-define(ETS, rabbitmq_web_dispatch). %% This gen_server is merely to serialise modifications to the dispatch %% table for listeners. @@ -55,7 +55,7 @@ lookup(Listener, Req) -> end. %% This is called in a somewhat obfuscated manner in -%% rabbit_mgmt_external_stats:rabbit_mochiweb_registry_list_all() +%% rabbit_mgmt_external_stats:rabbit_web_dispatch_registry_list_all() list_all() -> gen_server:call(?MODULE, list_all, infinity). @@ -67,7 +67,7 @@ init([]) -> handle_call({add, Name, Listener, Selector, Handler, Link = {_, Desc}}, _From, undefined) -> - Continue = case rabbit_mochiweb_sup:ensure_listener(Listener) of + Continue = case rabbit_web_dispatch_sup:ensure_listener(Listener) of new -> set_dispatch( Listener, [], listing_fallback_handler(Listener)), @@ -97,7 +97,7 @@ handle_call({remove, Name}, _From, Selectors1 = lists:keydelete(Name, 1, Selectors), set_dispatch(Listener, Selectors1, Fallback), case Selectors1 of - [] -> rabbit_mochiweb_sup:stop_listener(Listener); + [] -> rabbit_web_dispatch_sup:stop_listener(Listener); _ -> ok end, {reply, ok, undefined}; @@ -196,4 +196,4 @@ listing_fallback_handler(Listener) -> handler_listing(Path, ReqPath, Desc) -> io_lib:format( "