Well, I've figured out half of this, but it's not exactly pretty...

Note, I'm using Tapestry 5.1.0.0.

The below didn't work because the default PageRenderDispatcher was still in
place.  If I override it, like this in my Module class:

        public void contributeMasterDispatcher(
                        OrderedConfiguration<Dispatcher> configuration)
        {
                configuration.overrideInstance("PageRender", 
SiteDispatcher.class);
        }

Where SiteDispatcher contains exactly the same code as
org.apache.tapestry5.internal.services.PageRenderDispatcher then I get the
exact same behavior (as a baseline).  Leaving me to modify the contents of
my SiteDispatcher class (i.e. modify the behavior of the
PageRenderDispatcher) to do what I want (look for a "site" parameter as the
first element in the request.path, and redirect to a default if none is
found/recognized).

This works.  It's ugly, because I have to copy all the functionality of the
PageRenderDispatcher in order to do it, but at this point I'm just glad to
have it working.

So, I have a solution for reading/manipulating the incoming URL, but still
need one for manipulating the generated links.

Levi


xfile80303 wrote:
> 
> 
> Howard Lewis Ship wrote:
>> 
>> I've been doing some cleanup of some internal APIs lately with the
>> goal to centralizing Tapestry's logic for generating and parsing
>> component event and page render links.  This will allow an application
>> to override how that information is incorporated into the URL.
>> 
>> In your case, you could have a Dispatcher recognize the "/venue_name"
>> part and then generate a PageRenderRequestParameters object and invoke
>> the ComponentRequestHandler.handlePageRender() pipeline method.
>> 
>> Note: I'm talking about 5.1 here!
>> 
> 
> Hi Howard, all,
> 
> I've tried to implement this in 5.1 by copying the
> org.apache.tapestry5.internal.services.PageRenderDispatcher class,
> renaming it to my package and classname ("SiteDispatcher"), and inserting
> it into the dispatcher pipeline:
> 
>       public static void bind(ServiceBinder binder)
>       {
>               binder.bind(SiteDispatcher.class).withId("SiteDispatcher");
>       }
> 
>       public void contributeMasterDispatcher(
>                       OrderedConfiguration<Dispatcher> configuration,
>                       @InjectService("SiteDispatcher") Dispatcher 
> siteDispatcher)
>       {
>               configuration.add("SiteDispatcher", siteDispatcher,
>                               "before:PageRender");
>       }
> 
> 
> As that seemed to be what you were suggesting.  However, I'm obviously
> missing something because when I do this, the application links behave
> very strangely and end up taking me to the index page most times
> (presumably because the linked page didn't resolve to a known page
> somehow).
> 
> I'd rather not have to duplicate functionality, and instead defer to the
> internals of Tapestry whenever possible.  This approach seems to be
> overriding the page location functionality.
> 
> I would really appreciate some more details in the suggested approach
> since I'm not having much luck on my own.
> 
> Thank you,
> 
> Levi
> 

-- 
View this message in context: 
http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2344257.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to