You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2009/03/31 11:54:58 UTC
t5: create a page link inside a service
Hi,
I'd like to createPageLink inside a services, but ComponentResource can't be
injected into a service, any other way around? Thanks,
Angelo
--
View this message in context: http://www.nabble.com/t5%3A-create-a-page-link-inside-a-service-tp22801831p22801831.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: t5: create a page link inside a service
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Did my e-mail from almost 15 hours ago not get through to everyone on
the list? :P
To quote myself, "Inject the ComponentSource service, get a page from
it, then get its ComponentResources."
I've got a dedicated service for this, it gets the ComponentResources of
the page you want to link to from the ComponentSource, which has the
added benefit of ensuring that you're linking to a valid page.
Here's the relevant code (for 5.0.18):
private final ComponentClassResolver componentClassResolver;
private final ComponentSource componentSource;
public RedirectServiceImpl(ComponentClassResolver
componentClassResolver, ComponentSource componentSource) {
this.componentClassResolver = componentClassResolver;
this.componentSource = componentSource;
}
public Link createPageLink(Class<?> pageClass, boolean override,
Object... context) {
String pageName =
componentClassResolver.resolvePageClassNameToPageName(pageClass.getCanonicalName());
return
componentSource.getPage(pageName).getComponentResources().createPageLink(pageName,
override, context);
}
You can, of course, do the same for events etc.
/Filip
On 2009-03-31 23:21, Angelo Chen wrote:
> Thanks, but that works for 5.1.x, not for 5.0.18. I'm eagerly expecting the
> release of 5.1.x stable version.
>
>
> Howard Lewis Ship wrote:
>> http://tapestry.formos.com/nightly/tapestry5/faq/general.html#create-page-link-from-service
>>
>> On Tue, Mar 31, 2009 at 2:54 AM, Angelo Chen <an...@yahoo.com.hk>
>> wrote:
>>> Hi,
>>>
>>> I'd like to createPageLink inside a services, but ComponentResource can't
>>> be
>>> injected into a service, any other way around? Thanks,
>>>
>>> Angelo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQEcBAEBAgAGBQJJ0rqJAAoJEEfiH7PpjaMnKqYIAKoto5n15bm73SjdEKYewlZZ
F8sgeoHyj1mAIP8xOLH0d5g9PVffYMlMWTWPyJ+JnDS06dy86/mfgDXOEvBaVuBG
8HHtEiVSwTaNZeE8Z2GOljSH4pMYH2KXsOkWwiI/r7mQWD0IDznNEpDkNx250x2q
fkpRGtFWqAchdEj7yRNIGBt9QjgSCstjrXjIJ24IXD+xleHRL3vdJ+4ua2K46/Cc
sykyzmr5eZd53eszXtw3kl6occq2Gg5SPGpBOh2WzG3++KjDu3ncohe0bT312BdW
frMC8hqv+DTQOWauvVC8PQempEglao13Dd97AgnRtrfffw0lPFRvL8iS9jqNCEA=
=BxpZ
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: t5: create a page link inside a service
Posted by Angelo Chen <an...@yahoo.com.hk>.
Thanks, but that works for 5.1.x, not for 5.0.18. I'm eagerly expecting the
release of 5.1.x stable version.
Howard Lewis Ship wrote:
>
> http://tapestry.formos.com/nightly/tapestry5/faq/general.html#create-page-link-from-service
>
> On Tue, Mar 31, 2009 at 2:54 AM, Angelo Chen <an...@yahoo.com.hk>
> wrote:
>>
>> Hi,
>>
>> I'd like to createPageLink inside a services, but ComponentResource can't
>> be
>> injected into a service, any other way around? Thanks,
>>
>> Angelo
>> --
>> View this message in context:
>> http://www.nabble.com/t5%3A-create-a-page-link-inside-a-service-tp22801831p22801831.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
>>
>>
>
>
>
> --
> 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://www.nabble.com/t5%3A-create-a-page-link-inside-a-service-tp22801831p22813929.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: t5: create a page link inside a service
Posted by Howard Lewis Ship <hl...@gmail.com>.
http://tapestry.formos.com/nightly/tapestry5/faq/general.html#create-page-link-from-service
On Tue, Mar 31, 2009 at 2:54 AM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi,
>
> I'd like to createPageLink inside a services, but ComponentResource can't be
> injected into a service, any other way around? Thanks,
>
> Angelo
> --
> View this message in context: http://www.nabble.com/t5%3A-create-a-page-link-inside-a-service-tp22801831p22801831.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
>
>
--
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: create a page link inside a service
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Angelo,
Inject the ComponentSource service, get a page from it, then get its
ComponentResources.
/Filip
On 2009-03-31 11:54, Angelo Chen wrote:
> Hi,
>
> I'd like to createPageLink inside a services, but ComponentResource can't be
> injected into a service, any other way around? Thanks,
>
> Angelo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQEcBAEBAgAGBQJJ0ejpAAoJEEfiH7PpjaMnnS0H/2h9BG8wI6ZuE7+qKa5mVrpg
R2MsDTXUlS3qAYabGxmgCK1EIB+ROrOCkP6iHLfHPNm1bpbcuDudZUtgBrs1GX2h
Q0bo6azcWn5ZqkFpqVmZaRbdgaeM7wx1poNI99gH4mwwNl8ITi3NPRpIne6pJCFd
gXsPMz9TEHy2+ii+R1E5OFRCfGBJV3CvU5bAbyNGq3qGtMAsqCvwvVsiMCfvLK2E
8XghA7L8bgV4qysiI+2LMN+Ov7rpsyqnry+wUmrGk7b+0fDNYQTTl9RQjrYTeF0v
ofvY/DoEtrOVwq3sYaE+o1SqR+P7bFyXmhsHJh/ymyHqWlWKxHonke0g40Bapzs=
=Krzu
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org