[Borges-users] Outbound document headers

Eric Hodel drbrain at segment7.net
Mon Apr 26 18:11:19 EDT 2004


??????? ???????? (slepnev_v at rambler.ru) wrote:

> Another thing: we do need to make the response headers customizable by 
> the app developer. For example, I needed to set the response encoding 
> to UTF-8 for my Borges app... and ended up editing response.rb . Ditto 
> for caching/no-cache. I guess this kind of thing belongs in the 
> session class. (We could make it an application preference, but then 
> we lose multilingual apps... so some other mechanism is needed.

You should be able to set headers on a document through:

r.rendering_context.document.headers, which is a Hash.

That's a bit long, how about this accessor on HtmlRenderer?, I think the
name is OK, and won't get confused with #heading:

class Borges::HtmlRenderer

  ##
  # Retrieves a Hash of the HTTP headers for the document being rendered.

  def doc_headers
    @rendering_context.document.headers
  end

end

This is, of course, untested.

-- 
Eric Hodel - drbrain at segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/borges-users/attachments/20040426/63f4433b/attachment.bin


More information about the Borges-users mailing list