You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by xfile80303 <le...@grokers.net> on 2009/02/05 18:17:32 UTC

[T5] URL Manipulation

Greetings all,

I've searched this list and found several people looking to do the same
thing, but no definitive answers, so perhaps someone has some new info.

Specifically, I would like to manipulate the URLs such that I can have
"nice" RESTful style URLs which feed information into the page ultimately
being rendered.

For example:

/app/venue_name/en_US/category/product/UUID

where product would be the rendering page, UUID could be the activation
context (which, if I understand correctly T5 will handle already).  However,
the "venue_name" and locale are not actual pages and are simply information
which is to be gleaned from the URL and passed to the page so it can render
as specified.

As other posts have suggested, it would seem to me that any manipulation of
the URL would have to happen in such a way that Tapestry would properly 1)
parse these URL "parameters" and pass them into the system for use by the
page, and 2) understand these "parameters" would need to be in Tapestry
generated links to preserve this data from link to link (page to page).

There has been mention of using a RequestFilter or a Dispatcher to do this,
but I have two concerns with this: 1) I am not sure how I would modify the
Request (at all?) so Tapestry internals would find the page to render
(remove the venu_name and locale parameters and let Tapestry locate the
category/product page) 2) Even if I was able to modify the Request, how
would I accomplish #2 above, so generated links would contain this data?

I appreciate your time and patience with this.

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


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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Thanks Howard,

That's great news.  I appreciate your work!

Cheers,

Levi


Howard Lewis Ship wrote:
> 
> 5.1 is pretty stable right now and due to some concerns of my own (*),
> I'll be pushing to release it fairly soon. I think the Spring Web Flow
> support may move out to 5.2.
> 
> It's not going to go 18 releases like 5.0!
> 
> (*) I have clients of my own who are in the same predicament. Also I
> think it would be good to release 5.1 with tons of new features (100
> issues closed so far) that is fully backwards compatible to 5.0 ...
> just upgrade and receive the benefits.
> 
> On Thu, Feb 5, 2009 at 12:28 PM, xfile80303 <le...@grokers.net> wrote:
>>
>> Thanks for the reply Howard.
>>
>> Is 5.1 at a state where I can start using it to develop a service which
>> will
>> go to production in a couple months?
>>
>> (i.e. does this help me now?)
>>
>> Levi
>>
>>
>> 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!
>>>
>>> On Thu, Feb 5, 2009 at 9:17 AM, xfile80303 <le...@grokers.net> wrote:
>>>>
>>>> Greetings all,
>>>>
>>>> I've searched this list and found several people looking to do the same
>>>> thing, but no definitive answers, so perhaps someone has some new info.
>>>>
>>>> Specifically, I would like to manipulate the URLs such that I can have
>>>> "nice" RESTful style URLs which feed information into the page
>>>> ultimately
>>>> being rendered.
>>>>
>>>> For example:
>>>>
>>>> /app/venue_name/en_US/category/product/UUID
>>>>
>>>> where product would be the rendering page, UUID could be the activation
>>>> context (which, if I understand correctly T5 will handle already).
>>>> However,
>>>> the "venue_name" and locale are not actual pages and are simply
>>>> information
>>>> which is to be gleaned from the URL and passed to the page so it can
>>>> render
>>>> as specified.
>>>>
>>>> As other posts have suggested, it would seem to me that any
>>>> manipulation
>>>> of
>>>> the URL would have to happen in such a way that Tapestry would properly
>>>> 1)
>>>> parse these URL "parameters" and pass them into the system for use by
>>>> the
>>>> page, and 2) understand these "parameters" would need to be in Tapestry
>>>> generated links to preserve this data from link to link (page to page).
>>>>
>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>> this,
>>>> but I have two concerns with this: 1) I am not sure how I would modify
>>>> the
>>>> Request (at all?) so Tapestry internals would find the page to render
>>>> (remove the venu_name and locale parameters and let Tapestry locate the
>>>> category/product page) 2) Even if I was able to modify the Request, how
>>>> would I accomplish #2 above, so generated links would contain this
>>>> data?
>>>>
>>>> I appreciate your time and patience with this.
>>>>
>>>> Levi
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2276010.html
>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator Apache Tapestry and Apache HiveMind
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277078.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Thanks for the confirmation Massimo.  :)

I'll have to take a look at 5.1.

Cheers,

Levi


Massimo Lusetti wrote:
> 
> On Fri, Feb 6, 2009 at 12:19 AM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
> 
>> 5.1 is pretty stable right now and due to some concerns of my own (*),
>> I'll be pushing to release it fairly soon. I think the Spring Web Flow
>> support may move out to 5.2.
> 
> Yep, I've already adopted 5.1 (trunk) for a project which will go
> production in 4-6 months and I'm very confident with this choice
> 
> But speaking about thread topic i think Andreas idea is nice and could
> be used quite well to fulfill your purpose if you have to stick with
> 5.0
> 
> Regards
> -- 
> Massimo
> http://meridio.blogspot.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by Massimo Lusetti <ml...@gmail.com>.
On Fri, Feb 6, 2009 at 12:19 AM, Howard Lewis Ship <hl...@gmail.com> wrote:

> 5.1 is pretty stable right now and due to some concerns of my own (*),
> I'll be pushing to release it fairly soon. I think the Spring Web Flow
> support may move out to 5.2.

Yep, I've already adopted 5.1 (trunk) for a project which will go
production in 4-6 months and I'm very confident with this choice

But speaking about thread topic i think Andreas idea is nice and could
be used quite well to fulfill your purpose if you have to stick with
5.0

Regards
-- 
Massimo
http://meridio.blogspot.com

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


Re: [T5] URL Manipulation

Posted by Howard Lewis Ship <hl...@gmail.com>.
5.1 is pretty stable right now and due to some concerns of my own (*),
I'll be pushing to release it fairly soon. I think the Spring Web Flow
support may move out to 5.2.

It's not going to go 18 releases like 5.0!

(*) I have clients of my own who are in the same predicament. Also I
think it would be good to release 5.1 with tons of new features (100
issues closed so far) that is fully backwards compatible to 5.0 ...
just upgrade and receive the benefits.

On Thu, Feb 5, 2009 at 12:28 PM, xfile80303 <le...@grokers.net> wrote:
>
> Thanks for the reply Howard.
>
> Is 5.1 at a state where I can start using it to develop a service which will
> go to production in a couple months?
>
> (i.e. does this help me now?)
>
> Levi
>
>
> 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!
>>
>> On Thu, Feb 5, 2009 at 9:17 AM, xfile80303 <le...@grokers.net> wrote:
>>>
>>> Greetings all,
>>>
>>> I've searched this list and found several people looking to do the same
>>> thing, but no definitive answers, so perhaps someone has some new info.
>>>
>>> Specifically, I would like to manipulate the URLs such that I can have
>>> "nice" RESTful style URLs which feed information into the page ultimately
>>> being rendered.
>>>
>>> For example:
>>>
>>> /app/venue_name/en_US/category/product/UUID
>>>
>>> where product would be the rendering page, UUID could be the activation
>>> context (which, if I understand correctly T5 will handle already).
>>> However,
>>> the "venue_name" and locale are not actual pages and are simply
>>> information
>>> which is to be gleaned from the URL and passed to the page so it can
>>> render
>>> as specified.
>>>
>>> As other posts have suggested, it would seem to me that any manipulation
>>> of
>>> the URL would have to happen in such a way that Tapestry would properly
>>> 1)
>>> parse these URL "parameters" and pass them into the system for use by the
>>> page, and 2) understand these "parameters" would need to be in Tapestry
>>> generated links to preserve this data from link to link (page to page).
>>>
>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>> this,
>>> but I have two concerns with this: 1) I am not sure how I would modify
>>> the
>>> Request (at all?) so Tapestry internals would find the page to render
>>> (remove the venu_name and locale parameters and let Tapestry locate the
>>> category/product page) 2) Even if I was able to modify the Request, how
>>> would I accomplish #2 above, so generated links would contain this data?
>>>
>>> I appreciate your time and patience with this.
>>>
>>> Levi
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2276010.html
>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277078.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Thanks for the reply Howard.

Is 5.1 at a state where I can start using it to develop a service which will
go to production in a couple months?

(i.e. does this help me now?)

Levi


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!
> 
> On Thu, Feb 5, 2009 at 9:17 AM, xfile80303 <le...@grokers.net> wrote:
>>
>> Greetings all,
>>
>> I've searched this list and found several people looking to do the same
>> thing, but no definitive answers, so perhaps someone has some new info.
>>
>> Specifically, I would like to manipulate the URLs such that I can have
>> "nice" RESTful style URLs which feed information into the page ultimately
>> being rendered.
>>
>> For example:
>>
>> /app/venue_name/en_US/category/product/UUID
>>
>> where product would be the rendering page, UUID could be the activation
>> context (which, if I understand correctly T5 will handle already). 
>> However,
>> the "venue_name" and locale are not actual pages and are simply
>> information
>> which is to be gleaned from the URL and passed to the page so it can
>> render
>> as specified.
>>
>> As other posts have suggested, it would seem to me that any manipulation
>> of
>> the URL would have to happen in such a way that Tapestry would properly
>> 1)
>> parse these URL "parameters" and pass them into the system for use by the
>> page, and 2) understand these "parameters" would need to be in Tapestry
>> generated links to preserve this data from link to link (page to page).
>>
>> There has been mention of using a RequestFilter or a Dispatcher to do
>> this,
>> but I have two concerns with this: 1) I am not sure how I would modify
>> the
>> Request (at all?) so Tapestry internals would find the page to render
>> (remove the venu_name and locale parameters and let Tapestry locate the
>> category/product page) 2) Even if I was able to modify the Request, how
>> would I accomplish #2 above, so generated links would contain this data?
>>
>> I appreciate your time and patience with this.
>>
>> Levi
>> --
>> View this message in context:
>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2276010.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.

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-tp2276010p2310454.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: [T5] URL Manipulation

Posted by Howard Lewis Ship <hl...@gmail.com>.
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!

On Thu, Feb 5, 2009 at 9:17 AM, xfile80303 <le...@grokers.net> wrote:
>
> Greetings all,
>
> I've searched this list and found several people looking to do the same
> thing, but no definitive answers, so perhaps someone has some new info.
>
> Specifically, I would like to manipulate the URLs such that I can have
> "nice" RESTful style URLs which feed information into the page ultimately
> being rendered.
>
> For example:
>
> /app/venue_name/en_US/category/product/UUID
>
> where product would be the rendering page, UUID could be the activation
> context (which, if I understand correctly T5 will handle already).  However,
> the "venue_name" and locale are not actual pages and are simply information
> which is to be gleaned from the URL and passed to the page so it can render
> as specified.
>
> As other posts have suggested, it would seem to me that any manipulation of
> the URL would have to happen in such a way that Tapestry would properly 1)
> parse these URL "parameters" and pass them into the system for use by the
> page, and 2) understand these "parameters" would need to be in Tapestry
> generated links to preserve this data from link to link (page to page).
>
> There has been mention of using a RequestFilter or a Dispatcher to do this,
> but I have two concerns with this: 1) I am not sure how I would modify the
> Request (at all?) so Tapestry internals would find the page to render
> (remove the venu_name and locale parameters and let Tapestry locate the
> category/product page) 2) Even if I was able to modify the Request, how
> would I accomplish #2 above, so generated links would contain this data?
>
> I appreciate your time and patience with this.
>
> Levi
> --
> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2276010.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: [T5] URL Manipulation

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Whoa, that's some amazing stuff!

Thanks Andreas. :)

-Filip

On 2009-02-06 00:24, Andreas Andreou wrote:
> Hi, see http://tuckey.org/urlrewrite/manual/2.6/ (i see they also have
> a 3.2 version)
> Just define some outbound-rules (instead of rules) for the cases
> you're interested, i.e.
> 
>     <outbound-rule>
>     <from>^/app/category/product/([0-9]+)?venue=([a-z]+)&locale=([a-z]+)$</from>
>     <to>/app/$2/$3/category/product/$1</to>
>     </outbound-rule>
> 
> 
> On Fri, Feb 6, 2009 at 12:14 AM, xfile80303 <le...@grokers.net> wrote:
>> Hi Andreas,
>>
>> Oh, please don't mistake me for an expert on T5 by any means.  :)  I just
>> don't see how the filter you mention would help with links generated by T5.
>>
>> For instance, let's say I put the filter in place, and I give a user the URL
>> to access the site:
>>
>> /app/venue_name/en_US/category/product/UUID (fill in with imaginary actual
>> values, if you will)
>>
>> The filter could strip out the venue_name, locale, whatever and put them as
>> actual parameters to the URL... something like:
>>
>> /app/category/product/UUID?venue=venue_name&locale=en_US
>>
>> And the URL would get passed in this way to T5 and the page would render, no
>> problem.
>>
>> However, once on the page, let's say there's a link to another product.
>> That link URL would be generated by T5 and look something like:
>>
>> /app/category/product/UUID2?venue=venue_name&locale=en_US
>>
>> and thus, a user will see this, bookmark it, send it in email to friends,
>> etc. instead of the "nicely" formatted URL that we started with.  So the
>> filter only makes it possible to map "published" URLS to something T5 can
>> understand, and does not allow us to filter "outgoing" URLs to change them
>> back to "nice" ones.
>>
>> Does it?
>>
>> Cheers,
>>
>> Levi
>>
>>
>> Andreas Andreou-2 wrote:
>>> I'm really a T5 novice - what i was saying is that if you do find a
>>> way to have that
>>> info in the url (nomatter how, even as query params + i'm sure it's
>>> possible), you
>>> can use that filter to completely transform the look of the urls ...
>>>
>>> On Thu, Feb 5, 2009 at 10:56 PM, xfile80303 <le...@grokers.net> wrote:
>>>> Thank you Andreas.
>>>>
>>>> I'm not sure I understand how this would help me with issue #2 (as
>>>> defined
>>>> in my original posting).  Can you enlighten me?
>>>>
>>>> Cheers,
>>>>
>>>> Levi
>>>>
>>>>
>>>> Andreas Andreou-2 wrote:
>>>>> An alternative is http://tuckey.org/urlrewrite/
>>>>> And since Tapestry always calls the servlet container to encode the url,
>>>>> urlrewrite will work for both generating urls (to output in html)  and
>>>>> parsing
>>>>> them (incoming)
>>>>>
>>>>> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>>>>>> Hi Thiago,
>>>>>>
>>>>>> Thanks for taking the time.  I believe I need to do some clarification
>>>>>> however.
>>>>>>
>>>>>> The example URL I mentioned is order specific.  Meaning it would not
>>>>>> make
>>>>>> sense to have the venu_name (or others of these URL parameters) to be
>>>>>> at
>>>>>> the
>>>>>> end of the URL.  They need to go into the URL before the page name
>>>>>> structure
>>>>>> in order to be purposeful.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Levi
>>>>>>
>>>>>>
>>>>>> Thiago H. de Paula Figueiredo wrote:
>>>>>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>>>>>>> escreveu:
>>>>>>>
>>>>>>>> Greetings all,
>>>>>>> Hello! :)
>>>>>>>
>>>>>>>> Specifically, I would like to manipulate the URLs such that I can
>>>>>>>> have
>>>>>>>> "nice" RESTful style URLs which feed information into the page
>>>>>>>> ultimately
>>>>>>>> being rendered.
>>>>>>> Tapestry is incredibly RESTful, so I guess you don't have to do much
>>>>>>> to
>>>>>>> accomplish what you want. :)
>>>>>>>
>>>>>>>> For example:
>>>>>>>> /app/venue_name/en_US/category/product/UUID
>>>>>>>> where product would be the rendering page, UUID could be the
>>>>>>>> activation
>>>>>>>> context (which, if I understand correctly T5 will handle already).
>>>>>>>> However, the "venue_name" and locale are not actual pages and are
>>>>>>>> simply
>>>>>>>> information which is to be gleaned from the URL and passed to the
>>>>>>>> page
>>>>>>>> so it can render as specified.
>>>>>>> All you need to do is to ignore the venue_name and locale parameters.
>>>>>>> thedailytube.com, a website created by some guy in this list I always
>>>>>>> forget the name (I'm sorry . . .), does what you need in the video
>>>>>>> pages.
>>>>>>> Look at this URL:
>>>>>>>
>>>>>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>>>>>>
>>>>>>> The video page uses the first parameter (15794) as the id of the video
>>>>>>> to
>>>>>>> be shown. The second parameter is there just for search engine
>>>>>>> purposes.
>>>>>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives
>>>>>>> you
>>>>>>> exactly the same page as the original URL. ;)
>>>>>>>
>>>>>>>> As other posts have suggested, it would seem to me that any
>>>>>>>> manipulation
>>>>>>>> of the URL would have to happen in such a way that Tapestry would
>>>>>>>> properly 1) parse these URL "parameters" and pass them into the
>>>>>>>> system
>>>>>>>> for use by the
>>>>>>>> page,
>>>>>>> One advice is to use EventContext. It is a little hard to find in the
>>>>>>> documentation (EventContext section in
>>>>>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>>>>>>> handler method, including onActivate(), can have a single EventContext
>>>>>>> parameter. It provides you two methods: one with the parameter count,
>>>>>>> other that returns the value of the n-th parameter. Having an
>>>>>>> onActivate(EventContext context) method makes it really easy to deal
>>>>>>> with
>>>>>>> different parameters in the activation context, even optional
>>>>>>> parameters.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> and 2) understand these "parameters" would need to be in Tapestry
>>>>>>>> generated links to preserve this data from link to link (page to
>>>>>>>> page).
>>>>>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>>>>>> this, but I have two concerns with this: 1) I am not sure how I would
>>>>>>>> modify the Request (at all?) so Tapestry internals would find the
>>>>>>>> page
>>>>>>>> to render
>>>>>>>> (remove the venu_name and locale parameters and let Tapestry locate
>>>>>>>> the
>>>>>>>> category/product page)
>>>>>>> As stated above, you don't need to change the request, just ignore the
>>>>>>> parameters you don't need.
>>>>>>>
>>>>>>>> 2) Even if I was able to modify the Request, how
>>>>>>>> would I accomplish #2 above, so generated links would contain this
>>>>>>>> data?
>>>>>>> That's the hard part here. One solution is to remember to add the
>>>>>>> parameters in the context of all PageLinks. Remember: the activation
>>>>>>> context can have parameters that will be ignored. In this case, the
>>>>>>> activation context would be a List, not a single value Most examples
>>>>>>> use
>>>>>>> an id as the activation context, but that's not the only way to do it.
>>>>>>> A
>>>>>>> more automated solution could be the decoration of the LinkFactory
>>>>>>> service
>>>>>>> to automatically add the parameters. I haven't tested it, though.
>>>>>>>
>>>>>>> --
>>>>>>> Thiago H. de Paula Figueiredo
>>>>>>> Independent Java consultant, developer, and instructor
>>>>>>> http://www.arsmachina.com.br/thiago
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
>>>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>>>> Tapestry / Tacos developer
>>>>> Open Source / JEE Consulting
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277221.html
>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>> Tapestry / Tacos developer
>>> Open Source / JEE Consulting
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>> --
>> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277645.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 

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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Hi Andreas,

That is very very slick.  Thank you, I now understand.  ;)

Cheers,

Levi


Andreas Andreou-2 wrote:
> 
> Hi, see http://tuckey.org/urlrewrite/manual/2.6/ (i see they also have
> a 3.2 version)
> Just define some outbound-rules (instead of rules) for the cases
> you're interested, i.e.
> 
>     <outbound-rule>
>    
> <from>^/app/category/product/([0-9]+)?venue=([a-z]+)&locale=([a-z]+)$</from>
>     <to>/app/$2/$3/category/product/$1</to>
>     </outbound-rule>
> 
> 
> On Fri, Feb 6, 2009 at 12:14 AM, xfile80303 <le...@grokers.net> wrote:
>>
>> Hi Andreas,
>>
>> Oh, please don't mistake me for an expert on T5 by any means.  :)  I just
>> don't see how the filter you mention would help with links generated by
>> T5.
>>
>> For instance, let's say I put the filter in place, and I give a user the
>> URL
>> to access the site:
>>
>> /app/venue_name/en_US/category/product/UUID (fill in with imaginary
>> actual
>> values, if you will)
>>
>> The filter could strip out the venue_name, locale, whatever and put them
>> as
>> actual parameters to the URL... something like:
>>
>> /app/category/product/UUID?venue=venue_name&locale=en_US
>>
>> And the URL would get passed in this way to T5 and the page would render,
>> no
>> problem.
>>
>> However, once on the page, let's say there's a link to another product.
>> That link URL would be generated by T5 and look something like:
>>
>> /app/category/product/UUID2?venue=venue_name&locale=en_US
>>
>> and thus, a user will see this, bookmark it, send it in email to friends,
>> etc. instead of the "nicely" formatted URL that we started with.  So the
>> filter only makes it possible to map "published" URLS to something T5 can
>> understand, and does not allow us to filter "outgoing" URLs to change
>> them
>> back to "nice" ones.
>>
>> Does it?
>>
>> Cheers,
>>
>> Levi
> 

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


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


Re: [T5] URL Manipulation

Posted by Andreas Andreou <an...@di.uoa.gr>.
Hi, see http://tuckey.org/urlrewrite/manual/2.6/ (i see they also have
a 3.2 version)
Just define some outbound-rules (instead of rules) for the cases
you're interested, i.e.

    <outbound-rule>
    <from>^/app/category/product/([0-9]+)?venue=([a-z]+)&locale=([a-z]+)$</from>
    <to>/app/$2/$3/category/product/$1</to>
    </outbound-rule>


On Fri, Feb 6, 2009 at 12:14 AM, xfile80303 <le...@grokers.net> wrote:
>
> Hi Andreas,
>
> Oh, please don't mistake me for an expert on T5 by any means.  :)  I just
> don't see how the filter you mention would help with links generated by T5.
>
> For instance, let's say I put the filter in place, and I give a user the URL
> to access the site:
>
> /app/venue_name/en_US/category/product/UUID (fill in with imaginary actual
> values, if you will)
>
> The filter could strip out the venue_name, locale, whatever and put them as
> actual parameters to the URL... something like:
>
> /app/category/product/UUID?venue=venue_name&locale=en_US
>
> And the URL would get passed in this way to T5 and the page would render, no
> problem.
>
> However, once on the page, let's say there's a link to another product.
> That link URL would be generated by T5 and look something like:
>
> /app/category/product/UUID2?venue=venue_name&locale=en_US
>
> and thus, a user will see this, bookmark it, send it in email to friends,
> etc. instead of the "nicely" formatted URL that we started with.  So the
> filter only makes it possible to map "published" URLS to something T5 can
> understand, and does not allow us to filter "outgoing" URLs to change them
> back to "nice" ones.
>
> Does it?
>
> Cheers,
>
> Levi
>
>
> Andreas Andreou-2 wrote:
>>
>> I'm really a T5 novice - what i was saying is that if you do find a
>> way to have that
>> info in the url (nomatter how, even as query params + i'm sure it's
>> possible), you
>> can use that filter to completely transform the look of the urls ...
>>
>> On Thu, Feb 5, 2009 at 10:56 PM, xfile80303 <le...@grokers.net> wrote:
>>>
>>> Thank you Andreas.
>>>
>>> I'm not sure I understand how this would help me with issue #2 (as
>>> defined
>>> in my original posting).  Can you enlighten me?
>>>
>>> Cheers,
>>>
>>> Levi
>>>
>>>
>>> Andreas Andreou-2 wrote:
>>>>
>>>> An alternative is http://tuckey.org/urlrewrite/
>>>> And since Tapestry always calls the servlet container to encode the url,
>>>> urlrewrite will work for both generating urls (to output in html)  and
>>>> parsing
>>>> them (incoming)
>>>>
>>>> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>>>>>
>>>>> Hi Thiago,
>>>>>
>>>>> Thanks for taking the time.  I believe I need to do some clarification
>>>>> however.
>>>>>
>>>>> The example URL I mentioned is order specific.  Meaning it would not
>>>>> make
>>>>> sense to have the venu_name (or others of these URL parameters) to be
>>>>> at
>>>>> the
>>>>> end of the URL.  They need to go into the URL before the page name
>>>>> structure
>>>>> in order to be purposeful.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Levi
>>>>>
>>>>>
>>>>> Thiago H. de Paula Figueiredo wrote:
>>>>>>
>>>>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>>>>>> escreveu:
>>>>>>
>>>>>>> Greetings all,
>>>>>>
>>>>>> Hello! :)
>>>>>>
>>>>>>> Specifically, I would like to manipulate the URLs such that I can
>>>>>>> have
>>>>>>> "nice" RESTful style URLs which feed information into the page
>>>>>>> ultimately
>>>>>>> being rendered.
>>>>>>
>>>>>> Tapestry is incredibly RESTful, so I guess you don't have to do much
>>>>>> to
>>>>>> accomplish what you want. :)
>>>>>>
>>>>>>> For example:
>>>>>>> /app/venue_name/en_US/category/product/UUID
>>>>>>> where product would be the rendering page, UUID could be the
>>>>>>> activation
>>>>>>> context (which, if I understand correctly T5 will handle already).
>>>>>>> However, the "venue_name" and locale are not actual pages and are
>>>>>>> simply
>>>>>>> information which is to be gleaned from the URL and passed to the
>>>>>>> page
>>>>>>> so it can render as specified.
>>>>>>
>>>>>> All you need to do is to ignore the venue_name and locale parameters.
>>>>>> thedailytube.com, a website created by some guy in this list I always
>>>>>> forget the name (I'm sorry . . .), does what you need in the video
>>>>>> pages.
>>>>>> Look at this URL:
>>>>>>
>>>>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>>>>>
>>>>>> The video page uses the first parameter (15794) as the id of the video
>>>>>> to
>>>>>> be shown. The second parameter is there just for search engine
>>>>>> purposes.
>>>>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives
>>>>>> you
>>>>>> exactly the same page as the original URL. ;)
>>>>>>
>>>>>>> As other posts have suggested, it would seem to me that any
>>>>>>> manipulation
>>>>>>> of the URL would have to happen in such a way that Tapestry would
>>>>>>> properly 1) parse these URL "parameters" and pass them into the
>>>>>>> system
>>>>>>> for use by the
>>>>>>> page,
>>>>>>
>>>>>> One advice is to use EventContext. It is a little hard to find in the
>>>>>> documentation (EventContext section in
>>>>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>>>>>> handler method, including onActivate(), can have a single EventContext
>>>>>> parameter. It provides you two methods: one with the parameter count,
>>>>>> other that returns the value of the n-th parameter. Having an
>>>>>> onActivate(EventContext context) method makes it really easy to deal
>>>>>> with
>>>>>> different parameters in the activation context, even optional
>>>>>> parameters.
>>>>>>
>>>>>>
>>>>>>
>>>>>> and 2) understand these "parameters" would need to be in Tapestry
>>>>>>> generated links to preserve this data from link to link (page to
>>>>>>> page).
>>>>>>
>>>>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>>>>> this, but I have two concerns with this: 1) I am not sure how I would
>>>>>>> modify the Request (at all?) so Tapestry internals would find the
>>>>>>> page
>>>>>>> to render
>>>>>>> (remove the venu_name and locale parameters and let Tapestry locate
>>>>>>> the
>>>>>>> category/product page)
>>>>>>
>>>>>> As stated above, you don't need to change the request, just ignore the
>>>>>> parameters you don't need.
>>>>>>
>>>>>>> 2) Even if I was able to modify the Request, how
>>>>>>> would I accomplish #2 above, so generated links would contain this
>>>>>>> data?
>>>>>>
>>>>>> That's the hard part here. One solution is to remember to add the
>>>>>> parameters in the context of all PageLinks. Remember: the activation
>>>>>> context can have parameters that will be ignored. In this case, the
>>>>>> activation context would be a List, not a single value Most examples
>>>>>> use
>>>>>> an id as the activation context, but that's not the only way to do it.
>>>>>> A
>>>>>> more automated solution could be the decoration of the LinkFactory
>>>>>> service
>>>>>> to automatically add the parameters. I haven't tested it, though.
>>>>>>
>>>>>> --
>>>>>> Thiago H. de Paula Figueiredo
>>>>>> Independent Java consultant, developer, and instructor
>>>>>> http://www.arsmachina.com.br/thiago
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
>>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>>> Tapestry / Tacos developer
>>>> Open Source / JEE Consulting
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277221.html
>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277645.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Hi Andreas,

Oh, please don't mistake me for an expert on T5 by any means.  :)  I just
don't see how the filter you mention would help with links generated by T5.

For instance, let's say I put the filter in place, and I give a user the URL
to access the site:

/app/venue_name/en_US/category/product/UUID (fill in with imaginary actual
values, if you will)

The filter could strip out the venue_name, locale, whatever and put them as
actual parameters to the URL... something like:

/app/category/product/UUID?venue=venue_name&locale=en_US

And the URL would get passed in this way to T5 and the page would render, no
problem.

However, once on the page, let's say there's a link to another product. 
That link URL would be generated by T5 and look something like:

/app/category/product/UUID2?venue=venue_name&locale=en_US

and thus, a user will see this, bookmark it, send it in email to friends,
etc. instead of the "nicely" formatted URL that we started with.  So the
filter only makes it possible to map "published" URLS to something T5 can
understand, and does not allow us to filter "outgoing" URLs to change them
back to "nice" ones.

Does it?

Cheers,

Levi


Andreas Andreou-2 wrote:
> 
> I'm really a T5 novice - what i was saying is that if you do find a
> way to have that
> info in the url (nomatter how, even as query params + i'm sure it's
> possible), you
> can use that filter to completely transform the look of the urls ...
> 
> On Thu, Feb 5, 2009 at 10:56 PM, xfile80303 <le...@grokers.net> wrote:
>>
>> Thank you Andreas.
>>
>> I'm not sure I understand how this would help me with issue #2 (as
>> defined
>> in my original posting).  Can you enlighten me?
>>
>> Cheers,
>>
>> Levi
>>
>>
>> Andreas Andreou-2 wrote:
>>>
>>> An alternative is http://tuckey.org/urlrewrite/
>>> And since Tapestry always calls the servlet container to encode the url,
>>> urlrewrite will work for both generating urls (to output in html)  and
>>> parsing
>>> them (incoming)
>>>
>>> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>>>>
>>>> Hi Thiago,
>>>>
>>>> Thanks for taking the time.  I believe I need to do some clarification
>>>> however.
>>>>
>>>> The example URL I mentioned is order specific.  Meaning it would not
>>>> make
>>>> sense to have the venu_name (or others of these URL parameters) to be
>>>> at
>>>> the
>>>> end of the URL.  They need to go into the URL before the page name
>>>> structure
>>>> in order to be purposeful.
>>>>
>>>> Cheers,
>>>>
>>>> Levi
>>>>
>>>>
>>>> Thiago H. de Paula Figueiredo wrote:
>>>>>
>>>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>>>>> escreveu:
>>>>>
>>>>>> Greetings all,
>>>>>
>>>>> Hello! :)
>>>>>
>>>>>> Specifically, I would like to manipulate the URLs such that I can
>>>>>> have
>>>>>> "nice" RESTful style URLs which feed information into the page
>>>>>> ultimately
>>>>>> being rendered.
>>>>>
>>>>> Tapestry is incredibly RESTful, so I guess you don't have to do much
>>>>> to
>>>>> accomplish what you want. :)
>>>>>
>>>>>> For example:
>>>>>> /app/venue_name/en_US/category/product/UUID
>>>>>> where product would be the rendering page, UUID could be the
>>>>>> activation
>>>>>> context (which, if I understand correctly T5 will handle already).
>>>>>> However, the "venue_name" and locale are not actual pages and are
>>>>>> simply
>>>>>> information which is to be gleaned from the URL and passed to the
>>>>>> page
>>>>>> so it can render as specified.
>>>>>
>>>>> All you need to do is to ignore the venue_name and locale parameters.
>>>>> thedailytube.com, a website created by some guy in this list I always
>>>>> forget the name (I'm sorry . . .), does what you need in the video
>>>>> pages.
>>>>> Look at this URL:
>>>>>
>>>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>>>>
>>>>> The video page uses the first parameter (15794) as the id of the video
>>>>> to
>>>>> be shown. The second parameter is there just for search engine
>>>>> purposes.
>>>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives
>>>>> you
>>>>> exactly the same page as the original URL. ;)
>>>>>
>>>>>> As other posts have suggested, it would seem to me that any
>>>>>> manipulation
>>>>>> of the URL would have to happen in such a way that Tapestry would
>>>>>> properly 1) parse these URL "parameters" and pass them into the
>>>>>> system
>>>>>> for use by the
>>>>>> page,
>>>>>
>>>>> One advice is to use EventContext. It is a little hard to find in the
>>>>> documentation (EventContext section in
>>>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>>>>> handler method, including onActivate(), can have a single EventContext
>>>>> parameter. It provides you two methods: one with the parameter count,
>>>>> other that returns the value of the n-th parameter. Having an
>>>>> onActivate(EventContext context) method makes it really easy to deal
>>>>> with
>>>>> different parameters in the activation context, even optional
>>>>> parameters.
>>>>>
>>>>>
>>>>>
>>>>> and 2) understand these "parameters" would need to be in Tapestry
>>>>>> generated links to preserve this data from link to link (page to
>>>>>> page).
>>>>>
>>>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>>>> this, but I have two concerns with this: 1) I am not sure how I would
>>>>>> modify the Request (at all?) so Tapestry internals would find the
>>>>>> page
>>>>>> to render
>>>>>> (remove the venu_name and locale parameters and let Tapestry locate
>>>>>> the
>>>>>> category/product page)
>>>>>
>>>>> As stated above, you don't need to change the request, just ignore the
>>>>> parameters you don't need.
>>>>>
>>>>>> 2) Even if I was able to modify the Request, how
>>>>>> would I accomplish #2 above, so generated links would contain this
>>>>>> data?
>>>>>
>>>>> That's the hard part here. One solution is to remember to add the
>>>>> parameters in the context of all PageLinks. Remember: the activation
>>>>> context can have parameters that will be ignored. In this case, the
>>>>> activation context would be a List, not a single value Most examples
>>>>> use
>>>>> an id as the activation context, but that's not the only way to do it.
>>>>> A
>>>>> more automated solution could be the decoration of the LinkFactory
>>>>> service
>>>>> to automatically add the parameters. I haven't tested it, though.
>>>>>
>>>>> --
>>>>> Thiago H. de Paula Figueiredo
>>>>> Independent Java consultant, developer, and instructor
>>>>> http://www.arsmachina.com.br/thiago
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
>>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>>> Tapestry / Tacos developer
>>> Open Source / JEE Consulting
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277221.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by Andreas Andreou <an...@di.uoa.gr>.
I'm really a T5 novice - what i was saying is that if you do find a
way to have that
info in the url (nomatter how, even as query params + i'm sure it's
possible), you
can use that filter to completely transform the look of the urls ...

On Thu, Feb 5, 2009 at 10:56 PM, xfile80303 <le...@grokers.net> wrote:
>
> Thank you Andreas.
>
> I'm not sure I understand how this would help me with issue #2 (as defined
> in my original posting).  Can you enlighten me?
>
> Cheers,
>
> Levi
>
>
> Andreas Andreou-2 wrote:
>>
>> An alternative is http://tuckey.org/urlrewrite/
>> And since Tapestry always calls the servlet container to encode the url,
>> urlrewrite will work for both generating urls (to output in html)  and
>> parsing
>> them (incoming)
>>
>> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>>>
>>> Hi Thiago,
>>>
>>> Thanks for taking the time.  I believe I need to do some clarification
>>> however.
>>>
>>> The example URL I mentioned is order specific.  Meaning it would not make
>>> sense to have the venu_name (or others of these URL parameters) to be at
>>> the
>>> end of the URL.  They need to go into the URL before the page name
>>> structure
>>> in order to be purposeful.
>>>
>>> Cheers,
>>>
>>> Levi
>>>
>>>
>>> Thiago H. de Paula Figueiredo wrote:
>>>>
>>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>>>> escreveu:
>>>>
>>>>> Greetings all,
>>>>
>>>> Hello! :)
>>>>
>>>>> Specifically, I would like to manipulate the URLs such that I can have
>>>>> "nice" RESTful style URLs which feed information into the page
>>>>> ultimately
>>>>> being rendered.
>>>>
>>>> Tapestry is incredibly RESTful, so I guess you don't have to do much to
>>>> accomplish what you want. :)
>>>>
>>>>> For example:
>>>>> /app/venue_name/en_US/category/product/UUID
>>>>> where product would be the rendering page, UUID could be the activation
>>>>> context (which, if I understand correctly T5 will handle already).
>>>>> However, the "venue_name" and locale are not actual pages and are
>>>>> simply
>>>>> information which is to be gleaned from the URL and passed to the page
>>>>> so it can render as specified.
>>>>
>>>> All you need to do is to ignore the venue_name and locale parameters.
>>>> thedailytube.com, a website created by some guy in this list I always
>>>> forget the name (I'm sorry . . .), does what you need in the video
>>>> pages.
>>>> Look at this URL:
>>>>
>>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>>>
>>>> The video page uses the first parameter (15794) as the id of the video
>>>> to
>>>> be shown. The second parameter is there just for search engine purposes.
>>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives you
>>>> exactly the same page as the original URL. ;)
>>>>
>>>>> As other posts have suggested, it would seem to me that any
>>>>> manipulation
>>>>> of the URL would have to happen in such a way that Tapestry would
>>>>> properly 1) parse these URL "parameters" and pass them into the system
>>>>> for use by the
>>>>> page,
>>>>
>>>> One advice is to use EventContext. It is a little hard to find in the
>>>> documentation (EventContext section in
>>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>>>> handler method, including onActivate(), can have a single EventContext
>>>> parameter. It provides you two methods: one with the parameter count,
>>>> other that returns the value of the n-th parameter. Having an
>>>> onActivate(EventContext context) method makes it really easy to deal
>>>> with
>>>> different parameters in the activation context, even optional
>>>> parameters.
>>>>
>>>>
>>>>
>>>> and 2) understand these "parameters" would need to be in Tapestry
>>>>> generated links to preserve this data from link to link (page to page).
>>>>
>>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>>> this, but I have two concerns with this: 1) I am not sure how I would
>>>>> modify the Request (at all?) so Tapestry internals would find the page
>>>>> to render
>>>>> (remove the venu_name and locale parameters and let Tapestry locate the
>>>>> category/product page)
>>>>
>>>> As stated above, you don't need to change the request, just ignore the
>>>> parameters you don't need.
>>>>
>>>>> 2) Even if I was able to modify the Request, how
>>>>> would I accomplish #2 above, so generated links would contain this
>>>>> data?
>>>>
>>>> That's the hard part here. One solution is to remember to add the
>>>> parameters in the context of all PageLinks. Remember: the activation
>>>> context can have parameters that will be ignored. In this case, the
>>>> activation context would be a List, not a single value Most examples use
>>>> an id as the activation context, but that's not the only way to do it. A
>>>> more automated solution could be the decoration of the LinkFactory
>>>> service
>>>> to automatically add the parameters. I haven't tested it, though.
>>>>
>>>> --
>>>> Thiago H. de Paula Figueiredo
>>>> Independent Java consultant, developer, and instructor
>>>> http://www.arsmachina.com.br/thiago
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
>>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277221.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Thank you Andreas.

I'm not sure I understand how this would help me with issue #2 (as defined
in my original posting).  Can you enlighten me?

Cheers,

Levi


Andreas Andreou-2 wrote:
> 
> An alternative is http://tuckey.org/urlrewrite/
> And since Tapestry always calls the servlet container to encode the url,
> urlrewrite will work for both generating urls (to output in html)  and
> parsing
> them (incoming)
> 
> On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>>
>> Hi Thiago,
>>
>> Thanks for taking the time.  I believe I need to do some clarification
>> however.
>>
>> The example URL I mentioned is order specific.  Meaning it would not make
>> sense to have the venu_name (or others of these URL parameters) to be at
>> the
>> end of the URL.  They need to go into the URL before the page name
>> structure
>> in order to be purposeful.
>>
>> Cheers,
>>
>> Levi
>>
>>
>> Thiago H. de Paula Figueiredo wrote:
>>>
>>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>>> escreveu:
>>>
>>>> Greetings all,
>>>
>>> Hello! :)
>>>
>>>> Specifically, I would like to manipulate the URLs such that I can have
>>>> "nice" RESTful style URLs which feed information into the page
>>>> ultimately
>>>> being rendered.
>>>
>>> Tapestry is incredibly RESTful, so I guess you don't have to do much to
>>> accomplish what you want. :)
>>>
>>>> For example:
>>>> /app/venue_name/en_US/category/product/UUID
>>>> where product would be the rendering page, UUID could be the activation
>>>> context (which, if I understand correctly T5 will handle already).
>>>> However, the "venue_name" and locale are not actual pages and are
>>>> simply
>>>> information which is to be gleaned from the URL and passed to the page
>>>> so it can render as specified.
>>>
>>> All you need to do is to ignore the venue_name and locale parameters.
>>> thedailytube.com, a website created by some guy in this list I always
>>> forget the name (I'm sorry . . .), does what you need in the video
>>> pages.
>>> Look at this URL:
>>>
>>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>>
>>> The video page uses the first parameter (15794) as the id of the video
>>> to
>>> be shown. The second parameter is there just for search engine purposes.
>>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives you
>>> exactly the same page as the original URL. ;)
>>>
>>>> As other posts have suggested, it would seem to me that any
>>>> manipulation
>>>> of the URL would have to happen in such a way that Tapestry would
>>>> properly 1) parse these URL "parameters" and pass them into the system
>>>> for use by the
>>>> page,
>>>
>>> One advice is to use EventContext. It is a little hard to find in the
>>> documentation (EventContext section in
>>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>>> handler method, including onActivate(), can have a single EventContext
>>> parameter. It provides you two methods: one with the parameter count,
>>> other that returns the value of the n-th parameter. Having an
>>> onActivate(EventContext context) method makes it really easy to deal
>>> with
>>> different parameters in the activation context, even optional
>>> parameters.
>>>
>>>
>>>
>>> and 2) understand these "parameters" would need to be in Tapestry
>>>> generated links to preserve this data from link to link (page to page).
>>>
>>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>>> this, but I have two concerns with this: 1) I am not sure how I would
>>>> modify the Request (at all?) so Tapestry internals would find the page
>>>> to render
>>>> (remove the venu_name and locale parameters and let Tapestry locate the
>>>> category/product page)
>>>
>>> As stated above, you don't need to change the request, just ignore the
>>> parameters you don't need.
>>>
>>>> 2) Even if I was able to modify the Request, how
>>>> would I accomplish #2 above, so generated links would contain this
>>>> data?
>>>
>>> That's the hard part here. One solution is to remember to add the
>>> parameters in the context of all PageLinks. Remember: the activation
>>> context can have parameters that will be ignored. In this case, the
>>> activation context would be a List, not a single value Most examples use
>>> an id as the activation context, but that's not the only way to do it. A
>>> more automated solution could be the decoration of the LinkFactory
>>> service
>>> to automatically add the parameters. I haven't tested it, though.
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Independent Java consultant, developer, and instructor
>>> http://www.arsmachina.com.br/thiago
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by Andreas Andreou <an...@di.uoa.gr>.
An alternative is http://tuckey.org/urlrewrite/
And since Tapestry always calls the servlet container to encode the url,
urlrewrite will work for both generating urls (to output in html)  and parsing
them (incoming)

On Thu, Feb 5, 2009 at 10:31 PM, xfile80303 <le...@grokers.net> wrote:
>
> Hi Thiago,
>
> Thanks for taking the time.  I believe I need to do some clarification
> however.
>
> The example URL I mentioned is order specific.  Meaning it would not make
> sense to have the venu_name (or others of these URL parameters) to be at the
> end of the URL.  They need to go into the URL before the page name structure
> in order to be purposeful.
>
> Cheers,
>
> Levi
>
>
> Thiago H. de Paula Figueiredo wrote:
>>
>> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
>> escreveu:
>>
>>> Greetings all,
>>
>> Hello! :)
>>
>>> Specifically, I would like to manipulate the URLs such that I can have
>>> "nice" RESTful style URLs which feed information into the page ultimately
>>> being rendered.
>>
>> Tapestry is incredibly RESTful, so I guess you don't have to do much to
>> accomplish what you want. :)
>>
>>> For example:
>>> /app/venue_name/en_US/category/product/UUID
>>> where product would be the rendering page, UUID could be the activation
>>> context (which, if I understand correctly T5 will handle already).
>>> However, the "venue_name" and locale are not actual pages and are simply
>>> information which is to be gleaned from the URL and passed to the page
>>> so it can render as specified.
>>
>> All you need to do is to ignore the venue_name and locale parameters.
>> thedailytube.com, a website created by some guy in this list I always
>> forget the name (I'm sorry . . .), does what you need in the video pages.
>> Look at this URL:
>>
>> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
>>
>> The video page uses the first parameter (15794) as the id of the video to
>> be shown. The second parameter is there just for search engine purposes.
>> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives you
>> exactly the same page as the original URL. ;)
>>
>>> As other posts have suggested, it would seem to me that any manipulation
>>> of the URL would have to happen in such a way that Tapestry would
>>> properly 1) parse these URL "parameters" and pass them into the system
>>> for use by the
>>> page,
>>
>> One advice is to use EventContext. It is a little hard to find in the
>> documentation (EventContext section in
>> http://tapestry.apache.org/tapestry5/guide/event.html), but any event
>> handler method, including onActivate(), can have a single EventContext
>> parameter. It provides you two methods: one with the parameter count,
>> other that returns the value of the n-th parameter. Having an
>> onActivate(EventContext context) method makes it really easy to deal with
>> different parameters in the activation context, even optional parameters.
>>
>>
>>
>> and 2) understand these "parameters" would need to be in Tapestry
>>> generated links to preserve this data from link to link (page to page).
>>
>>> There has been mention of using a RequestFilter or a Dispatcher to do
>>> this, but I have two concerns with this: 1) I am not sure how I would
>>> modify the Request (at all?) so Tapestry internals would find the page
>>> to render
>>> (remove the venu_name and locale parameters and let Tapestry locate the
>>> category/product page)
>>
>> As stated above, you don't need to change the request, just ignore the
>> parameters you don't need.
>>
>>> 2) Even if I was able to modify the Request, how
>>> would I accomplish #2 above, so generated links would contain this data?
>>
>> That's the hard part here. One solution is to remember to add the
>> parameters in the context of all PageLinks. Remember: the activation
>> context can have parameters that will be ignored. In this case, the
>> activation context would be a List, not a single value Most examples use
>> an id as the activation context, but that's not the only way to do it. A
>> more automated solution could be the decoration of the LinkFactory service
>> to automatically add the parameters. I haven't tested it, though.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/-T5--URL-Manipulation-tp2276010p2277094.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: [T5] URL Manipulation

Posted by xfile80303 <le...@grokers.net>.
Hi Thiago,

Thanks for taking the time.  I believe I need to do some clarification
however.

The example URL I mentioned is order specific.  Meaning it would not make
sense to have the venu_name (or others of these URL parameters) to be at the
end of the URL.  They need to go into the URL before the page name structure
in order to be purposeful.

Cheers,

Levi


Thiago H. de Paula Figueiredo wrote:
> 
> Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net>
> escreveu:
> 
>> Greetings all,
> 
> Hello! :)
> 
>> Specifically, I would like to manipulate the URLs such that I can have
>> "nice" RESTful style URLs which feed information into the page ultimately
>> being rendered.
> 
> Tapestry is incredibly RESTful, so I guess you don't have to do much to  
> accomplish what you want. :)
> 
>> For example:
>> /app/venue_name/en_US/category/product/UUID
>> where product would be the rendering page, UUID could be the activation
>> context (which, if I understand correctly T5 will handle already).   
>> However, the "venue_name" and locale are not actual pages and are simply  
>> information which is to be gleaned from the URL and passed to the page  
>> so it can render as specified.
> 
> All you need to do is to ignore the venue_name and locale parameters.  
> thedailytube.com, a website created by some guy in this list I always  
> forget the name (I'm sorry . . .), does what you need in the video pages.  
> Look at this URL:
> 
> http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix
> 
> The video page uses the first parameter (15794) as the id of the video to  
> be shown. The second parameter is there just for search engine purposes.  
> Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives you  
> exactly the same page as the original URL. ;)
> 
>> As other posts have suggested, it would seem to me that any manipulation  
>> of the URL would have to happen in such a way that Tapestry would  
>> properly 1) parse these URL "parameters" and pass them into the system  
>> for use by the
>> page,
> 
> One advice is to use EventContext. It is a little hard to find in the  
> documentation (EventContext section in  
> http://tapestry.apache.org/tapestry5/guide/event.html), but any event  
> handler method, including onActivate(), can have a single EventContext  
> parameter. It provides you two methods: one with the parameter count,  
> other that returns the value of the n-th parameter. Having an  
> onActivate(EventContext context) method makes it really easy to deal with  
> different parameters in the activation context, even optional parameters.
> 
> 
> 
> and 2) understand these "parameters" would need to be in Tapestry
>> generated links to preserve this data from link to link (page to page).
> 
>> There has been mention of using a RequestFilter or a Dispatcher to do  
>> this, but I have two concerns with this: 1) I am not sure how I would  
>> modify the Request (at all?) so Tapestry internals would find the page  
>> to render
>> (remove the venu_name and locale parameters and let Tapestry locate the
>> category/product page)
> 
> As stated above, you don't need to change the request, just ignore the  
> parameters you don't need.
> 
>> 2) Even if I was able to modify the Request, how
>> would I accomplish #2 above, so generated links would contain this data?
> 
> That's the hard part here. One solution is to remember to add the  
> parameters in the context of all PageLinks. Remember: the activation  
> context can have parameters that will be ignored. In this case, the  
> activation context would be a List, not a single value Most examples use  
> an id as the activation context, but that's not the only way to do it. A  
> more automated solution could be the decoration of the LinkFactory service  
> to automatically add the parameters. I haven't tested it, though.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: [T5] URL Manipulation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 05 Feb 2009 14:17:32 -0300, xfile80303 <le...@grokers.net> escreveu:

> Greetings all,

Hello! :)

> Specifically, I would like to manipulate the URLs such that I can have
> "nice" RESTful style URLs which feed information into the page ultimately
> being rendered.

Tapestry is incredibly RESTful, so I guess you don't have to do much to  
accomplish what you want. :)

> For example:
> /app/venue_name/en_US/category/product/UUID
> where product would be the rendering page, UUID could be the activation
> context (which, if I understand correctly T5 will handle already).   
> However, the "venue_name" and locale are not actual pages and are simply  
> information which is to be gleaned from the URL and passed to the page  
> so it can render as specified.

All you need to do is to ignore the venue_name and locale parameters.  
thedailytube.com, a website created by some guy in this list I always  
forget the name (I'm sorry . . .), does what you need in the video pages.  
Look at this URL:

http://www.thedailytube.com/video/15794/christian-bales-freak-out-remix

The video page uses the first parameter (15794) as the id of the video to  
be shown. The second parameter is there just for search engine purposes.  
Try http://www.thedailytube.com/video/15794/tapestry5rules. It gives you  
exactly the same page as the original URL. ;)

> As other posts have suggested, it would seem to me that any manipulation  
> of the URL would have to happen in such a way that Tapestry would  
> properly 1) parse these URL "parameters" and pass them into the system  
> for use by the
> page,

One advice is to use EventContext. It is a little hard to find in the  
documentation (EventContext section in  
http://tapestry.apache.org/tapestry5/guide/event.html), but any event  
handler method, including onActivate(), can have a single EventContext  
parameter. It provides you two methods: one with the parameter count,  
other that returns the value of the n-th parameter. Having an  
onActivate(EventContext context) method makes it really easy to deal with  
different parameters in the activation context, even optional parameters.



and 2) understand these "parameters" would need to be in Tapestry
> generated links to preserve this data from link to link (page to page).

> There has been mention of using a RequestFilter or a Dispatcher to do  
> this, but I have two concerns with this: 1) I am not sure how I would  
> modify the Request (at all?) so Tapestry internals would find the page  
> to render
> (remove the venu_name and locale parameters and let Tapestry locate the
> category/product page)

As stated above, you don't need to change the request, just ignore the  
parameters you don't need.

> 2) Even if I was able to modify the Request, how
> would I accomplish #2 above, so generated links would contain this data?

That's the hard part here. One solution is to remember to add the  
parameters in the context of all PageLinks. Remember: the activation  
context can have parameters that will be ignored. In this case, the  
activation context would be a List, not a single value Most examples use  
an id as the activation context, but that's not the only way to do it. A  
more automated solution could be the decoration of the LinkFactory service  
to automatically add the parameters. I haven't tested it, though.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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