Class | ActionController::AbstractRequest |
In: |
lib/action_controller/deprecated_request_methods.rb
lib/action_controller/request.rb |
Parent: | Object |
Subclassing AbstractRequest makes these methods available to the request objects used in production and testing, CgiRequest and TestRequest
env | [R] | Returns the hash of environment variables for this request, such as { ‘RAILS_ENV’ => ‘production’ }. |
Determine whether the body of a HTTP call is URL-encoded (default) or matches one of the registered param_parsers.
For backward compatibility, the post format is extracted from the X-Post-Data-Format HTTP header if present.
Returns the domain part of a host, such as rubyonrails.org in "www.rubyonrails.org". You can specify a different tld_length, such as 2 to catch rubyonrails.co.uk in "www.rubyonrails.co.uk".
Returns the HTTP request method as a lowercase symbol (:get, for example). Note, HEAD is returned as :get since the two are supposedly to be functionaly equivilent for all purposes except that HEAD won‘t return a response body (which Rails also takes care of elsewhere).
Returns the interpreted path to requested resource after all the installation directory of this application was taken into account
Returns a hash with the parameters used to form the path of the request
Example:
{:action => 'my_action', :controller => 'my_controller'}
Determine whether the body of a HTTP call is URL-encoded (default) or matches one of the registered param_parsers.
For backward compatibility, the post format is extracted from the X-Post-Data-Format HTTP header if present.
Receive the raw post data. This is useful for services such as REST, XMLRPC and SOAP which communicate over HTTP POST but don‘t use the traditional parameter format.
Determine originating IP address. REMOTE_ADDR is the standard but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR are set by proxies so check for these before falling back to REMOTE_ADDR. HTTP_X_FORWARDED_FOR may be a comma- delimited list in the case of multiple chained proxies; the first is the originating IP.
Return the request URI, accounting for server idiosyncracies. WEBrick includes the full URL. IIS leaves REQUEST_URI blank.
Returns all the subdomains as an array, so ["dev", "www"] would be returned for "dev.www.rubyonrails.org". You can specify a different tld_length, such as 2 to catch ["www"] instead of ["www", "rubyonrails"] in "www.rubyonrails.co.uk".