Class: UWA::Handler

Inherits:
Mongrel::HttpHandler
  • Object
show all
Defined in:
lib/uwa/handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandler

Returns a new instance of Handler.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/uwa/handler.rb', line 7

def initialize
	super
	@author = 'No author'
	@description = 'No description'
	@title = 'Widget'
	@icon = 'http://www.netvibes.com/favicon.ico'
	@apiVersion = '1.0'
	@inline = true
	@debugMode = false
	@preferences = []
	@keywords = self.class.name.downcase
	@css = []
	@script = []
	@base = nil
	@cache = {:css => nil, :script => nil}
	@autoRefresh = nil

	@query = nil
	@out = nil
	@response = nil
	@request = nil
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



5
6
7
# File 'lib/uwa/handler.rb', line 5

def base
  @base
end

#css=(value) ⇒ Object

Sets the attribute css

Parameters:

  • value

    the value to set the attribute css to.



5
6
7
# File 'lib/uwa/handler.rb', line 5

def css=(value)
  @css = value
end

#script=(value) ⇒ Object

Sets the attribute script

Parameters:

  • value

    the value to set the attribute script to.



5
6
7
# File 'lib/uwa/handler.rb', line 5

def script=(value)
  @script = value
end

Instance Method Details

#process(req, res) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/uwa/handler.rb', line 30

def process(req,res)
	@request = req
	@response = res
	@tempfiles = []
	begin
		UWA::Server.log(@request.params['REQUEST_METHOD'], @request.params['REQUEST_URI'])
		method = @request.params['PATH_INFO'].split('/')[1]
		UWA::Server.log(:method, method.inspect)
		parse_query
		UWA::Server.log(:query, @query.inspect)
		if method.nil?
			index
		else
			ajax(method.to_sym)
		end
	ensure
		@tempfiles.each { |f| f.unlink }
	end
end