Sha256: c4a6c835a7b3c24ddbb32894a5d5061dd10ff7f2f8f67c22d6692b40dd8d4b5f

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

module Iowa
	class Dispatcher

		class CantHandleRequest < Exception; end

		def initialize(*args)
		end

		# Returns true if the dispatcher is willing to handle this request.
	
		def handleRequest?(path)
			true
		end
		
		# Dispatches the request.
		 
		def dispatch(session,context,dispatch_destination = nil)
			if handleRequest?(context.request.uri)
				dispatch_destination = Iowa::DispatchDestination.new(CMain) unless context.requestID || dispatch_destination
			else
				raise CantHandleRequest, "This dispatcher doesn't know how to handle the request for #{context.request.uri}."
			end
			session.handleRequest(context,dispatch_destination)
		end

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
IOWA-1.0.3 src/iowa/Dispatcher.rb
IOWA-1.0.2 src/iowa/Dispatcher.rb
IOWA-1.0.0 src/iowa/Dispatcher.rb