Terminal newlines in docs. Sigh
1 %% An example JSON-RPC service
2 %%---------------------------------------------------------------------------
3 %% Copyright (c) 2007 Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
4 %% Copyright (c) 2007 LShift Ltd. <query@lshift.net>
6 %% Permission is hereby granted, free of charge, to any person
7 %% obtaining a copy of this software and associated documentation
8 %% files (the "Software"), to deal in the Software without
9 %% restriction, including without limitation the rights to use, copy,
10 %% modify, merge, publish, distribute, sublicense, and/or sell copies
11 %% of the Software, and to permit persons to whom the Software is
12 %% furnished to do so, subject to the following conditions:
14 %% The above copyright notice and this permission notice shall be
15 %% included in all copies or substantial portions of the Software.
17 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 %% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 %% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 %% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 %% BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 %% ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 %% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 %%---------------------------------------------------------------------------
27 -module(test_jsonrpc_inets).
29 -include("rfc4627_jsonrpc.hrl").
31 -behaviour(gen_server).
33 -export([start/0, start_httpd/0]).
34 -export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2]).
37 {ok, Pid} = gen_server:start(?MODULE, [], []),
38 rfc4627_jsonrpc:register_service
40 rfc4627_jsonrpc:service(<<"test">>,
41 <<"urn:uuid:afe1b4b5-23b0-4964-a74a-9168535c96b2">>,
43 [#service_proc{name = <<"test_proc">>,
45 params = [#service_proc_param{name = <<"value">>,
46 type = <<"str">>}]}])).
49 rfc4627_jsonrpc:start(),
50 httpd:start("test/server_root/conf/httpd.conf"),
53 %---------------------------------------------------------------------------
58 terminate(_Reason, _State) ->
61 code_change(_OldVsn, State, _Extra) ->
64 handle_call({jsonrpc, <<"test_proc">>, _ModData, [Value]}, _From, State) ->
65 {reply, {result, <<"ErlangServer: ", Value/binary>>}, State}.
67 handle_cast(Request, State) ->
68 error_logger:error_msg("Unhandled cast in test_jsonrpc: ~p", [Request]),
71 handle_info(Info, State) ->
72 error_logger:error_msg("Unhandled info in test_jsonrpc: ~p", [Info]),