Webmachine redirect resource example
SImle redirect resource by webmachine-way
dispatch.conf
{[], redirect_resource, ["/some/url"]}.
redirect_resource.erl
-module(redirect_resource).
-export([init/1, resource_exists/2, moved_temporarily/2, previously_existed/2]).
-include_lib("webmachine/include/webmachine.hrl").
init([Redirect_to]) -> {ok, Redirect_to}.
resource_exists(ReqData, Context) -> {false, ReqData, Context}.
previously_existed(ReqData, Context) -> {true, ReqData, Context}.
moved_temporarily(ReqData, Redirect_to) ->
{{true, Redirect_to}, ReqData, Redirect_to}.
Читайте також:
- Erlang CouchDB fault-tolerance
- Erlang: convert any string to binary utf8
- kerl - easy building and installing of Erlang/OTP instances
- Erlang: cpu usage
- Python and lists:flatten. Such as in Erlang
- Random shuffle in erlang
- flash socket policy-file-request in Erlang
- md5 в Erlang
- Erlang uuid
- Linksys Wireless ADSL Router (WAG54G V.2) httpd DoS Exploit