== DESCRIPTION: A fast AMF serializer/deserializer and request/response wrappers to simplify remoting implementation. == INSTALL: gem install RocketAMF --source="http://gemcutter.org" == EXAMPLE: # helloworld.ru require 'rocketamf' class HelloWorldApp APPLICATION_AMF = 'application/x-amf'.freeze def call env if is_amf?(env) # Wrap request and response env['rack.input'].rewind request = RocketAMF::Request.new.populate_from_stream(env['rack.input'].read) response = RocketAMF::Response.new # Handle request response.each_method_call request do |method, args| raise "Service #{method} does not exists" unless method == 'App.helloWorld' 'Hello world' end # Pass back response response_str = response.serialize return [200, {'Content-Type' => APPLICATION_AMF, 'Content-Length' => response_str.length.to_s}, [response_str]] else return [200, {'Content-Type' => 'text/plain', 'Content-Length' => '16' }, ["Rack AMF gateway"]] end end private def is_amf? env return false unless env['CONTENT_TYPE'] == APPLICATION_AMF return false unless env['PATH_INFO'] == '/amf' return true end end run HelloWorldApp.new == LICENSE: (The MIT License) Copyright (c) 2009 Stephen Augenstein and Jacob Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.