Class: Reigns::HttpRequest

Inherits:
Object
  • Object
show all
Includes:
Java::JavaxServletHttp::HttpServletRequest
Defined in:
lib/reigns/http_request.rb

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ HttpRequest

Returns a new instance of HttpRequest.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
# File 'lib/reigns/http_request.rb', line 10

def initialize
  @content = ""
  @delegate = MockHttpServletRequest.new
  yield self if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



16
17
18
# File 'lib/reigns/http_request.rb', line 16

def method_missing(method, *args, &block)
  @delegate.send(method, *args)
end

Instance Method Details

#contentObject



41
42
43
# File 'lib/reigns/http_request.rb', line 41

def content
  @content
end

#content=(content_string) ⇒ Object



36
37
38
39
# File 'lib/reigns/http_request.rb', line 36

def content=(content_string)
  @content = content_string
  @delegate.set_content(content_string.to_java_bytes)
end

#methodObject



24
25
26
# File 'lib/reigns/http_request.rb', line 24

def method
  @delegate.get_method
end

#method=(method_string) ⇒ Object



20
21
22
# File 'lib/reigns/http_request.rb', line 20

def method=(method_string)
  @delegate.set_method(method_string)
end

#uriObject



32
33
34
# File 'lib/reigns/http_request.rb', line 32

def uri
  @delegate.get_request_uri
end

#uri=(uri_string) ⇒ Object



28
29
30
# File 'lib/reigns/http_request.rb', line 28

def uri=(uri_string)
  @delegate.set_request_uri(uri_string)
end