JSONRequest

class
Superclass
Mongrel2::Request
Extended With
Loggability

The Mongrel2 JSON Request class. Instances of this class represent a JSSocket request from a Mongrel2 server.

Attributes

data[R]

The parsed request data

Public Class Methods

anchor
new( sender_id, conn_id, path, headers, body, raw=nil )

Parse the body as JSON.

# File lib/mongrel2/jsonrequest.rb, line 22
def initialize( sender_id, conn_id, path, headers, body, raw=nil )
        super
        self.log.debug "Parsing JSON request body"
        @data = Yajl.load( body )
        self.log.debug "  body is: %p" % [ @data ]
end

Public Instance Methods

anchor
is_disconnect?()

Returns true if the request is a special Mongrel2 'disconnect' notification.

# File lib/mongrel2/jsonrequest.rb, line 40
def is_disconnect?
        return true if self.data['type'] == 'disconnect'
end