1 # Filters added to this controller apply to all controllers in the application.
2 # Likewise, all the methods added will be available for all controllers.
7 class ApplicationController < ActionController::Base
8 # Pick a unique cookie name to distinguish our session data from others'
9 # session :session_key => '_software_session_id'
10 session :disabled => true
11 layout "application_no_js"
13 after_filter :set_vary_header
14 after_filter :compress
17 self.response.headers['Vary'] = 'Accept-Encoding'
21 enc = self.request.env['HTTP_ACCEPT_ENCODING']
22 if enc and (md = enc.match(/gzip;?(q=([^,]*))?/))
23 if md[1].nil? or md[2].to_f > 0.0
24 if self.response.headers["Content-Transfer-Encoding"] != 'binary'
25 logger.debug "compressing output"
27 ostream = StringIO.new
28 gz = Zlib::GzipWriter.new(ostream)
29 gz.write(self.response.body)
30 self.response.body = ostream.string
31 self.response.headers['Content-Encoding'] = 'gzip'
40 def rescue_action_in_public(exception)
41 @message = exception.message
43 render :template => "error", :layout => :false, :status => 404
45 render :template => 'error', :layout => "application", :status => 404