Class: Bijou::WEBrick::Request

Inherits:
HttpRequest show all
Defined in:
lib/bijou/webrick/request.rb

Instance Attribute Summary collapse

Attributes inherited from HttpRequest

#cookies, #form, #http_method, #params, #query_string, #server_variables

Instance Method Summary collapse

Methods inherited from HttpRequest

#get, #physical_path, #post, #referer, #referrer, #request_method, #user_agent

Constructor Details

#initialize(req) ⇒ Request

Accepts a WEBrick::HTTPRequest object and adapts it to the HttpRequest object expected by the Bijou component.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bijou/webrick/request.rb', line 12

def initialize(req)
  super()

  @req = req

  if @req.query_string
    query_string = ::CGI::parse(@req.query_string) || {}
    @query_string = Bijou::MiniCGI.singularize(query_string)
  else
    @query_string = {}
  end

  @form = @query_string.clone
  @params = @query_string.clone

  #cookies = ::CGI::Cookie::parse(@req.cookies)
  @cookies = @req.cookies

  @http_method = @req.request_method
end

Instance Attribute Details

#reqObject (readonly)

Returns the value of attribute req.



33
34
35
# File 'lib/bijou/webrick/request.rb', line 33

def req
  @req
end

Instance Method Details

#virtual_pathObject

– TODO: Standardize accessor name. ++



38
39
40
41
42
# File 'lib/bijou/webrick/request.rb', line 38

def virtual_path
  # @server_variables['REQUEST_URI']
  # @server_variables['PATH_INFO']
  @req.request_uri
end