blogarchivesoftwareunix-tips

Software

Hessian service for rails

It’s a plugin that monkey patches Christer Sandberg’s hessian gem http://rubyforge.org/projects/hessian to support using rails controllers as hessian servers. Very easy to use, just include the hessian api and turn it on by calling hessian_api methods defined after that become callable by hessian requests. To turn back to normal methods just call normal_api. Get the tarball here .


class HessianServiceController < ApplicationController
  
  require 'hessian_api'
  include HessianApi

  hessian_api
  
  def reverse para
    para.reverse
  end
  
  def upcase para
    para.upcase
  end
  
  def echotwice para
    para *2 
  end
 
  def bar anotherpara
    'foooo'
  end

  def foo a,b,c
    a+c+b
  end
  
  normal_api
  
end


Generated with nanoc - a Ruby content management system for building static web sites.