Changeset 715
- Timestamp:
- 02/20/05 17:18:59 (4 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/caching.rb (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/components.rb (modified) (2 diffs)
- trunk/railties/lib/webrick_server.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/caching.rb
r525 r715 91 91 private 92 92 def page_cache_path(path) 93 if path[-1,1] == '/' 94 page_cache_directory + path + '/index' 95 else 96 page_cache_directory + path 97 end 93 page_cache_directory + path + ".html" 98 94 end 99 95 end … … 116 112 # cache_page "I'm the cached content", :controller => "lists", :action => "show" 117 113 def cache_page(content = nil, options = {}) 114 logger.info "Cached page: #{options.inspect} || #{caching_allowed}" 118 115 return unless perform_caching && caching_allowed 119 116 self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true }))) … … 122 119 private 123 120 def caching_allowed 124 !@request.post? && (@request.parameters.reject { |k, v| %w( id action controller ).include?(k) }).empty?121 !@request.post? 125 122 end 126 123 end trunk/actionpack/lib/action_controller/components.rb
r713 r715 6 6 def render_component(options) 7 7 @controller.logger.info("Start rendering component (#{options.inspect}): ") 8 @controller.send(:component_response, options).body8 result = @controller.send(:component_response, options).body 9 9 @controller.logger.info("\n\nEnd of component rendering") 10 return result 10 11 end 11 12 end … … 16 17 response = component_response(options) 17 18 logger.info "Rendering component (#{options.inspect}): " 18 re nder_text(response.body, response.headers["Status"])19 result = render_text(response.body, response.headers["Status"]) 19 20 logger.info("\n\nEnd of component rendering") 21 return result 20 22 end 21 23 trunk/railties/lib/webrick_server.rb
r617 r715 6 6 7 7 include WEBrick 8 8 9 9 10 class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet … … 43 44 def handle_file(req, res) 44 45 begin 46 add_dot_html(req) 45 47 @file_handler.send(:do_GET, req, res) 48 remove_dot_html(req) 46 49 return true 47 50 rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err … … 50 53 rescue => err 51 54 return false 55 ensure 56 remove_dot_html(req) 52 57 end 58 end 59 60 def add_dot_html(req) 61 if /^([^.]+)$/ =~ req.path then req.instance_variable_set(:@path_info, "#{$1}.html") end 62 end 63 64 def remove_dot_html(req) 65 if /^([^.]+).html$/ =~ req.path then req.instance_variable_set(:@path_info, $1) end 53 66 end 54 67