[aida] Custom request handling howto?

Janko Mivšek janko.mivsek at eranova.si
Tue Nov 20 22:57:47 CET 2007


Hi Michael,

Michael Rueger wrote:

> I came up with a simple double dispatch, that allows objects to 
> intercept answering the request, see attachment.
> You still need to register the resource or other object with the 
> URLResolver, but I see that as a good thing performance-wise anyways.


Let me try to understand you proposal by thinking about it a bit. Here 
is a proposed additional method on Object, which is then overriden if 
necessary in any other class:

Object answerTo: aRequest on: aSession for: site
	site answer: self to: aRequest on: aSession

and AIDASite then serve above call as it does now already:

AIDASite answerTo: aRequest
    | session object errorResponse |
   "["self log: self cr , (self logStringFor: aRequest) , self cr , ' s'.
	self shouldRedirect ifTrue:
		[^self redirectToOtherHost: aRequest].
	session := self sessionManager findOrMakeSessionFor: aRequest.
   ...


So, question is, who is calling first method? Where the caller finds 
session and site?

This seems also a generalization of current Object>>printWebPageFor: 
method, which looks a good approach.

Can you provide a simple example of your double dispatch use?

Best regards
Janko



-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si


More information about the Aida mailing list