I managed to get the Registry by overriding the ApplicationServlet and i'm able to get the external service. However, it is not clear, when it is correct to invoke externalService.getLink(). If it is invoked just after ApplicationServlet.init() it fails with exception: org.apache.hivemind.ApplicationRuntimeException: Unable to construct service tapestry.url.LinkFactory: Error building service tapestry.url.LinkFactory Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to read property contextPath of object <SingletonProxy for tapestry.Infrastructure( org.apache.tapestry.services.Infrastructure)>:... java.lang.reflect.InvocationTargetException... Caused by: java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for tapestry.globals.RequestGlobals( org.apache.tapestry.services.RequestGlobals)> is null.
I can get the link if i invoke getLink later.. when some page was initialized. Valdemaras Repšys On 7/18/06, James Carman <[EMAIL PROTECTED]> wrote:
If you can get to the HiveMind registry, you can lookup the ExternalService and use it. -----Original Message----- From: Valdemaras Repšys [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 18, 2006 8:27 AM To: Tapestry users Subject: Re: external link to a tapestry page Thanks for the answer, Aleksej. The problem is, this URL must be generated on a java thread (or class) that is not an instance of BasePage and is not a tapestry page. That means i have no access to ExternalService, right? Also, I can't use @Any component because this url will be sent as an email to the user (as a simple text). Valdemaras Repšys On 7/18/06, Aleksej <[EMAIL PROTECTED]> wrote: > > Valdemaras Repšys wrote: > > Hi, > > i need my application to send emails with the link to the specific > > tapestry > > page. How would i generate a link? > > > > I tried extending a page with IExternalPage and using the address: > > http://localhost:8080/BioJazz/app?service=external/HitList > > What i get is RuntimeException: No engine service named > > 'external/HitList' > > is available. > > > > Link (as in ExternalService API doc): > > http://localhost:8080/BioJazz/app?service=external&context=HitList > > gives a > > null pointer exception: > > > > - org.apache.hivemind.util.Defense.notNull(Defense.java:41) > > - > > org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:242) > > > > - org.apache.tapestry.engine.ExternalService.service( > > ExternalService.java:144) > > - > $IEngineService_10c8121ee8c.service($IEngineService_10c8121ee8c.java) > > > > > > Any hint? > > Thanks, > > Valdemaras Repšys > > > Do not form links manually, use "tapestry.services.External" service ( > in your case ). > First inject it into your page with something like: > <inject property="externalService" > object="service:tapestry.services.External" /> in your page file. > Be sure that you have a externalService property getter like: > public abstract IEngineService getExternalService(); > Then, when you need to generate link, just use > "org.apache.tapestry.engine.ExternalServiceParameter" > to generate your page parameters ( name and Object[] ) and call > getExternalService().getLink( your parameter object ). > This will return ILink object and you will be able to call > getAbsoluteURL on it, which will return required Link as a string. > On the page you can probably put it using @Any component, like: > <a jwcid="@Any" href="yourLink">go go go</a> > ------------- > GL > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]