thoughts scribbles images from silicon plateau
RSS icon Home icon
  • Erlang talking to apache via AJP mod_jk

    Posted on February 20th, 2009 jebu 6 comments

    Where have I been all this time since Onam? Its been 5 months since I wrote something, things have been busy at work and I have been exploring a new language, Erlang.

    I was first exposed to Erlang via blog posts popping up on HackerNews and Lambda the Ultimate. Lots of good things were said there and I have had a liking to recursive functions since my Pascal days. So did a deep dive, got the Erlang Bible by Joe Armstrong on my London trip and the book was a revelation. The syntax was weird at first but then I have begun to like it. The pattern matching function syntax is just the one for writing recursive functions. And yeah bit manipulation with pattern matching is like absolute heaven if you want to do some protocol implementation.

    Coupling Erlang to provide a web interface is essential, and I was hacking around with the scgi adapter, which was in disco and lighttpd. But then I needed a plugin to apache and scgi was not an option. Other options cgi, fcgi, ajp. Of these ajp was the best fit since mod_jk is pretty widely used for coupling servlet containers. I could not find an official spec for AJP and Apache’s documentation was the best available. The protocol is pretty straight forward and getting it working from an Erlang implementation was quick. I have a working version up and is available on github. This is the first time I’m putting something out in public domain so forgive any obvious mistakes and feel free to point out or jump in and fix things.

    There is lot of scope for improvement in there, this is just a working skeleton to serve requests from Erlang. I have tried to give it a bit order by having a behaviour defined for any module to plugin. Have your module confirm to the gen_ajp_handler behaviour and call back to gen_ajp_handler methods send_headers, send_data, request_data, end_request for obvious functionality. The dispatch mechanism is not yet filled out. Watch out here and on git hub for updates.

    • http://nilesh.hiray.name sahaab

      congratulations! i am going to use this soon ;)

    • jebu

      @sahaab i’m sure you will need it

    • http://www.cheapbootsforsale.us ugg boots

      “Well , the view of the passage is totally correct ,your details air jordan 19 is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!

    • http://www.discountbootsonsale.co.uk ugg boots

      Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or
      ajf 13
      If its common it might be difficult to get, however, be creative and you can usually find something.

    • http://www.moncler-down-jackets.com nike air force 1

      thread! I'm not agree you standpoint,but toally approve your view!Anybody has his own dream,someone makes them reality , air jordan 9 another leaves it just dreams.So it lie on how hard you distribute,how long you persist! This post make a way to lead to success,ugg boots for saleany only insist on studying new knowledge and digest them for your own that can make you gradually growing up , Nike Air Force 1 Lowthank you for this outline,it will be very useful for those who are in the lost! ugg boots for sale

    • http://www.gucci-outlet-store.com gucci outlet

      The post of content is very interesting and exciting. I learned a lot from here.The content from simple to complex, so all of you can come in . No matter you want to see what can be found.By the way ,there are some websites is also very wonderful,you can go and see.such as air jordan 16.5