class LogStash::Kibana::App

Public Instance Methods

static_file() click to toggle source
# File lib/logstash/kibana.rb, line 38
def static_file
  # request.path_info is the full path of the request.
  docroot =  File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/kibana"))
  path = File.join(docroot, *request.path_info.split("/"))
  if File.exists?(path)
    ext = path.split(".").last
    content_type MIME::Types.type_for(ext).first.to_s
    body File.new(path, "r").read
  else
    status 404
    content_type "text/plain"
    body "File not found: #{path}"
  end
end