Class: Wiris::HttpResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/src-generic/HttpResponse.rb

Instance Method Summary collapse

Constructor Details

#initialize(actionController) ⇒ HttpResponse

Returns a new instance of HttpResponse.



46
47
48
49
50
51
52
53
# File 'lib/src-generic/HttpResponse.rb', line 46

def initialize(actionController)
	@closed=false
	@actionController = actionController
	@writing=false
	@out = ""
	@res = actionController.response
	@headers = Hash.new()
end

Instance Method Details

#actionControllerObject



3
4
5
# File 'lib/src-generic/HttpResponse.rb', line 3

def actionController
	@actionController
end

#actionController=(actionController) ⇒ Object



7
8
9
# File 'lib/src-generic/HttpResponse.rb', line 7

def actionController=(actionController)
	@actionController=actionController
end

#closeObject



64
65
66
67
68
69
# File 'lib/src-generic/HttpResponse.rb', line 64

def close
	@res.close
	if @writing
		actionController.render :text => @out
	end
end

#getHeader(name) ⇒ Object



60
61
62
# File 'lib/src-generic/HttpResponse.rb', line 60

def getHeader(name)
	return @headers.get(name)
end

#headersObject



17
18
19
# File 'lib/src-generic/HttpResponse.rb', line 17

def headers
	@headers
end

#headers=(headers) ⇒ Object



13
14
15
# File 'lib/src-generic/HttpResponse.rb', line 13

def headers=(headers)
	@headers = headers
end

#outObject



25
26
27
# File 'lib/src-generic/HttpResponse.rb', line 25

def out
	@out
end

#out=(out) ⇒ Object



21
22
23
# File 'lib/src-generic/HttpResponse.rb', line 21

def out=(out)
	@out=out
end

#resObject



10
11
12
# File 'lib/src-generic/HttpResponse.rb', line 10

def res
	@res
end

#setHeader(name, value) ⇒ Object



55
56
57
58
# File 'lib/src-generic/HttpResponse.rb', line 55

def setHeader(name, value)
	@headers.set(name, value)
	@res.headers[name] = value
end

#writeBinary(data) ⇒ Object



42
43
44
# File 'lib/src-generic/HttpResponse.rb', line 42

def writeBinary(data)
	writeString(data.toString())
end

#writeString(s) ⇒ Object



37
38
39
40
# File 'lib/src-generic/HttpResponse.rb', line 37

def writeString(s)
	@writing = true
	@out = @out + s
end

#writingObject



29
30
31
# File 'lib/src-generic/HttpResponse.rb', line 29

def writing
	@writing
end

#writing=(writing) ⇒ Object



33
34
35
# File 'lib/src-generic/HttpResponse.rb', line 33

def writing=(writing)
	@writing=writing
end