[Seaside] Re: How to register a WADispatcher derivate?

David Carlos Manuelda stormbyte at gmail.com
Mon Mar 2 11:25:36 UTC 2015


Stephan Eggermont wrote:

> On 02/03/15 09:33, David Carlos Manuelda wrote:
>> I learnt how to register new application under default dispatcher or
>> unders specified one with WAAdmin>>register:at: and its derivated
>> functions.
>>
>> But now, I subclassed WADispatcher and I want to register it for later
>> using to add root components to it programatically.
>>
>> It can be done via web config so I guess it can also be done
>> programatically, but have no idea.
> 
> In QCMagritte, we do the following to make it easy to have
> production and development versions
> - production has no development tools
> - production sets itself as default application (assumes one
> application/image)
> - development sets the debugger error handler
> 
> QCApplication class>>registerForProductionAt: anApplicationName
> | application |
> application := self registerAt: anApplicationName.
> WAAdmin disableDevelopmentTools.
> WAAdmin defaultDispatcher defaultName: anApplicationName.
> ^application
> 
> QCApplication class>>registerForDevelopmentAt: anApplicationName
> | application |
> WAAdmin enableDevelopmentTools.
> application := self registerAt: anApplicationName.
> application filter configuration at: #exceptionHandler put:
> WADebugErrorHandler.
> (self overridesDefaults includes: WAAdmin defaultDispatcher defaultName)
> ifTrue: [ WAAdmin defaultDispatcher defaultName: anApplicationName ].
> ^application
> 
> QCApplication class>>registerAt: anApplicationName
> ^(WAAdmin register: self asApplicationAt: anApplicationName)
> preferenceAt: #sessionClass put: self sessionClass;
> addLibrary: JQDeploymentLibrary;
> addLibrary: JQUiDeploymentLibrary;
> yourself
> 
> With overridesDefault we determine which application gets to be
> default when loading multiple applications that all want to
> be default. There are several groups in the QCMagritte configuration,
> and when you load the tutorial, that should override the demo as
> default.
> 
> QCTutorialApplication>>overridesDefaults
> ^#( 'browse' 'welcome' 'QCMagritte Demo' )
> 
> QCApplication class>>overridesDefaults
> ^#( 'browse' 'welcome' )
> 
> You can find a QCMagritte image at
> https://ci.inria.fr/pharo-contribution/job/QCMagritte/
> 
> Stephan
Yes, I have something like this to handle development/deployment stuff.

>From your code it is not clear for me how is the dispatcher registered, I 
only see application registration/modification using the default dispatcher.

But what about adding my own dispatcher? Like you can do via config panel in 
localhost:8080/config -> add .-> type (Dispatcher)


I need dispatchers, for example, to have /something_here/ as a dispatcher 
(not an application) so I can handle it, have its subapplications, and so 
programatically.

So what I would need is something like register:at: but instead of 
applications, a dispatcher.

ATM, I only know how to create a dispatcher, and manage it, add/remove 
applications, debuggers and so, but nothing about telling seaside to 
actually use my dispatcher on a given entry point as string :(



More information about the seaside mailing list