Class: ActionController::CgiRequest
Overview
Constant Summary
collapse
- DEFAULT_SESSION_OPTIONS =
{ :database_manager => CGI::Session::PStore, :prefix => "ruby_sess.", :session_path => "/" }
Instance Attribute Summary collapse
Instance Method Summary
collapse
#delete?, #domain, #get?, #head?, #host_with_port, #method, #parameters, #path, #port, #port_string, #post?, #protocol, #put?, #remote_ip, #request_uri, #ssl?, #subdomains
Constructor Details
#initialize(cgi, session_options = {}) ⇒ CgiRequest
Returns a new instance of CgiRequest.
41
42
43
44
45
|
# File 'lib/action_controller/cgi_process.rb', line 41
def initialize(cgi, session_options = {})
@cgi = cgi
@session_options = session_options
super()
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *arguments) ⇒ Object
89
90
91
|
# File 'lib/action_controller/cgi_process.rb', line 89
def method_missing(method_id, *arguments)
@cgi.send(method_id, *arguments) rescue super
end
|
Instance Attribute Details
Returns the value of attribute cgi.
36
37
38
|
# File 'lib/action_controller/cgi_process.rb', line 36
def cgi
@cgi
end
|
Instance Method Details
59
60
61
|
# File 'lib/action_controller/cgi_process.rb', line 59
def cookies
@cgi.cookies.freeze
end
|
55
56
57
|
# File 'lib/action_controller/cgi_process.rb', line 55
def env
@cgi.send(:env_table)
end
|
63
64
65
|
# File 'lib/action_controller/cgi_process.rb', line 63
def host
env["HTTP_X_FORWARDED_HOST"] || @cgi.host.split(":").first
end
|
#query_parameters ⇒ Object
47
48
49
|
# File 'lib/action_controller/cgi_process.rb', line 47
def query_parameters
@cgi.query_string ? CGIMethods.parse_query_parameters(@cgi.query_string) : {}
end
|
#reset_session ⇒ Object
84
85
86
87
|
# File 'lib/action_controller/cgi_process.rb', line 84
def reset_session
@session.delete
@session = (@session_options == false ? {} : new_session)
end
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/action_controller/cgi_process.rb', line 67
def session
return @session unless @session.nil?
begin
@session = (@session_options == false ? {} : CGI::Session.new(@cgi, session_options_with_string_keys))
@session["__valid_session"]
return @session
rescue ArgumentError => e
@session.delete if @session
raise(
ActionController::SessionRestoreError,
"Session contained objects where the class definition wasn't available. " +
"Remember to require classes for all objects kept in the session. " +
"The session has been deleted."
)
end
end
|