Module z_sites_dispatcher

Server for matching the request path to correct site and dispatch rule.

Copyright 2009-2016 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Server for matching the request path to correct site and dispatch rule.

Data Types

dispatch()

dispatch() = {no_dispatch_match, _UnmatchedHost, _UnmatchedPathTokens} | {Mod, ModOpts, HostTokens, Port, PathTokens, Bindings, AppRoot, StringPath} | handled

Function Index

code_change/3Convert process state when code is changed.
collect_dispatchrules/0Collect all dispatch rules for all sites, normalize and filter them.
collect_dispatchrules/1Collect all dispatch rules for all sites, normalize and filter them.
dispatch/3Match the host and path to a dispatch rule.
dispatch/4
fetch_dispatchinfo/1Fetch dispatch rules for a specific site.
get_fallback_site/0Retrieve the fallback site.
get_host_for_domain/1Fetch the host handling the given domain name.
handle_call/3Trap unknown calls.
handle_cast/2Load all dispatch rules, if anything changed then recompile the dispatcher(s).
handle_info/2Handling all non call/cast messages.
init/1Initiates the server.
is_bind_language/2Callback for the dispatch compiler, try to bind a language.
start_link/0Starts the server.
start_link/1
terminate/2This function is called by a gen_server when it is about to terminate.
update_dispatchinfo/0Update the webmachine dispatch information.

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

collect_dispatchrules/0

collect_dispatchrules() -> any()

Collect all dispatch rules for all sites, normalize and filter them.

collect_dispatchrules/1

collect_dispatchrules(Site) -> any()

Collect all dispatch rules for all sites, normalize and filter them.

dispatch/3

dispatch(Host::string(), Path::string(), ReqData::wm_reqdata) -> {dispatch(), NewReqData}

Match the host and path to a dispatch rule.

dispatch/4

dispatch(Host, Path, ReqData, TracerPid) -> any()

fetch_dispatchinfo/1

fetch_dispatchinfo(Site) -> any()

Fetch dispatch rules for a specific site.

get_fallback_site/0

get_fallback_site() -> any()

Retrieve the fallback site.

get_host_for_domain/1

get_host_for_domain(Domain::string() | binary()) -> {ok, atom()} | undefined

Fetch the host handling the given domain name

handle_call/3

handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}

Trap unknown calls

handle_cast/2

handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Load all dispatch rules, if anything changed then recompile the dispatcher(s)

handle_info/2

handle_info(Info, State) -> any()

Handling all non call/cast messages

init/1

init(Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server.

is_bind_language/2

is_bind_language(Match, Context) -> any()

Callback for the dispatch compiler, try to bind a language

start_link/0

start_link() -> {ok, Pid} | ignore | {error, Error}

Starts the server

start_link/1

start_link(Args) -> any()

terminate/2

terminate(Reason, State) -> void()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

update_dispatchinfo/0

update_dispatchinfo() -> any()

Update the webmachine dispatch information. Collects dispatch information from all sites and sends it to webmachine for updating its dispatch lists and host information.


Generated by EDoc, Jun 29 2016, 08:38:27.