Class: Chimp::ChimpDaemon::GenericServlet

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/right_chimp/daemon/ChimpDaemon.rb

Overview

GenericServlet – servlet superclass

Direct Known Subclasses

AdminServlet, DisplayServlet, GroupServlet, JobServlet

Instance Method Summary collapse

Instance Method Details

#get_id(req) ⇒ Object



232
233
234
235
236
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 232

def get_id(req)
  uri_parts = req.request_uri.path.split('/')
  id = uri_parts[-2]
  return id
end

#get_payload(req) ⇒ Object

Get the body of the request– assume YAML



241
242
243
244
245
246
247
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 241

def get_payload(req)
  begin
    return YAML::load(req.body)
  rescue StandardError => ex
    return nil
  end
end

#get_verb(req) ⇒ Object



228
229
230
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 228

def get_verb(req)
  r = req.request_uri.path.split('/')[2]
end