lib/httpimagestore/configuration/handler.rb in httpimagestore-1.0.0 vs lib/httpimagestore/configuration/handler.rb in httpimagestore-1.1.0

- old
+ new

@@ -12,10 +12,12 @@ super 'empty body - expected image data' end end class RequestState + include ClassLogging + class Images < Hash def initialize(memory_limit) @memory_limit = memory_limit super end @@ -29,14 +31,22 @@ def [](name) fetch(name){|image_name| raise ImageNotLoadedError.new(image_name)} end end - - def initialize(body = '', locals = {}, memory_limit = MemoryLimit.new) + + def initialize(body = '', matches = {}, path = '', query_string = {}, memory_limit = MemoryLimit.new) + @locals = {} + @locals.merge! query_string + @locals[:path] = path + @locals.merge! matches + @locals[:query_string_options] = query_string.sort.map{|kv| kv.join(':')}.join(',') + log.debug "processing request with body length: #{body.bytesize} bytes and locals: #{@locals} " + + @locals[:body] = body + @images = Images.new(memory_limit) - @locals = {body: body}.merge(locals) @memory_limit = memory_limit @output_callback = nil end attr_reader :images @@ -232,8 +242,10 @@ def self.post(configuration) log.warn 'no handlers configured' if configuration.handlers.empty? end end + RequestState.logger = Global.logger_for(RequestState) + Global.register_node_parser Handler end