Skip to content

Instantly share code, notes, and snippets.

@daniello
Created June 17, 2009 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save daniello/131207 to your computer and use it in GitHub Desktop.
Save daniello/131207 to your computer and use it in GitHub Desktop.
%% @author Daniel Kwiecinski <daniel@lambder.com>
%% @copyright Daniel Kwiecinski author.
%% @doc Example of redirect webmachine_resource.
-module(redirect_resource).
-export([init/1, resource_exists/2, moved_temporarily/2, previously_existed/2]).
-include_lib("webmachine/include/webmachine.hrl").
init([]) -> {ok, undefined}.
moved_temporarily(ReqData, Context) ->
Site = wrq:path_info(site, ReqData),
Location = base64:decode(Site),
{{true, Location}, ReqData, Context}.
previously_existed(ReqData, Context) -> {true, ReqData, Context}.
resource_exists(ReqData, Context) -> {false, ReqData, Context}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment