Permalink
Browse files

Added get_path/1, which will be used to get out current path

  • Loading branch information...
1 parent 854b2c6 commit 3bd2651bd92e183334c78a7f0e2eb9d52d7295dd @baphled committed Apr 11, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/chatterl/src/cwiga.erl
View
7 lib/chatterl/src/cwiga.erl
@@ -69,6 +69,9 @@ dispatch_requests(Req) ->
Response = gen_server:call({global,?MODULE},{Method, Path, get_content_type(Ext), Post, Req}),
Req:respond(Response).
+get_path(Req) ->
+ [Path|_Ext] = string:tokens(Req:get(path),"."),
+ Path.
%%====================================================================
%% gen_server callbacks
%%====================================================================
@@ -111,8 +114,8 @@ handle_call({'GET',Url,ContentType,_Post,Req},_From,State) ->
handle_call({'DELETE',Url,ContentType,_Post,Req},_From,State) ->
Reply = handle_response(handle_request('DELETE',Url,ContentType,Req),ContentType),
{reply, Reply, State};
-handle_call({_,Url,ContentType,_Path,_Req},_From,State) ->
- Reply = send_response(error,{error("Unknown command: " ++Url, ContentType),ContentType}),
+handle_call({_,_Url,ContentType,_Path,Req},_From,State) ->
+ Reply = send_response(error,{error("Unknown command: " ++ get_path(Req), ContentType),ContentType}),
{reply, Reply, State};
handle_call(_Request, _From, State) ->
Reply = ok,

0 comments on commit 3bd2651

Please sign in to comment.