Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  Porting Erlyweb to ewgi (Was:ErlyWeb dependencies and their

Guest
Posted: Thu Jan 03, 2008 6:43 pm Reply with quote
Guest
On Jan 3, 2008 3:32 AM, Filippo Pacini <filippo.pacini@gmail.com> wrote:
>
> 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.

I think this would be the best solution for supporting multiple
servers, so I'm all for it.

>
> 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.

The opaque data is required because ErlyWeb (and sometimes application
code) uses it to store arbitrary app metadata. I don't see a way
around it.

>
> > 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 Wink.
>
> >
> > * 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 erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum