WADispatcher


Seaside-RequestHandler

Comment:



Hierarchy:

ProtoObject
Object
WARequestHandler
WAEntryPoint
WADispatcher

Summary:

instance variables:

entryPoints

class instance variables:

default

methods:

instance class
private public as yet unclassified

Detail:

instance variables:

entryPoints
InitialValue:
a Dictionary()
inferredType:
Dictionary

class instance variables:

default
InitialValue:
a WADispatcher(/seaside)
inferredType:
WADispatcher

instance methods:

private
handlerForRequest: aRequest

	| path name |
	path _ aRequest url.
	(path beginsWith: basePath)
		ifTrue: [name _ ((path allButFirst: basePath size) findTokens: '/') at: 1 ifAbsent: [].
				entryPoints at: name ifPresent: [:n | ^ n]].
	^ WANotFoundHandler new
initialize

	entryPoints _ Dictionary new

public
basePath: newPath

	| base |
	basePath _ newPath.
	base _ (newPath isEmpty or: [newPath last ~= $/])
				ifTrue: [newPath, '/']
				ifFalse: [newPath].
	entryPoints keysAndValuesDo: [:key :component | component basePath: base, key]
configurationComponent

	^ WADispatcherEditor new dispatcher: self
entryPoints

	^ entryPoints
handleRequest: aRequest

	^ (self handlerForRequest: aRequest) handleRequest: aRequest
registerEntryPoint: entryPoint at: aString

	| path |
	entryPoints at: aString put: entryPoint.
	path _ basePath last = $/
		ifTrue: [basePath, aString]
		ifFalse: [basePath, '/', aString].
	entryPoint basePath: path
removeEntryPoint: anObject

	entryPoints removeKey: (entryPoints keyAtValue: anObject)

class methods:

as yet unclassified
default

	default ifNil: [default _ self new].
	default basePath ifNil: [default basePath: '/seaside'].
	
	^ default
description

	^ 'Subdirectory'
new

	^ super new initialize

^top


- made by Dandelion -