### Home Classes Methods

### In Files

- lib/merb-core/dispatch/dispatcher.rb
- lib/merb-core/dispatch/request.rb

### Parent

Object

### Methods

- ::new
- ::new
- #_process_block_return
- #accept
- #accept_charset
- #accept_encoding
- #accept_language
- #ajax?
- #cache_control
- #connection
- #content_length
- #content_type
- #controller
- #domain
- #exceptions
- #find_route!
- #full_uri
- #gateway
- #handle
- #handled?
- #host
- #if_modified_since
- #if_none_match
- #keep_alive
- #matched!
- #matched?
- #message
- #method
- #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

### Files

- CHANGELOG
- LICENSE
- README
- TODO

### Class/Module Index

Quicksearch

- Merb
- Merb::AbstractController
- Merb::AcceptType
- Merb::AuthenticationMixin
- Merb::AuthenticationMixin::BasicAuthentication
- Merb::BootLoader
- Merb::BootLoader::AfterAppLoads
- Merb::BootLoader::BackgroundServices
- Merb::BootLoader::BeforeAppLoads
- Merb::BootLoader::BuildFramework
- Merb::BootLoader::ChooseAdapter
- Merb::BootLoader::Cookies
- Merb::BootLoader::Defaults
- Merb::BootLoader::Dependencies
- Merb::BootLoader::DropPidFile
- Merb::BootLoader::LoadClasses
- Merb::BootLoader::Logger
- Merb::BootLoader::MimeTypes
- Merb::BootLoader::MixinSession
- Merb::BootLoader::RackUpApplication
- Merb::BootLoader::ReloadClasses
- Merb::BootLoader::ReloadClasses::TimedExecutor
- Merb::BootLoader::Router
- Merb::BootLoader::SetupSession
- Merb::BootLoader::SetupStubClasses
- Merb::BootLoader::Templates
- Merb::ConditionalGetMixin
- Merb::Config
- Merb::Config::ConfigBlock
- Merb::Const
- Merb::Controller
- Merb::ControllerExceptions
- Merb::ControllerExceptions::Accepted
- Merb::ControllerExceptions::ActionNotFound
- Merb::ControllerExceptions::BadGateway
- Merb::ControllerExceptions::BadRequest
- Merb::ControllerExceptions::Base
- Merb::ControllerExceptions::ClientError
- Merb::ControllerExceptions::Conflict
- Merb::ControllerExceptions::Continue
- Merb::ControllerExceptions::Created
- Merb::ControllerExceptions::ExpectationFailed
- Merb::ControllerExceptions::Forbidden
- Merb::ControllerExceptions::GatewayTimeout
- Merb::ControllerExceptions::Gone
- Merb::ControllerExceptions::HTTPVersionNotSupported
- Merb::ControllerExceptions::Informational
- Merb::ControllerExceptions::InternalServerError
- Merb::ControllerExceptions::LayoutNotFound
- Merb::ControllerExceptions::LengthRequired
- Merb::ControllerExceptions::MethodNotAllowed
- Merb::ControllerExceptions::MovedPermanently
- Merb::ControllerExceptions::MovedTemporarily
- Merb::ControllerExceptions::MultiPartParseError
- Merb::ControllerExceptions::MultipleChoices
- Merb::ControllerExceptions::NoContent
- Merb::ControllerExceptions::NonAuthoritativeInformation
- Merb::ControllerExceptions::NotAcceptable
- Merb::ControllerExceptions::NotFound
- Merb::ControllerExceptions::NotImplemented
- Merb::ControllerExceptions::NotModified
- Merb::ControllerExceptions::OK
- Merb::ControllerExceptions::PartialContent
- Merb::ControllerExceptions::PaymentRequired
- Merb::ControllerExceptions::PreconditionFailed
- Merb::ControllerExceptions::ProxyAuthenticationRequired
- Merb::ControllerExceptions::Redirection
- Merb::ControllerExceptions::RequestEntityTooLarge
- Merb::ControllerExceptions::RequestRangeNotSatisfiable
- Merb::ControllerExceptions::RequestTimeout
- Merb::ControllerExceptions::RequestURITooLarge
- Merb::ControllerExceptions::ResetContent
- Merb::ControllerExceptions::SeeOther
- Merb::ControllerExceptions::ServerError
- Merb::ControllerExceptions::ServiceUnavailable
- Merb::ControllerExceptions::Successful
- Merb::ControllerExceptions::SwitchingProtocols
- Merb::ControllerExceptions::TemplateNotFound
- Merb::ControllerExceptions::TemporaryRedirect
- Merb::ControllerExceptions::Unauthorized
- Merb::ControllerExceptions::UnsupportedMediaType
- Merb::ControllerExceptions::UseProxy
- Merb::ControllerMixin
- Merb::CookieSession
- Merb::CookieSession::CookieOverflow
- Merb::CookieSession::TamperedWithCookie
- Merb::Cookies
- Merb::CookiesMixin
- Merb::CookiesMixin::RequestMixin
- Merb::Counter
- Merb::Dispatcher
- Merb::Dispatcher::DefaultException
- Merb::Dispatcher::DefaultExceptionHelper
- Merb::GlobalHelpers
- Merb::InlineTemplates
- Merb::Logger
- Merb::MemcacheSession
- Merb::MemcacheStore
- Merb::MemorySession
- Merb::MemorySessionStore
- Merb::Parse
- Merb::Plugins
- Merb::Rack
- Merb::Rack::AbstractAdapter
- Merb::Rack::Adapter
- Merb::Rack::Application
- Merb::Rack::ConditionalGet
- Merb::Rack::Console
- Merb::Rack::ContentLength
- Merb::Rack::DeferrableMiddleware
- Merb::Rack::Ebb
- Merb::Rack::EventedMongrel
- Merb::Rack::FastCGI
- Merb::Rack::Handler
- Merb::Rack::Handler::Mongrel
- Merb::Rack::Head
- Merb::Rack::Helpers
- Merb::Rack::Irb
- Merb::Rack::Middleware
- Merb::Rack::Mongrel
- Merb::Rack::PathPrefix
- Merb::Rack::Profiler
- Merb::Rack::Runner
- Merb::Rack::Static
- Merb::Rack::StreamWrapper
- Merb::Rack::SwiftipliedMongrel
- Merb::Rack::Thin
- Merb::Rack::ThinTurbo
- Merb::Rack::Tracer
- Merb::Rack::WEBrick
- Merb::RenderMixin
- Merb::RenderMixin::ClassMethods
- Merb::Request
- Merb::ReservedError
- Merb::Responder
- Merb::ResponderMixin
- Merb::ResponderMixin::ClassMethods
- Merb::ResponderMixin::ContentTypeAlreadySet
- Merb::Router
- Merb::Router::Behavior
- Merb::Router::Behavior::Error
- Merb::Router::Behavior::Proxy
- Merb::Router::CachedProc
- Merb::Router::GenerationError
- Merb::Router::NotCompiledError
- Merb::Router::Resources
- Merb::Router::RouteNotFound
- Merb::Server
- Merb::Session
- Merb::SessionContainer
- Merb::SessionMixin
- Merb::SessionMixin::NoSessionContainer
- Merb::SessionMixin::RequestMixin
- Merb::SessionMixin::RequestMixin::ClassMethods
- Merb::SessionMixin::SessionOverflow
- Merb::SessionStoreContainer
- Merb::System
- Merb::System::PortablePoller
- Merb::Template
- Merb::Template::Erubis
- Merb::Template::Erubis::Mixin
- Merb::Test
- Merb::Test::ControllerHelper
- Merb::Test::Cookie
- Merb::Test::CookieJar
- Merb::Test::ExampleGroup
- Merb::Test::Helpers
- Merb::Test::MakeRequest
- Merb::Test::Matchers
- Merb::Test::MultipartRequestHelper
- Merb::Test::MultipartRequestHelper::FileParam
- Merb::Test::MultipartRequestHelper::Param
- Merb::Test::MultipartRequestHelper::Post
- Merb::Test::RequestHelper
- Merb::Test::RequestHelper::CookieJar
- Merb::Test::RequestHelper::FakeRequest
- Merb::Test::RouteHelper
- Merb::Test::Rspec
- Merb::Test::Rspec::ControllerMatchers
- Merb::Test::Rspec::ControllerMatchers::BeError
- Merb::Test::Rspec::ControllerMatchers::BeRedirect
- Merb::Test::Rspec::ControllerMatchers::Provide
- Merb::Test::Rspec::RouteMatchers
- Merb::Test::Rspec::RouteMatchers::ParameterMatcher
- Merb::Test::Rspec::RouteMatchers::RouteToMatcher
- Merb::Test::ViewHelper
- Merb::Test::WebratHelper
- Merb::Worker
- Erubis
- Erubis::Basic
- Erubis::Basic::Converter
- Erubis::BlockAwareEnhancer
- Erubis::BlockAwareEruby
- Erubis::MEruby
- Spec
- Spec::Matchers
- Spec::Matchers::MatcherDSL
- Spec::Runner
- Spec::Runner::Formatter
- Spec::Runner::Formatter::BaseTextFormatter
- Gem
- Gem::Dependency
- Hpricot
- Hpricot::Elem
- Mongrel
- Mongrel::HttpResponse
- Class
- Exception
- Hash
- Kernel
- MemCache
- Memcached
- Object
- String
- Time

No matching classes.

# Merb::Request

### Constants

METHODS

### Attributes

env[RW]

:api: private

route[RW]

:api: private

route_params[R]

:api: private

start[R]

### Public Class Methods

new(env, *args) click to toggle source

Memoizes the new request object into env so we can memoize things into ivars in the request

#### Parameters

env<Hash> | A rack environment
*args<Array> | Other arguments passed to the superclass

#### Returns

Merb::Request | The new Merb::Request

:api: public

    # File lib/merb-core/dispatch/request.rb, line 53
    def self.new(env, *args)
      if self == Merb::Request
        env["merb.request"] ||= super
      else
        super
      end
    end

new(rack_env) click to toggle source

Initialize the request object.

#### Parameters

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 36
    def initialize(rack_env)
      @env  = rack_env
      @body = rack_env[Merb::Const::RACK_INPUT]
      @route_params = {}
    end

### Public Instance Methods

_process_block_return(retval) click to toggle source

#### Notes

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 147
    def _process_block_return(retval)
      # If the return value is an array, then it is a redirect
      # so we must set the request as a redirect and extract
      # the redirect params and return it as a hash so that the
      # dispatcher can handle it
      matched! if retval.is_a?(Array)
      retval
    end

accept() click to toggle source

#### Returns

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 512
    def accept
      @env[Merb::Const::HTTP_ACCEPT].blank? ? "*/*" : @env[Merb::Const::HTTP_ACCEPT]
    end

accept_charset() click to toggle source

#### Returns

String | The accepted character sets.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 488
    def accept_charset
      @env[Merb::Const::HTTP_ACCEPT_CHARSET]
    end

accept_encoding() click to toggle source

#### Returns

String | The accepted encodings.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 440
    def accept_encoding
      @env[Merb::Const::HTTP_ACCEPT_ENCODING]
    end

accept_language() click to toggle source

#### Returns

String | The accepted language.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 464
    def accept_language
      @env[Merb::Const::HTTP_ACCEPT_LANGUAGE]
    end

ajax?() click to toggle source
Alias for: xml_http_request?
cache_control() click to toggle source

#### Returns

String | HTTP cache control.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 456
    def cache_control
      @env[Merb::Const::HTTP_CACHE_CONTROL]
    end

connection() click to toggle source

#### Returns

String | The HTTP connection.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 520
    def connection
      @env[Merb::Const::HTTP_CONNECTION]
    end

content_length() click to toggle source

#### Returns

Fixnum | The request content length.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 544
    def content_length
      @content_length ||= @env[Merb::Const::CONTENT_LENGTH].to_i
    end

content_type() click to toggle source

#### Returns

String | The request content type.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 536
    def content_type
      @env[Merb::Const::UPCASE_CONTENT_TYPE]
    end

controller() click to toggle source

Returns the controller object for initialization and dispatching the request.

#### Returns

Class | The controller class matching the routed request,

    e.g. Posts.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 69
    def controller
      unless params[:controller]
        raise ControllerExceptions::NotFound,
          "Route matched, but route did not specify a controller.\n" +
          "Did you forgot to add :controller => \"people\" or :controller " +
          "segment to route definition?\nHere is what's specified:\n" +
          route.inspect
      end
      path = [params[:namespace], params[:controller]].compact.join(Merb::Const::SLASH)
      controller = path.snake_case.to_const_string

      begin
        Object.full_const_get(controller)
      rescue NameError => e
        msg = "Controller class not found for controller `#{path}'"
        Merb.logger.warn!(msg)
        raise ControllerExceptions::NotFound, msg
      end
    end

domain(tld_length = 1) click to toggle source

#### 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

    # File lib/merb-core/dispatch/request.rb, line 610
    def domain(tld_length = 1)
      host.split(Merb::Const::DOT).last(1 + tld_length).join(Merb::Const::DOT).sub(/:\d+$/,'')
    end

exceptions() click to toggle source

    # File lib/merb-core/dispatch/request.rb, line 89
    def exceptions
      env["merb.exceptions"]
    end

find_route!() click to toggle source

#### Notes

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 136
    def find_route!
      @route, @route_params = Merb::Router.route_for(self)
      params.merge! @route_params if @route_params.is_a?(Hash)
    end

full_uri() click to toggle source

#### Returns

String | The full URI, including protocol and host

:api: public

    # File lib/merb-core/dispatch/request.rb, line 408
    def full_uri
      protocol + "://" + host + uri
    end

gateway() click to toggle source

#### Returns

String | The gateway.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 504
    def gateway
      @env[Merb::Const::GATEWAY_INTERFACE]
    end

handle() click to toggle source

Handles request routing and action dispatch

@return [Array[Integer, Hash, each]] A Rack response

@api private

    # File lib/merb-core/dispatch/dispatcher.rb, line 46
    def handle
      @start = env["merb.request_start"] = Time.now
      Merb.logger.info { "Started request handling: #{start.to_s}" }

      find_route!
      return rack_response if handled?

      klass = controller

      unless klass < Controller
        raise NotFound,
          "Controller '#{klass}' not found.\n"            "If Merb tries to find a controller for static files, "            "you may need to check your Rackup file, see the Problems "            "section at: http://wiki.merbivore.com/pages/rack-middleware"
      end

      Merb.logger.debug { "Routed to: #{klass::_filter_params(params).inspect}" }

      if klass.abstract?
        raise NotFound, "The '#{klass}' controller has no public actions"
      end

      dispatch_action(klass, params[:action])
    rescue Object => exception
      dispatch_exception(exception)
    end

handled?() click to toggle source

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

    # File lib/merb-core/dispatch/request.rb, line 191
    def handled?
      @route_params.is_a?(Array)
    end

host() click to toggle source

#### Returns

String | The full hostname including the port.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 582
    def host
      @env[Merb::Const::HTTP_X_FORWARDED_HOST] || @env[Merb::Const::HTTP_HOST] ||
        @env[Merb::Const::SERVER_NAME]
    end

if_modified_since() click to toggle source

#### Returns

Value of If-Modified-Since request header.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 626
    def if_modified_since
      if time = @env[Merb::Const::HTTP_IF_MODIFIED_SINCE]
        Time.rfc2822(time)
      end
    end

if_none_match() click to toggle source

#### Returns

Value of If-None-Match request header.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 618
    def if_none_match
      @env[Merb::Const::HTTP_IF_NONE_MATCH]
    end

keep_alive() click to toggle source

#### Returns

String | Value of HTTP_KEEP_ALIVE.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 480
    def keep_alive
      @env[Merb::Const::HTTP_KEEP_ALIVE]
    end

matched!() click to toggle source

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 160
    def matched!
      @matched = true
    end

matched?() click to toggle source

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

:api: private

    # File lib/merb-core/dispatch/request.rb, line 167
    def matched?
      @matched
    end

message() click to toggle source

#### Returns

String | Returns the redirect message Base64 unencoded.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 324
    def message
      return {} unless params[:_message]
      begin
        Marshal.load(params[:_message].unpack("m").first)
      rescue ArgumentError, TypeError
        {}
      end
    end

method() click to toggle source

#### 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

    # File lib/merb-core/dispatch/request.rb, line 105
    def method
      @method ||= begin
        request_method = @env[Merb::Const::REQUEST_METHOD].downcase.to_sym
        case request_method
        when :get, :head, :put, :delete, :options
          request_method
        when :post
          m = nil
          self.class.http_method_overrides.each do |o|
            m ||= o.call(self); break if m
          end
          m.downcase! if m
          METHODS.include?(m) ? m.to_sym : :post
        else
          raise "Unknown REQUEST_METHOD: #{@env[Merb::Const::REQUEST_METHOD]}"
        end
      end
    end

params() click to toggle source

#### Returns

Mash | All request parameters.

#### Notes

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

:api: public

    # File lib/merb-core/dispatch/request.rb, line 310
    def params
      @params ||= begin
        h = body_and_query_params.merge(route_params)
        h.merge!(multipart_params) if self.class.parse_multipart_params && multipart_params
        h.merge!(json_params) if self.class.parse_json_params && json_params
        h.merge!(xml_params) if self.class.parse_xml_params && xml_params
        h
      end
    end

path() click to toggle source

#### Returns

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

:api: public

    # File lib/merb-core/dispatch/request.rb, line 554
    def path
      # Merb::Const::SLASH is /
      # Merb::Const::QUESTION_MARK is ?
      path = (uri.empty? ? Merb::Const::SLASH : uri.split(Merb::Const::QUESTION_MARK).first).squeeze(Merb::Const::SLASH)
      path = path[0..-2] if (path[-1] == //) && path.size > 1
      path
    end

path_info() click to toggle source

#### Returns

String | The path info.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 566
    def path_info
      @path_info ||= Merb::Parse.unescape(@env[Merb::Const::PATH_INFO])
    end

port() click to toggle source

#### Returns

Fixnum | The server port.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 574
    def port
      @env[Merb::Const::SERVER_PORT].to_i
    end

protocol() click to toggle source

#### Returns

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

:api: public

    # File lib/merb-core/dispatch/request.rb, line 384
    def protocol
      ssl? ? Merb::Const::HTTPS : Merb::Const::HTTP
    end

query_string() click to toggle source

#### Returns

String | The query string.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 528
    def query_string
      @env[Merb::Const::QUERY_STRING]
    end

rack_response() click to toggle source

#### 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

    # File lib/merb-core/dispatch/request.rb, line 180
    def rack_response
      @route_params
    end

raw_post() click to toggle source

#### Returns

String | The raw post.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 345
    def raw_post
      @body.rewind if @body.respond_to?(:rewind)
      @raw_post ||= @body.read
    end

referer() click to toggle source

#### Returns

String | The HTTP referer.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 400
    def referer
      @env[Merb::Const::HTTP_REFERER]
    end

remote_ip() click to toggle source

#### Returns

String | The remote IP address.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 364
    def remote_ip
      return @env[Merb::Const::HTTP_CLIENT_IP] if @env.include?(Merb::Const::HTTP_CLIENT_IP)

      if @env.include?(Merb::Const::HTTP_X_FORWARDED_FOR) then
        remote_ips = @env[Merb::Const::HTTP_X_FORWARDED_FOR].split(',').reject do |ip|
          ip =~ Merb::Const::LOCAL_IP_REGEXP
        end

        return remote_ips.first.strip unless remote_ips.empty?
      end

      return @env[Merb::Const::REMOTE_ADDR]
    end

reset_params!() click to toggle source

#### Notes

Resets the params to a nil value.

:api: private

    # File lib/merb-core/dispatch/request.rb, line 337
    def reset_params!
      @params = nil
    end

script_name() click to toggle source

#### Returns

String | The script name.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 448
    def script_name
      @env[Merb::Const::SCRIPT_NAME]
    end

server_name() click to toggle source

#### Returns

String | The server name.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 432
    def server_name
      @env[Merb::Const::SERVER_NAME]
    end

server_software() click to toggle source

#### Returns

String | The server software.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 472
    def server_software
      @env[Merb::Const::SERVER_SOFTWARE]
    end

ssl?() click to toggle source

#### Returns

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

:api: public

    # File lib/merb-core/dispatch/request.rb, line 392
    def ssl?
      @env[Merb::Const::UPCASE_HTTPS] == 'on' || @env[Merb::Const::HTTP_X_FORWARDED_PROTO] == Merb::Const::HTTPS
    end

subdomains(tld_length = 1) click to toggle source

#### 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

    # File lib/merb-core/dispatch/request.rb, line 596
    def subdomains(tld_length = 1)
      parts = host.split(Merb::Const::DOT)
      parts[0..-(tld_length+2)]
    end

uri() click to toggle source

#### Returns

String | The request URI.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 416
    def uri
      @env[Merb::Const::REQUEST_PATH] || @env[Merb::Const::REQUEST_URI] || path_info
    end

user_agent() click to toggle source

#### Returns

String | The HTTP user agent.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 424
    def user_agent
      @env[Merb::Const::HTTP_USER_AGENT]
    end

version() click to toggle source

#### Returns

String | The HTTP version

:api: private

    # File lib/merb-core/dispatch/request.rb, line 496
    def version
      @env[Merb::Const::HTTP_VERSION]
    end

xhr?() click to toggle source
Alias for: xml_http_request?
xml_http_request?() click to toggle source

#### Returns

Boolean | If the request is an XML HTTP request.

:api: public

    # File lib/merb-core/dispatch/request.rb, line 354
    def xml_http_request?
      not Merb::Const::XML_HTTP_REQUEST_REGEXP.match(@env[Merb::Const::HTTP_X_REQUESTED_WITH]).nil?
    end

Also aliased as: xhr?, ajax?

[Validate]

Generated with the Darkfish Rdoc Generator 2.