class ActionDispatch::Routing::Redirect
:nodoc:
def call(env)
def call(env) serve Request.new env end
def escape(params)
def escape(params) params.transform_values { |v| Rack::Utils.escape(v) } end
def escape_fragment(params)
def escape_fragment(params) params.transform_values { |v| Journey::Router::Utils.escape_fragment(v) } end
def escape_path(params)
def escape_path(params) params.transform_values { |v| Journey::Router::Utils.escape_path(v) } end
def initialize(status, block)
def initialize(status, block) @status = status @block = block end
def inspect
def inspect "redirect(#{status})" end
def path(params, request)
def path(params, request) block.call params, request end
def redirect?; true; end
def redirect?; true; end
def relative_path?(path)
def relative_path?(path) path && !path.empty? && path[0] != "/" end
def serve(req)
def serve(req) uri = URI.parse(path(req.path_parameters, req)) unless uri.host if relative_path?(uri.path) uri.path = "#{req.script_name}/#{uri.path}" elsif uri.path.empty? uri.path = req.script_name.empty? ? "/" : req.script_name end end uri.scheme ||= req.scheme uri.host ||= req.host uri.port ||= req.port unless req.standard_port? req.commit_flash body = %(<html><body>You are being <a href="#{ERB::Util.unwrapped_html_escape(uri.to_s)}">redirected</a>.</body></html>) headers = { "Location" => uri.to_s, "Content-Type" => "text/html", "Content-Length" => body.length.to_s } [ status, headers, [body] ] end