Module z_sites_dispatcher

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

Copyright © 2009 Marc Worrell Date: 2009-12-15

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.
dispatch/3Match the host and path to a dispatch rule.
get_fallback_site/0Retrieve the fallback site.
handle_call/3Match a host/path to the dispatch rules.
handle_cast/2Load a new set of dispatch rules.
handle_info/2Handling all non call/cast messages.
init/1Initiates the server.
set_dispatch_rules/1Store a new set of dispatch rules, called when a site refreshes its modules or when a site is restarted.
start_link/0Starts the server.
start_link/1
terminate/2This function is called by a gen_server when it is about to terminate.

Function Details

code_change/3

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

Convert process state when code is changed

dispatch/3

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

Match the host and path to a dispatch rule.

get_fallback_site/0

get_fallback_site() -> any()

Retrieve the fallback site.

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}

Match a host/path to the dispatch rules. Return a match result or a no_dispatch_match tuple.

handle_cast/2

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

Load a new set of dispatch rules.

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

init/1

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

Initiates the server.

set_dispatch_rules/1

set_dispatch_rules(DispatchRules) -> any()

Store a new set of dispatch rules, called when a site refreshes its modules or when a site is restarted.

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.


Generated by EDoc, Feb 25 2011, 21:14:41.