Class: Merb::Request

Class | Merb::Request
In: | lib/merb-core/dispatch/dispatcher.rb lib/merb-core/dispatch/request.rb
Parent: | Object

### Methods

_process_block_return accept accept_charset accept_encoding accept_language ajax? cache_control connection content_length content_type controller domain find_route! full_uri gateway handle handled? host if_modified_since if_none_match keep_alive matched! matched? message method new params path path_info port protocol query_string rack_response raw_post referer remote_ip reset_params! script_name server_name server_software ssl? subdomains uri user_agent version xhr? xml_http_request?

### Included Modules

Merb::ControllerExceptions

### Constants

METHODS | = | %w{get post put delete head options}

### Attributes

env | [RW] | :api: private
exceptions | [RW] | :api: public
route | [RW] | :api: private
route_params | [R] | :api: private

### Public Class methods

new(rack_env)

Initialize the request object.

#### Parameters

http_request<~params:~[], ~body:IO>: | An object like an HTTP Request.

:api: private

### Public Instance methods

_process_block_return(retval)

#### Notes

Processes the return value of a deferred router block and returns the current route params for the current request evaluation

:api: private

accept()

#### Returns

String: | The accepted response types. Defaults to "*/*".

:api: private

accept_charset()

#### Returns

String: | The accepted character sets.

:api: public

accept_encoding()

#### Returns

String: | The accepted encodings.

:api: private

accept_language()

#### Returns

String: | The accepted language.

:api: public

ajax?()

Alias for xml_http_request?

cache_control()

#### Returns

String: | HTTP cache control.

:api: public

connection()

#### Returns

String: | The HTTP connection.

:api: private

content_length()

#### Returns

Fixnum: | The request content length.

:api: public

content_type()

#### Returns

String: | The request content type.

:api: private

controller()

Returns the controller object for initialization and dispatching the request.

#### Returns

Class: | The controller class matching the routed request,

      e.g. Posts.

:api: private

domain(tld_length = 1)

#### Parameters

tld_length<Fixnum>: | Number of domains levels to inlclude in the top level domain. Defaults to 1.

#### Returns

String: | The full domain name without the port number.

:api: public

find_route!()

#### Notes

Find route using requested URI and merges route parameters (:action, :controller and named segments) into request params hash.

:api: private

full_uri()

#### Returns

String: | The full URI, including protocol and host

:api: public

gateway()

#### Returns

String: | The gateway.

:api: public

handle()

Handles request routing and action dispatch.

#### Returns

Merb::Controller: | the controller that handled the action dispatch.

:api: private

handled?()

If @route_params is an Array, then it will be the rack response. In this case, the request is considered handled.

#### Returns

Boolean: | true if @route_params is an Array, false otherwise.

:api: private

host()

#### Returns

String: | The full hostname including the port.

:api: public

if_modified_since()

#### Returns

Value of If-Modified-Since request header.

:api: private

if_none_match()

#### Returns

Value of If-None-Match request header.

:api: private

keep_alive()

#### Returns

String: | Value of HTTP_KEEP_ALIVE.

:api: public

matched!()

Sets the request as matched. This will abort evaluating any further deferred procs.

:api: private

matched?()

Checks whether or not the request has been matched to a route.

:api: private

message()

#### Returns

String: | Returns the redirect message Base64 unencoded.

:api: public

method()

#### Returns

Symbol: | The name of the request method, e.g. :get.

#### Notes

If the method is post, then the blocks specified in http_method_overrides will be checked for the masquerading method. The block will get the controller yielded to it. The first matching workaround wins. To disable this behavior, set http_method_overrides = []

:api: public

params()

#### Returns

Mash: | All request parameters.

#### Notes

The order of precedence for the params is XML, JSON, multipart, body and request string.

:api: public

path()

#### Returns

String: | The URI without the query string. Strips trailing "/" and reduces duplicate "/" to a single "/".

:api: public

path_info()

#### Returns

String: | The path info.

:api: public

port()

#### Returns

Fixnum: | The server port.

:api: public

protocol()

#### Returns

String: | The protocol, i.e. either "https" or "http" depending on the HTTPS header.

:api: public

query_string()

#### Returns

String: | The query string.

:api: private

rack_response()

#### Returns

(Array, Hash): | the route params for the matched route.

#### Notes

If the response is an Array then it is considered a direct Rack response to be sent back as a response. Otherwise, the route_params is a Hash with routing data (controller, action, et al).

:api: private

raw_post()

#### Returns

String: | The raw post.

:api: private

referer()

#### Returns

String: | The HTTP referer.

:api: public

remote_ip()

#### Returns

String: | The remote IP address.

:api: public

reset_params!()

#### Notes

Resets the params to a nil value.

:api: private

script_name()

#### Returns

String: | The script name.

:api: public

server_name()

#### Returns

String: | The server name.

:api: public

server_software()

#### Returns

String: | The server software.

:api: public

ssl?()

#### Returns

Boolean:: | True if the request is an SSL request.

:api: public

subdomains(tld_length = 1)

#### Parameters

tld_length<Fixnum>: | Number of domains levels to inlclude in the top level domain. Defaults to 1.

#### Returns

Array: | All the subdomain parts of the host.

:api: public

uri()

#### Returns

String: | The request URI.

:api: public

user_agent()

#### Returns

String: | The HTTP user agent.

:api: public

version()

#### Returns

String: | The HTTP version

:api: private

xhr?()

Alias for xml_http_request?

xml_http_request?()

#### Returns

Boolean: | If the request is an XML HTTP request.

:api: public

[Validate]