Hi Kevin,
first of all let me say that ewgi is in early development phase, some
things may change and it's not ready for production.
I'm not an expert in erlyweb, I haven't tried it yet, however I'd like
to see a working ewgi_erlyweb bridge.
Below some thoughts.
Kevin A. Smith wrote:
> I'm considering porting Erlyweb to use ewgi to loosen the coupling
> with yaws. As I see it there are 2 main touch points between Erlyweb
> and yaws:
>
> * yaws_args/yaws_headers - This looks pretty straightforward. We'd
> just need to replace yaws api calls with the corresponding ewgi calls.
This should be easy.
A problem might be ewgi missing support for yaws opaque data. Is it
required from erlyweb?
A solution might be using parametrized modules, but I was also thinking
to add some specialized field in ewgi environment to pass data to
applications.
> ewgi appears to be missing cookie support in ewgi_api but I think I
> could add that. Does this sound about right?
Cookies are not there yet. I started implementing very basic HTTP features.
If you want to contribute the code I'll be happy to add it ;-).
>
> * erlyweb:out/1 -- I'm hung up on this one and looking for some ideas.
> Yaws calls this function directly for each request. Does ewgi have
> something we could shim in here in its place? I'm thinking of some
> sort of appmod that proxies yaws calls into Erlyweb.
>
You need to write a adapter between erlyweb and ewgi and then an appmod.
Supposing the adapter is called ewgi_erlyweb, it should be somenthing
like this:
-module(ewgi_erlyweb).
handle_req(Env, StartResp) ->
%% this is called at every request and shall pass
%% the request to erlyweb in the correct way
out(A) ->
Server = ewgi_yaws:new(?MODULE),
Server:run(A).
and then if you want to switch to mochiweb you replace out with:
start() ->
mochiweb_http:start([{loop, fun ?MODULE:loop/1} | ?DEFAULTS]).
stop() ->
mochiweb_http:stop(?MODULE).
loop(Req) ->
M = ewgi_mochiweb:new(?MODULE),
M:run(Req).
cheers,
filippo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---