Class | ActionController::AbstractRequest |
In: |
lib/action_controller/request.rb
|
Parent: | Object |
These methods are available in both the production and test Request objects.
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 interpreted path to requested resource after all the installation directory of this application was taken into account
Returns a port suffix like ":8080" if the port number of this request is not the default HTTP port 80 or HTTPS port 443.
Determine whether the body of a POST request is URL-encoded (default), XML, or YAML by checking the Content-Type HTTP header:
Content-Type Post Format application/xml :xml text/xml :xml application/x-yaml :yaml text/x-yaml :yaml * :url_encoded
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.
Returns the path minus the web server relative installation directory. This method returns nil unless the web server is apache.
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.
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".