httpd module vs inets {packet,http}

Jon Hancock ke.han@REDACTED
Wed Mar 8 14:55:35 CET 2006


My understanding is that REST is all about returning XML documents.   
So a gross overview of the REST transaction life-cycle is:
	1 - fetch incoming requests (I think REST requests come wrapped in  
an HTTP format?)
	2 - decode the request's URI and parameters
	3 -  statically or dynamically construct the resource to return
	4 - return the resource as an XML doc

Yaws will be a champ at this sort of thing.
The HowTo you reference is enlightening and well written.  The HowTo  
shows how to write your own socket server.    You would only want to  
do this for something very specialized.  For example, if you wanted  
to build a new server to handle some custom protocol you've written  
you would start with this HowTo structure and build from there.  I am  
building an app that has just this requirement and I found the HowTo  
to be a solid starting point.
But for your needs, go with Yaws.

On Mar 8, 2006, at 6:24 PM, Ryan Rawson wrote:

> Would you mind elaborating a bit for me?
>
> Basically my application is going to automatically discover its fellow
> node hosts via LDAP (we have a mechanism already), use mnesia to
> maintain state across them, and each machine is going to answer HTTP
> service queries.  That is my current design - one major advantage is
> mnesia is a great cross-node database, great for high read/low write
> services that need to be able to answer questions quickly but don't do
> nearly as many writes.  This particular feature of my app made me
> think Erlang would be well suited.
>
> -ryan
>
>
> On 3/8/06, Sean Hinde <sean.hinde@REDACTED> wrote:
>> That is interesting feedback on the tutorial, thanks.
>>
>> If I can find time to wrestle again with the sometimes flaky update
>> mechanism on the Trapexit HOWTO pages I will update the tutorial to
>> point out more clearly where the API to user code appears, as well as
>> checkin a couple of bugfixes from folks who have studied it deeply
>> and posted on the list.
>>
>> FWIW I would recommend Yaws most highly for new applications. It is
>> not nearly as heavyweight as it first appears, and is very nice for
>> writing this sort of application.
>>
>> Sean
>>
>> On 8 Mar 2006, at 08:11, Ryan Rawson wrote:
>>
>>> I didn't like the howto - it seemed like my code would be littered
>>> with http protocol droppings, even though the actual framing is  
>>> taken
>>> care of by the http packet mode.
>>>
>>> I think for me, yaws seems like this whole big thing, and kind of
>>> bothers me - enough to look at alternatives first.
>>>
>>> Thanks for the mod_esi pointer.
>>>
>>> -ryan
>>>
>>> On 3/8/06, Matthias Lang <matthias@REDACTED> wrote:
>>>>
>>>> A "REST" web service seems to be some sort philosophy for how to
>>>> design a service. For the purpose of "how do I do this in  
>>>> Erlang", I
>>>> think it just boils down to "how do I serve dynamically  
>>>> generated web
>>>> pages". If it's not, then my answer probably misses the point.
>>>>
>>>> So: if you just want to serve dynamic web pages, you can choose
>>>> between two ready-made web servers: OTP's httpd and YAWS. Both web
>>>> servers are used in the real world. They have different peformance
>>>> tradeoffs and different approaches to interfacing with 'your'
>>>> application. YAWS seems to be more popular for new applications. If
>>>> you can't make up your mind about which one to use, flip a coin.
>>>>
>>>> The OTP httpd interface you probably want to use is 'mod_esi':
>>>>
>>>>   http://www.erlang.org/doc/doc-5.4.12/lib/inets-4.6.2/doc/html/
>>>> mod_esi.html
>>>>
>>>> Writing code to use it is straightforward, the hard part is all the
>>>> fudging around with httpd.conf.
>>>>
>>>> If, on the other hand, you want to write your own web server 'from
>>>> scratch', then the undocumented http mode of the packet driver is
>>>> useful. That's what the 'howto' you found is about.
>>>>
>>>> Matthias
>>>>
>>>> --------------------
>>>>
>>>> Ryan Rawson writes:
>>>>> Hi all,
>>>>>
>>>>> I read the 'fast httpd' howto from trapexit.org, and I also
>>>>> looked at
>>>>> the httpd module in OTS.  I'm a little confused - it seems to me
>>>>> that
>>>>> the httpd howto doesn't use the httpd module, it uses a  
>>>>> undocumented
>>>>> feature of the packet driver (which may in turn internally use the
>>>>> httpd module).  While the httpd documentation seems to describe
>>>>> callbacks but its kind of thinly documented.  Not the end of the
>>>>> world, but I'm confused - what is the recommended thing to do  
>>>>> here?
>>>>> What do other people do?  Say for example, creating a REST "web
>>>>> service" ?
>>>>>
>>>>> Thanks in advance for any tips and hints.
>>>>> -ryan
>>>>
>>
>>



More information about the erlang-questions mailing list