[Seaside] Registering a WARequestHandler

Johan Brichau johan at inceptive.be
Wed Feb 1 08:09:13 UTC 2017


If you need to ‘mess’ with this part of the code to achieve a simple registration of handlers, I think there is something wrong :)

Before taking a look, I want to understand what is going wrong and why you are doing this.
Why are you registering a handler in the updateRoot: method?

Johan

> On 31 Jan 2017, at 22:37, Udo Schneider <udo.schneider at homeaddress.de> wrote:
> 
> I hit a similar problem when dealing with Files in Magritte/Seaside. I kind of (re-)implemented WAApplication>>#urlFor: in my own component based on WARegistry>>#urlFor: . Not quite sure if the code is "legal" - but it works:
> 
> My code in your example might look like this (not tested):
> 
> updateRoot: anHtmlRoot
> 	| handler |
> 	super updateRoot: anHtmlRoot.
> 	handler := MySubclassOfWARequestHandler on: self.
>        registry := self requestContext registry.
>        url := registry url.
>        key := registry register: handler.
> 	registry trackingStrategy addKey: key toUrl: url.
> 	
> 
> Hope this helps.
> 
> CU,
> 
> Udo
> 
> 
> On 31/01/17 21:47, Jupiter Jones wrote:
>> I’m having an issue registering a handler in Seaside 3.2 that I’m hoping someone will recognise.
>> 
>> In the test "WARegistryTest>>testUrlFor” a handler is registered with an instance of WARegistry by simply creating a WARegistry with "WARegistry new".
>> 
>> In my app I’m doing something like this:
>> 
>> updateRoot: anHtmlRoot
>> 	| handler |
>> 	super updateRoot: anHtmlRoot.
>> 	handler := MySubclassOfWARequestHandler on: self.
>> 	url := WACurrentRequestContext value registry
>> 		register: handler;
>> 		urlFor: handler.
>> 
>> …however "WACurrentRequestContext value registry” answers my WAApplication instance, which overrides  #register: from WARegistry for registering sessions - not handlers.
>> 
>> So…
>> 
>> I tried copying the way WARegistry>>register: does the registration into my method:
>> 
>> updateRoot: anHtmlRoot
>> 	| handler |
>> 	super updateRoot: anHtmlRoot.
>> 	handler := MySubclassOfWARequestHandler on: self.
>> 	anHtmlRoot application cache
>> 	    store:
>> 	      (handler
>> 	        setParent: anHtmlRoot application;
>> 	        yourself).
>> 	url := WACurrentRequestContext value registry urlFor: handler.
>> 
>> Which appears to store the handler in the application cache (instance of WABulkReapingCache).
>> 
>> However, when I call "WACurrentRequestContext value registry urlFor: handler” it ends up calling “WABulkReapingCache(WAExpiringCache)>>keyAtValue:ifAbsent:” method which calls #shouldNotImplement
>> 
>> Can anyone see what I’ve done wrong, or know how to register an application handler?
>> 
>> Thanks in advance :)
>> 
>> Cheers,
>> 
>> J
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list