Sha256: 775918c87f5e6eff103a1b2b6e30836270f8037f059aee7dc5e8811b352ca7e8
Contents?: true
Size: 1.65 KB
Versions: 3
Compression:
Stored size: 1.65 KB
Contents
require 'dispatcher' require 'net/ajp13/server' require File.dirname(__FILE__) + File::SEPARATOR + 'rails-wrapper.rb' class AjpRailsDispatcher < Dispatcher class << self # Dispatch the given AJP request, using the given session options, and # returns the response object. #-- # Be sure to handle the exceptions it raises # on multipart requests (EOFError and ArgumentError). #++ def dispatch(ajp_req, session_options, server_environments) request = AjpRailsRequest.new(ajp_req, session_options, server_environments) response = AjpRailsResponse.new prepare_application ActionController::Routing::Routes.recognize!(request).process(request, response) ajp_req.output_cookies.each do |cookie| if cookie.name == 'JSESSIONID' case cookie.value when String cookie.value << '.' << server_environments['LOAD_BALANCE_ID'] when Array cookie.value.each do |item| item << '.' << server_environments['LOAD_BALANCE_ID'] end end end end response.to_ajp_response(ajp_req.output_cookies) rescue Object => exception puts exception.message + ":" + exception.backtrace.join("\n") failsafe_response(500) do ActionController::Base.process_with_exception(request, AjpRailsResponse.new, exception).to_ajp_response(ajp_req.output_cookies) end ensure # Do not give a failsafe response here. reset_after_dispatch end # If the block raises, send status code as a last-ditch response. def failsafe_response(status) yield rescue Object begin Net::AJP13::Response.new(status) rescue Object end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ajp-rails-0.0.3 | lib/ajp-rails/ajp_rails_dispatcher.rb |
ajp-rails-0.0.4 | lib/ajp-rails/ajp_rails_dispatcher.rb |
ajp-rails-0.1.0 | lib/ajp-rails/ajp_rails_dispatcher.rb |