You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ville Virtanen <vi...@cerion.fi> on 2009/03/11 09:27:35 UTC

How to make link correctly

Hi,

Can I create page render link or component event link using public
interfaces?

Currently my code uses the internal LinkFactory which was changed to
LinkSource? And at one instance it was using PageRenderRequestParameters as
input but now again something else...

I do redirects in a very low level sometimes, so I cannot rely on T5 to
transform my String page name etc to correct url, so I do 

PageRenderRequestParameters prrp = new PageRenderRequestParameters(pageName,
new EmptyEventContext());

pageLink = linkFactory.createPageRenderLink(prrp);
response.sendRedirect(pageLink.toRedirectURI());

Is there a better way to do this?

Thanks in advance!
-- 
View this message in context: http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450579.html
Sent from the Tapestry - User 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: How to make link correctly

Posted by Francois Armand <fa...@linagora.com>.
Ville Virtanen wrote:
> Hi,
>
> as far as I know T5 still does not expose any service to create links the
> way we need to. I believe that the best solution is just to isolate the
> problem by creating a service to use when generating links. This way if the
> used T5 internal services change you have single point to correct in your
> application
>   
It's what I do for now, thanks for the answer.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
http://fanf42.blogspot.com
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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


Re: How to make link correctly

Posted by Ville Virtanen <vi...@cerion.fi>.
Hi,

as far as I know T5 still does not expose any service to create links the
way we need to. I believe that the best solution is just to isolate the
problem by creating a service to use when generating links. This way if the
used T5 internal services change you have single point to correct in your
application.

 - Ville 


Francois Armand wrote:
> 
> Ville Virtanen wrote:
>> Hi, [...]
>>   
> 
> Have you find any solution ? I have the same concern as you especially 
> when working with dispatcher that redirect to T5 pages under certain 
> condition.
> 
> -- 
> Francois Armand
> Etudes & Développements J2EE
> Groupe Linagora - http://www.linagora.com
> Tél.: +33 (0)1 58 18 68 28
> -----------
> http://fanf42.blogspot.com
> InterLDAP - http://interldap.org 
> FederID - http://www.federid.org/
> Open Source identities management and federation
> 
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/How-to-make-link-correctly-tp22450579p22615379.html
Sent from the Tapestry - User 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: How to make link correctly

Posted by Francois Armand <fa...@linagora.com>.
Ville Virtanen wrote:
> Hi, [...]
>   

Have you find any solution ? I have the same concern as you especially 
when working with dispatcher that redirect to T5 pages under certain 
condition.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
http://fanf42.blogspot.com
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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


Re: How to make link correctly

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Mar 11, 2009 at 10:01 AM, Andy Pahne <an...@googlemail.com> wrote:
> I see. Let me first admit that my wording

Now I follow you perfectly. :)

The issues you mentioned are very important, but the way I plan to
implement URL i18nization is using URL rewriting in a way that the
original, non i18n URLs are left unchanged and still work. i18n URLs
would be rewritten, not the original ones. This way, I guess the
issues are covered.

-- 
Thiago

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


Re: How to make link correctly

Posted by Andy Pahne <an...@googlemail.com>.
Thiago H. de Paula Figueiredo schrieb:
> On Wed, Mar 11, 2009 at 7:45 AM, Andy Pahne <an...@googlemail.com> wrote:
>   
>> This is an exceptionally good question. Links will have to be created
>> completly out of the web application context.
>>     
>
> Why? I'm not following you . . .
>
>   
>> I think this is going to be even more necessary, when the recent changes about URL i18n come into
>> play...
>>     
>
> I'm still not following you . . .
>
>   


I see. Let me first admit that my wording

    Links will have to be created completly out of the web application context

maybe doesn't hit the point. Let it phrase me like this.

I have a couple of use cases where it appears to be necessary to create 
links into a tapestry application that uses i18nized URLs. These are:

   - links from old legacy apps (Struts, T4 and even one T3 still in 
production and maintained)
   - links from a BIRT reporting application
   - links in a newsletter that features our two brand new and improved 
T5 apps

I would like to see these use cases covered.


Andy









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


Re: How to make link correctly

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Mar 11, 2009 at 7:45 AM, Andy Pahne <an...@googlemail.com> wrote:
> This is an exceptionally good question. Links will have to be created
> completly out of the web application context.

Why? I'm not following you . . .

> I think this is going to be even more necessary, when the recent changes about URL i18n come into
> play...

I'm still not following you . . .

-- 
Thiago

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


Re: How to make link correctly

Posted by Andy Pahne <an...@googlemail.com>.

This is an exceptionally good question. Links will have to be created 
completly out of the web application context. I think this is going to 
be even more necessary, when the recent changes about URL i18n come into 
play...

Andy



Peter Stavrinides schrieb:
> I see... I am aware of ComponentClassResolver that you can look at to help you construct the links and resolve valid page names. 
>
> Peter
>
>
> ----- Original Message -----
> From: "Ville Virtanen" <vi...@cerion.fi>
> To: users@tapestry.apache.org
> Sent: Wednesday, 11 March, 2009 10:53:56 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
> Subject: Re: How to make link correctly
>
>
> Thanks for the reply,
>
> Let me rephrase :) What is the best practice for creating
> org.apache.tapestry5.Link instances if I have the page class at my disposal?
>
> I see that component resources are not internal and provide functionality I
> need, but is it ok to use the service without any component or page? The
> name strongly suggest that this service should be only injected to a page or
> component and used there?
>
> Can I use it safely in another service, or in AppModule or filter?
>
>  - Ville
>
>
> Peter Stavrinides wrote:
>   
>> Yes, see org.apache.tapestry5.ComponentResources:
>> Link link = resources.createPageLink(_page, false, _context);
>>
>> There are a number of ways to construct a link in Tapestry, choose whats
>> best for you. From an event you can return a class a Tapestry Page Object
>> a URI or a Link object, have I missed any?
>>
>> cheers,
>> Peter 
>> ----- Original Message -----
>> From: "Ville Virtanen" <vi...@cerion.fi>
>> To: users@tapestry.apache.org
>> Sent: Wednesday, 11 March, 2009 10:27:35 GMT +02:00 Athens, Beirut,
>> Bucharest, Istanbul
>> Subject: How to make link correctly
>>
>>
>> Hi,
>>
>> Can I create page render link or component event link using public
>> interfaces?
>>
>> Currently my code uses the internal LinkFactory which was changed to
>> LinkSource? And at one instance it was using PageRenderRequestParameters
>> as
>> input but now again something else...
>>
>> I do redirects in a very low level sometimes, so I cannot rely on T5 to
>> transform my String page name etc to correct url, so I do 
>>
>> PageRenderRequestParameters prrp = new
>> PageRenderRequestParameters(pageName,
>> new EmptyEventContext());
>>
>> pageLink = linkFactory.createPageRenderLink(prrp);
>> response.sendRedirect(pageLink.toRedirectURI());
>>
>> Is there a better way to do this?
>>
>> Thanks in advance!
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450579.html
>> Sent from the Tapestry - User 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
>>
>>
>>
>>     
>
>   


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


Re: How to make link correctly

Posted by Peter Stavrinides <P....@albourne.com>.
I see... I am aware of ComponentClassResolver that you can look at to help you construct the links and resolve valid page names. 

Peter


----- Original Message -----
From: "Ville Virtanen" <vi...@cerion.fi>
To: users@tapestry.apache.org
Sent: Wednesday, 11 March, 2009 10:53:56 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: How to make link correctly


Thanks for the reply,

Let me rephrase :) What is the best practice for creating
org.apache.tapestry5.Link instances if I have the page class at my disposal?

I see that component resources are not internal and provide functionality I
need, but is it ok to use the service without any component or page? The
name strongly suggest that this service should be only injected to a page or
component and used there?

Can I use it safely in another service, or in AppModule or filter?

 - Ville


Peter Stavrinides wrote:
> 
> Yes, see org.apache.tapestry5.ComponentResources:
> Link link = resources.createPageLink(_page, false, _context);
> 
> There are a number of ways to construct a link in Tapestry, choose whats
> best for you. From an event you can return a class a Tapestry Page Object
> a URI or a Link object, have I missed any?
> 
> cheers,
> Peter 
> ----- Original Message -----
> From: "Ville Virtanen" <vi...@cerion.fi>
> To: users@tapestry.apache.org
> Sent: Wednesday, 11 March, 2009 10:27:35 GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: How to make link correctly
> 
> 
> Hi,
> 
> Can I create page render link or component event link using public
> interfaces?
> 
> Currently my code uses the internal LinkFactory which was changed to
> LinkSource? And at one instance it was using PageRenderRequestParameters
> as
> input but now again something else...
> 
> I do redirects in a very low level sometimes, so I cannot rely on T5 to
> transform my String page name etc to correct url, so I do 
> 
> PageRenderRequestParameters prrp = new
> PageRenderRequestParameters(pageName,
> new EmptyEventContext());
> 
> pageLink = linkFactory.createPageRenderLink(prrp);
> response.sendRedirect(pageLink.toRedirectURI());
> 
> Is there a better way to do this?
> 
> Thanks in advance!
> -- 
> View this message in context:
> http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450579.html
> Sent from the Tapestry - User 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450865.html
Sent from the Tapestry - User 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: How to make link correctly

Posted by Ville Virtanen <vi...@cerion.fi>.
Thanks for the reply,

Let me rephrase :) What is the best practice for creating
org.apache.tapestry5.Link instances if I have the page class at my disposal?

I see that component resources are not internal and provide functionality I
need, but is it ok to use the service without any component or page? The
name strongly suggest that this service should be only injected to a page or
component and used there?

Can I use it safely in another service, or in AppModule or filter?

 - Ville


Peter Stavrinides wrote:
> 
> Yes, see org.apache.tapestry5.ComponentResources:
> Link link = resources.createPageLink(_page, false, _context);
> 
> There are a number of ways to construct a link in Tapestry, choose whats
> best for you. From an event you can return a class a Tapestry Page Object
> a URI or a Link object, have I missed any?
> 
> cheers,
> Peter 
> ----- Original Message -----
> From: "Ville Virtanen" <vi...@cerion.fi>
> To: users@tapestry.apache.org
> Sent: Wednesday, 11 March, 2009 10:27:35 GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: How to make link correctly
> 
> 
> Hi,
> 
> Can I create page render link or component event link using public
> interfaces?
> 
> Currently my code uses the internal LinkFactory which was changed to
> LinkSource? And at one instance it was using PageRenderRequestParameters
> as
> input but now again something else...
> 
> I do redirects in a very low level sometimes, so I cannot rely on T5 to
> transform my String page name etc to correct url, so I do 
> 
> PageRenderRequestParameters prrp = new
> PageRenderRequestParameters(pageName,
> new EmptyEventContext());
> 
> pageLink = linkFactory.createPageRenderLink(prrp);
> response.sendRedirect(pageLink.toRedirectURI());
> 
> Is there a better way to do this?
> 
> Thanks in advance!
> -- 
> View this message in context:
> http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450579.html
> Sent from the Tapestry - User 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450865.html
Sent from the Tapestry - User 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: How to make link correctly

Posted by Peter Stavrinides <P....@albourne.com>.
Yes, see org.apache.tapestry5.ComponentResources:
Link link = resources.createPageLink(_page, false, _context);

There are a number of ways to construct a link in Tapestry, choose whats best for you. From an event you can return a class a Tapestry Page Object a URI or a Link object, have I missed any?

cheers,
Peter 
----- Original Message -----
From: "Ville Virtanen" <vi...@cerion.fi>
To: users@tapestry.apache.org
Sent: Wednesday, 11 March, 2009 10:27:35 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: How to make link correctly


Hi,

Can I create page render link or component event link using public
interfaces?

Currently my code uses the internal LinkFactory which was changed to
LinkSource? And at one instance it was using PageRenderRequestParameters as
input but now again something else...

I do redirects in a very low level sometimes, so I cannot rely on T5 to
transform my String page name etc to correct url, so I do 

PageRenderRequestParameters prrp = new PageRenderRequestParameters(pageName,
new EmptyEventContext());

pageLink = linkFactory.createPageRenderLink(prrp);
response.sendRedirect(pageLink.toRedirectURI());

Is there a better way to do this?

Thanks in advance!
-- 
View this message in context: http://www.nabble.com/How-to-make-link-correctly-tp22450579p22450579.html
Sent from the Tapestry - User 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