Re: Registering a WARequestHandler

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
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 <[email protected]> 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
>> [email protected]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
> 
> 
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.