2010/9/21 Radu Brumariu <brum76@...>:
> thanks for the info. I found last evening the example in github. I
> have to say that I am still not very clear on how to proceed.
> At this point it looks not different than an appmod ( still an out(A)
> function as an entry ).
> What I am specifically looking is how to pass control from yaws to the
> yapp and back. Is it all in the out function ?
> Do I even need .yaws files, if the yapp will take control over how the request ?
> Also, regarding mnesia, do I need to interact w/ it, or it's there
> just for yapp handler to keep internal data ?
Well, your conclusion is correct, a Yaws application (Yapp) is just
ordinary .yaws files and/or appmods organized in a otp application
They look the same and work as any Yaws appmods or scripts, and
control is passed from yaws and back as usual with the ordinary out/1
You do not need .yaws files if you use appmods.
Now, the original idea about this was the deal with lifecycle
management of different web applications that runs under a single Yaws
So given that you have your applications in the Erlang load path, you
should be able to develop and deploy new applications independently on
a running Yaws server.
Similar to the servlet concept on Java engines like Tomcat etc.
Now there is one more important thing, and that is that you may start
a complete OTP application with supervisors/gen_servers etc. and in
that case deploy more complex service. The yapp handler application
itself is an example of this.
So if you have for instance
in your code load path, for instance by setting the ERL_LIBS
environment variable to /yapps_dir_path, you can use the yapp web
interface to add them to Yaws. The will be added to the yapp registry
(which resides in mnesia by default), and get a default URL like:
When Yaws gets a client accessing such an URL the default document
root will be changed to /yapps_dir_path/my_appX/priv/docroot and/or
any local appmods will be triggered.
So the Yapp concept is just a kind of virtual directory/appmod router
with the option to deploy complete OTP applications as well.
Hope this make things a bit clearer.