【问题标题】:set content type header with rails and apache使用 rails 和 apache 设置内容类型标题
【发布时间】:2011-01-21 18:18:19
【问题描述】:

我想将生成的视图作为 kml 文件发送,带有必要的标题(内容类型和文件过期)......使用 head 给出 500,使用 response.headers 没有效果......

我该怎么办?

【问题讨论】:

  • 你能发布你的代码尝试使用 response.headers 吗?

标签: ruby-on-rails apache ruby-on-rails-3 header kml


【解决方案1】:

【讨论】:

  • 指南!该死,我仍然生活在一个 API 文档可用的梦想世界中。
【解决方案2】:

您需要注册 KML mime 类型。 In your config/initializers/mime_types.rb

Mime::Type.register "application/vnd.google-earth.kml", :kml 

那么在你的行动中你可以做到:

format.kml { ... }

KML 教程:http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-22
    • 1970-01-01
    • 2013-09-09
    • 1970-01-01
    • 2018-11-29
    • 2020-06-29
    • 2019-07-20
    • 1970-01-01
    相关资源
    最近更新 更多