Created
June 17, 2009 12:02
-
-
Save daniello/131207 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @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