You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nille hammer <ta...@winfonet.eu> on 2009/06/04 23:53:08 UTC
[T5.1] How to break the chain in MasterDispatcher
Hi List,
I have implemented a LoginDispatcher like explained in the wiki (http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher). Then I contributed it to the MasterDispatcher's configuration with the following code:
configuration.add("LoginDispatcher", loginDispatcher, "before:PageRender");
So far so good. Everything works up to this point. If I got it right I would end up with a chain of Dispatchers in the following order: "RootPath", "Asset", "ComponentEvent", "LoginDispatcher", "PageRender". Although "LoginDispatcher" is put after "Asset" I still see requests for Assets (i.e. /assets/xxx ) in my LoginDispatcher. I thought, this could not be the case as these requests should have been handeled by AssetDispatcher. What did I get/do wrong?
Thanks in advance, nillehammer
==
http://www.winfonet.eu
Re: [T5.1] How to break the chain in MasterDispatcher
Posted by Christian Senk <se...@googlemail.com>.
Hi nille,
i got the same problem. This part isn't good documented, look at this
snippet from the TapestryModule:
/**
* The MasterDispatcher is a chain-of-command of individual Dispatchers, each handling (like a servlet) a particular
* kind of incoming request. <dl> <dt>RootPath</dt> <dd>Renders the start page for the "/" request</dd>
* <dt>Asset</dt> <dd>Provides access to classpath assets</dd> <dt>VirtualAsset</dt> <dd>Provides access to combined
* scripts</dd> <dt>PageRender</dt> <dd>Identifies the {@link org.apache.tapestry5.services.PageRenderRequestParameters}
* and forwards onto {@link PageRenderRequestHandler}</dd> <dt>ComponentEvent</dt> <dd>Identifies the {@link
* ComponentEventRequestParameters} and forwards onto the {@link ComponentEventRequestHandler}</dd> </dl>
*/
public static void contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration)
{
// Looks for the root path and renders the start page. This is maintained for compatibility
// with earlier versions of Tapestry 5, it is recommended that an Index page be used instead.
configuration.addInstance("RootPath", RootPathDispatcher.class, "before:Asset");
// This goes first because an asset to be streamed may have an file extension, such as
// ".html", that will confuse the later dispatchers.
configuration.addInstance("Asset", AssetDispatcher.class, "before:ComponentEvent");
configuration.addInstance("VirtualAsset", VirtualAssetDispatcher.class, "before:Asset");
configuration.addInstance("ComponentEvent", ComponentEventDispatcher.class, "before:PageRender");
configuration.addInstance("PageRender", PageRenderDispatcher.class);
}
I think you have to specify one more constraint to insert your
Dispatcher between the ComponentEvent and PageRender dispatcher.
configuration.add("LoginDispatcher", loginDispatcher, "before:PageRender", "after:ComponentEvent");
Worked for me :)
nille hammer schrieb:
> Hi List,
>
> I have implemented a LoginDispatcher like explained in the wiki (http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher). Then I contributed it to the MasterDispatcher's configuration with the following code:
> configuration.add("LoginDispatcher", loginDispatcher, "before:PageRender");
>
> So far so good. Everything works up to this point. If I got it right I would end up with a chain of Dispatchers in the following order: "RootPath", "Asset", "ComponentEvent", "LoginDispatcher", "PageRender". Although "LoginDispatcher" is put after "Asset" I still see requests for Assets (i.e. /assets/xxx ) in my LoginDispatcher. I thought, this could not be the case as these requests should have been handeled by AssetDispatcher. What did I get/do wrong?
>
> Thanks in advance, nillehammer
>
> ==
> http://www.winfonet.eu
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org