Class: Arrow::FallbackHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/fallbackhandler.rb

Overview

The Arrow::FallbackHandler class, a request handler for Arrow that is used to handle misconfigured handler requests.

VCS Id

$Id$

Authors

Please see the file LICENSE in the top-level directory for licensing details.

Instance Method Summary collapse

Constructor Details

#initialize(key, instances) ⇒ FallbackHandler

Create a new instance for the given key and instances.



22
23
24
25
# File 'lib/arrow/fallbackhandler.rb', line 22

def initialize( key, instances )
	@key = key
	@instances = instances
end

Instance Method Details

#handler(req) ⇒ Object

Handle a request with output that explains what the problem is.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/arrow/fallbackhandler.rb', line 29

def handler( req )
	req.content_type = "text/plain"
	req.send_http_header
	req.print <<-EOF

Arrow Configuration Error

This URL is configured to be handled by the dispatcher keyed with '#{@key.inspect}',
but there was no dispatcher associated with that key. The instances I know about 
are:

#{@instances.collect {|k,d| "-- #{k.inspect} --\n\n#{d.inspect}"}.join("\n\n")}

	EOF

	return Apache::OK
end