a question on misultin

gnoblin <>
Tue Aug 17 11:56:23 CEST 2010


I've decided to use misultin as a webserver for my client-server
application, and I am trying to do the following:

Case 1:

% process1
handle_http(Req) ->
    % get params
    Args = Req:parse_qs(),

    case proplists:get_value("value", Args) of
        %% we got an empty request?
        undefined ->

	Input ->
            io:format("got a request~p~n",
            Req:ok([?CONTENT_TYPE], "<html>"++"Ok"++"</html>")

Result: I see the response in my browser.

Case 2:
If instead of Req:ok([?CONTENT_TYPE], "<html>"++"Ok"++"</html>") I
send a message to process2, which processes the request and sends the
response via a message to process1,

and it is received in process1 here:

loop() ->
        {respond, Req, Json} ->
            io:format("Responding back! ~n"),
            %% falls somewhere here
            %% it seems i can't do it like this...
            Req:ok([?CONTENT_TYPE], "<html>"++Json++"</html>"),
        Other ->
            io:format("says: I've got some strange message here: ~p~n",

Result: I don't see the response.

The question is: if I can't do it like that - what is the correct way
to do it? I'd like to get a string via http from client, send it to
other processes, get the response back to process with misultin and
send it back to the user.


More information about the erlang-questions mailing list