Class: MapServerLegendInfo
- Inherits:
-
Object
- Object
- MapServerLegendInfo
- Defined in:
- lib/map_server_legend_info.rb
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/map_server_legend_info.rb', line 6 def call(env) request = Rack::Request.new(env) headers = { "Content-Type" => "application/json" } begin response = Rack::Response.new(get_legends(request), 200, headers) # set caching information age = request['image_return_url'] == 'true' ? 20.minutes : 1.month response.headers['Cache-Control'] = "public, max-age=#{age}" rescue Exception => e response = Rack::Response.new({ :error => e. }.to_json, 500, headers) end response.to_a end |