You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexander Reelsen <al...@emplify.de> on 2009/10/15 23:11:04 UTC

Question regarding complex URL rewriting and injecting

Hi,

after reading the new german book on Tapestry I am thinking to take a
closer look at it. It is a very nice and clean structured book, which
can be read quite easily at a rainy weekend. Very well done.

One question I could not figure out from the book is a question
regarding complex url redirects. With complex I mean injecting certain
properties based on the url (like spring 3 supports with its
requestmapping annotation and using expression language like

@RequestMapping(value="/{tenant}/{user}/reservations/{id}",
method=RequestMethod.GET)

Is is possible to do something like this with tapestry as well, like
injecting the specific tenant, user and reservation into the page
(which in this case means the user is dependant from the tenant and
the reservation id from the user)?

My first guess would be to write an own ComponentEventDispatcher for
this, but any help or insight is greatly appreciated.

Thanks and have a nice day!


--Alexander

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


Re: Question regarding complex URL rewriting and injecting

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 16 Oct 2009 04:28:57 -0300, Alexander Reelsen <al...@emplify.de>  
escreveu:

> This is exactly what I want. But why does this not go "in line" with my
> url rewriting question? If I have three parameters for the onactivate,
> where else instead of the url are those constructed of?

That's what Tapestry calls the activation context. When creating an  
EventLink or ActionLink, use the context parameter to provide the  
activation context. You can pass an object or a List or array of them.  
Tapestry asks the activation context of a given page at a given time by  
invoking the page's onPassivate() method, if it exists. That's where the  
magic happens. :)

-- 
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


Re: Question regarding complex URL rewriting and injecting

Posted by Alexander Reelsen <al...@emplify.de>.
Hi Igor

> On Thu, Oct 15, 2009 at 11:11 PM, Alexander Reelsen <al...@emplify.de>
> wrote:

>> @RequestMapping(value="/{tenant}/{user}/reservations/{id}",
>> method=RequestMethod.GET)
>>
> URL rewrittng is indeed not covered by the book. It is not possible in
> Tapestry to map different methods of a page to different paths. Event
> handler path is an exception.
Hm. I'm slightly confused now. More below :-)

>> Is is possible to do something like this with tapestry as well, like
>> injecting the specific tenant, user and reservation into the page
>> (which in this case means the user is dependant from the tenant and
>> the reservation id from the user)?
> As Thiago already pointed out, you can provide activation methods with
> several params.
>
> void onActivate(Tenant tenant, User user, Long id)
>
> Is it what you are looking for?
This is exactly what I want. But why does this not go "in line" with my
url rewriting question? If I have three parameters for the onactivate,
where else instead of the url are those constructed of? Do I need some
magic number in the url which represents the combination of tenant, user
and reservation in my case?

Thanks to all for the quick replies.


--Alexander


-- 
http://www.emplify.de


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


Re: Question regarding complex URL rewriting and injecting

Posted by Igor Drobiazko <ig...@gmail.com>.
Hi Alexander,

On Thu, Oct 15, 2009 at 11:11 PM, Alexander Reelsen <al...@emplify.de> wrote:

> Hi,
>
> after reading the new german book on Tapestry I am thinking to take a
> closer look at it. It is a very nice and clean structured book, which
> can be read quite easily at a rainy weekend. Very well done.
>

It's nice to read some feedback from readers. Thanks!. I'm really happy that
the book made you take a closer look at Tapestry. This is the most wonderful
feadback. This is why I wrote the book. Thus it was worth to write it. :)

>
> One question I could not figure out from the book is a question
> regarding complex url redirects. With complex I mean injecting certain
> properties based on the url (like spring 3 supports with its
> requestmapping annotation and using expression language like
>
> @RequestMapping(value="/{tenant}/{user}/reservations/{id}",
> method=RequestMethod.GET)
>

URL rewrittng is indeed not covered by the book. It is not possible in
Tapestry to map different methods of a page to different paths. Event
handler path is an exception.

>
> Is is possible to do something like this with tapestry as well, like
> injecting the specific tenant, user and reservation into the page
> (which in this case means the user is dependant from the tenant and
> the reservation id from the user)?
>

As Thiago already pointed out, you can provide activation methods with
several params.

void onActivate(Tenant tenant, User user, Long id)

Is it what you are looking for?

>
> My first guess would be to write an own ComponentEventDispatcher for
> this, but any help or insight is greatly appreciated.
>
> Thanks and have a nice day!
>
>
> --Alexander
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko

Re: Question regarding complex URL rewriting and injecting

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 15 Oct 2009 18:11:04 -0300, Alexander Reelsen <al...@emplify.de>  
escreveu:

> Hi,

Hi!

> One question I could not figure out from the book is a question
> regarding complex url redirects. With complex I mean injecting certain
> properties based on the url (like spring 3 supports with its
> requestmapping annotation and using expression language like

Tapestry supports URL rewriting out-of-the-box:  
http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html. Of  
course, you'll need to provide the rewriting logic, and Tapestry does the  
rest.

But what you're describing seems to be more related to activation context  
than URL rewriting itself.

> Is is possible to do something like this with tapestry as well, like
> injecting the specific tenant, user and reservation into the page
> (which in this case means the user is dependant from the tenant and
> the reservation id from the user)?

This looks like the activation context:  
http://tapestry.apache.org/tapestry5.1/guide/pagenav.html, session Page  
Activation.

-- 
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