| rendering |
| alwaysRedirect
|
^ self application preferenceAt: #alwaysRedirect
|
| processCallbacks: aCallbackStream
|
| lastPosition |
lastPosition _ nil.
[aCallbackStream position = lastPosition] whileFalse:
[lastPosition _ aCallbackStream position.
root decorationChainDo: [:ea | ea processCallbackStream: aCallbackStream]].
aCallbackStream atEnd
ifTrue: [WARenderNotification raiseSignal]
ifFalse: [self unprocessedCallbacks: aCallbackStream upToEnd].
|
| redirect
|
self alwaysRedirect ifTrue:
[self session respond:
[:url |
self updateUrl: url.
WAResponse redirectTo: url asString]]
|
| render
|
|request context document docRoot |
context _ WARenderingContext new request: self session currentRequest.
request _ self session respond:
[:url | |response|
self updateUrl: url.
docRoot _ WARenderedHtmlRoot context: context.
root visiblePresentersDo: [:ea | ea updateRoot: docRoot].
self session application updateRoot: docRoot.
response _ WAResponse new.
response headerAt: 'Cache-Control' put: 'No-cache'.
document _ WAHtmlStreamDocument root: docRoot.
document stream: response stream.
context actionUrl: url; document: document.
root decorationChainDo: [:ea | ea renderWithContext: context].
document close.
response].
self processCallbacks: (context callbackStreamForRequest: request)
|
| run
|
| notification |
[self withPageExpiredHandler:
[notification _ self withRenderNowHandler: [self render].
notification shouldRedirect ifTrue: [self redirect]]]
repeat
|
| unprocessedCallbacks: aCollection
|
| owners |
owners _ (aCollection collect: [:ea | ea owner]) asSet asArray.
self error: 'Components not found while processing callbacks: ', owners asString
|
| updateUrl: aUrl
|
root visiblePresentersDo: [:c | c updateUrl: aUrl]
|
| withPageExpiredHandler: aBlock
|
^ aBlock on: WAPageExpired do: [:n |]
|
| withRenderNowHandler: aBlock
|
^ aBlock on: WARenderNotification do: [:n | n]
|