Anonymous avatar Anonymous committed 5377cf4

cleanup

Comments (0)

Files changed (36)

Add a comment to this file

Mnesia.nonode@nohost/LATEST.LOG

Binary file modified.

Add a comment to this file

Mnesia.nonode@nohost/schema.DAT

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_app.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_decision_core.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_deps.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_dispatcher.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_error_handler.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_logger.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_mochiweb.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_multipart.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_perf_logger.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_request.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_request_srv.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_resource.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_skel.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_sup.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/webmachine_util.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/wmtrace_resource.beam

Binary file modified.

Add a comment to this file

deps/webmachine/ebin/wrq.beam

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Add a comment to this file

ebin/webmstn_dynamic_resource.beam

Binary file removed.

Add a comment to this file

ebin/webmstn_notes_resource.beam

Binary file modified.

Add a comment to this file

ebin/webmstn_resource.beam

Binary file removed.

Add a comment to this file

ebin/webmstn_static_resource.beam

Binary file modified.

Binary file modified.

priv/dispatch.conf

-{["notes"], webmstn_dynamic_resource, []}.
-{['*'], webmstn_static_resource, ['PATHTOWWW']}.
-
+{["wmtrace",'*'],wmtrace_resource,[{trace_dir,"priv/traces"}]}.
+{["notes",act], webmstn_notes_resource,[{trace_dir,"priv/traces"}]}.
+{["notes"], webmstn_notes_resource,[{trace_dir,"priv/traces"}]}.
+{['*'], webmstn_static_resource,[{trace_dir,"priv/traces"},"priv/www"]}.
Add a comment to this file

priv/log/access.log.2009_09_27_23

Empty file removed.

priv/www/index.html

 
 <body>
    <h1>Sticky Notest - MochiWeb - WebMachine test</h1>
-   <a href="stickynotes.html" target="new">Go directly to Sticky Notes!</a><hr>
+   <a href="stickynotes.html" target="new">Go directly to Sticky Notes</a>
+   &nbsp;
+   &nbsp;
+   <a href="wmtrace" target="new">Last Trace</a>
+   &nbsp;
+   &nbsp;
+   <a href="wmtrace" target="new">All Traces</a>
+   <hr>
    <form name="myForm" action="javascript:ajaxFunction()">
    <table id="tt">
      <tr><td>URL:          </td><td><input id="url" type="text" size="90" value='/notes'></td></tr>

priv/www/js/application.js

 	$.post( url, {"json": data}, callback, "json");
 }
 
+function get(json, url, callback){
+	var data = JSON.stringify(json);
+	$.get( url, {"json": data}, callback, "json");
+}
+
 function attachEvent(note){
 	note.children("textarea").focus(function(){
 		zTop($(this).parent("div.note"));	
 		"action" : "read_all",
 	}
 
-	post(json, "/notes", cbAll);	
+	get(json, "/notes/all", cbAll);	
 }
 
 $(document).ready(function(){

src/webmstn_notes_resource.erl

 
 -include_lib("webmachine/include/webmachine.hrl").
 
-init([]) -> {ok, undefined}.
+init([]) -> {ok, undefined};
+init([Cfg]) -> 
+    {trace_dir,Dir} = Cfg,
+	AbsDir =filename:absname(Dir), 
+	io:format("= = = = = = ~nnotes_resource Cfg=~p,  absdir=~p~n",[Cfg,AbsDir]),
+	{{trace,AbsDir}, Cfg}.
 
 content_types_provided(RD,Ctx) ->
     {[{"application/json",to_json}],RD,Ctx}.
     {true, RD, Ctx}.
 
 process_post(RD,Ctx) ->
-    io:format("--> process_post~n"),
+%   io:format("--> process_post~n"),
     Data = mochiweb_util:parse_qs(wrq:req_body(RD)),
     io:format("--> process_post Data:~n~p~n",[Data]),
     Struct = mochijson2:decode(proplists:get_value("json", Data)),
 %    io:format("--> process_post Act:~n~p~n",[Act]),
     RD1 = wrq:set_resp_header("Content-Type", "application/json",RD),
     Ans = mochijson2:encode(notes:Act(Struct)),
+    io:format("--> process_post DB Response:~p~n",[Ans]),
 %    io:format("--> process_post DB Response:~p~nbefore~n~p~n",[Ans,RD]),
     RD2 = wrq:append_to_resp_body(Ans,RD1),
 %    RD1 = wrq:append_to_response_body(<<"body here">>,RD1),
 %    io:format("--> process_post RD~n~p~n",[RD2]),
     {true,RD2,Ctx}.
-  
+  

src/webmstn_static_resource.erl

 
 -record(context, {docroot,fullpath}).
 
-init([DocRoot]) -> {ok, #context{docroot=DocRoot}}.
+init([DocRoot]) -> {ok, #context{docroot=DocRoot}};
+init([Cfg,DocRoot]) -> 
+    {trace_dir,Dir} = Cfg,
+	AbsDir =filename:absname(Dir), 
+	io:format("= = = = = = ~nstatic_resource Cfg=~p,  AbsDir=~p~nDocRoot =~p~n",
+			[Cfg,AbsDir,DocRoot]),
+	{{trace,AbsDir}, #context{docroot=DocRoot}}.
 
 content_types_provided(ReqProps, Context) ->
 %    io:format("content_types_provided: ctx: ~p~n~nreq:~p~n~n",[Context,ReqProps]),

src/webmstn_sup.erl

     [supervisor:start_child(?MODULE, Spec) || Spec <- Specs],
     ok.
 
-%% @spec prep_dispatch(DispatchTemplate) -> Dispatch
-%% @doc replace 'PATHTOWWW' -> absolute path to "./priv/www" in the Dispatch
-%% @doc Example: {['*',webmstn_static_resource,['PATHTOWWW']}
-%% @doc becomes {['*',webmstn_static_resource,["c:/tmp/webcandy/priv/www"]}
-%% @doc if the app was cloned into c:/tmp/webcandy
-prep_dispatch(DispatchTemplate) -> 
-	WWWPath = filename:absname("priv/www"),
-	lists:map(fun({Pattern,Resource,Paths})->
-				{Pattern, Resource,
-				        lists:map(fun(Code) ->
-									if 
-										Code =:= 'PATHTOWWW' -> WWWPath;
-										true                 -> Code
-									end
-								end, Paths)} 
-				end, DispatchTemplate ).
-
-
-
 %% @spec init([]) -> SupervisorTree
 %% @doc supervisor callback.
 init([]) ->
     Ip = case os:getenv("WEBMACHINE_IP") of false -> "0.0.0.0"; Any -> Any end,   
-	{ok, DispatchTemplate} = file:consult("priv/dispatch.conf"),
-    io:format("************************************DispatchTmpl: ~p~n",[DispatchTemplate]),
-	Dispatch = prep_dispatch(DispatchTemplate),
+	{ok, Dispatch} = file:consult("priv/dispatch.conf"),
     io:format("Dispatch: ~p~n",[Dispatch]),
     WebConfig = [
 		 {ip, Ip},
-erl -pa ebin deps/*/ebin deps/*/deps/*/ebin -boot start_sasl -s webmstn
+werl -pa ebin deps/*/ebin deps/*/deps/*/ebin -boot start_sasl -s webmstn
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.