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



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

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