You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonny Wray <jo...@yahoo.com> on 2004/06/16 19:59:54 UTC

NullPointerException in DirectService.getLink

Hi,

My code:

IRequestCycle cycle = page.getRequestCycle();
IEngine engine = cycle.getEngine();
IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
ILink link = service.getLink(cycle, form, params);

produces a NPE within getLink. I looked at the code at it's this line:

if (complex)
   context[i++] = renderPage.getPageName();

I reproduced it directly in my code with:

log.debug("Page: "+cycle.getPage().getPageName());

cycle.getPage() is returning null, and I have no idea why. I've checked
cycle, engine and service. They are not null and returning correct
identifying strings. Any ideas as to what I am missing here?

thanks,
Jonny



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


RE: NullPointerException in DirectService.getLink

Posted by Jonny Wray <jo...@yahoo.com>.
Hmm, I'm not sure what you mean by not using a Tapestry page. The
service method of my SVGService does get a page from the request cycle
and then passes it's reference to the class that actually produces the
svg image (and contains the code fragments I listed).

I need a url that invokes a listener on the containing page, with
specific data dependent parameters. I thought that means need to use a
DirectService to obtain those URLs.

Looks like I need to go read about services more.

--- "Howard M. Lewis Ship" <hl...@comcast.net> wrote:
> You are implementing a service that does not use a Tapestry page ...
> that's why cycle.getPage()
> returns null.  You might need to use a different service or create
> one of your own to fit your
> needs.
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> http://howardlewisship.com
> 
> 
> > -----Original Message-----
> > From: Jonny Wray [mailto:jonny_wray@yahoo.com] 
> > Sent: Wednesday, June 16, 2004 2:00 PM
> > To: Tapestry users
> > Subject: NullPointerException in DirectService.getLink
> > 
> > 
> > 
> > Hi,
> > 
> > My code:
> > 
> > IRequestCycle cycle = page.getRequestCycle();
> > IEngine engine = cycle.getEngine();
> > IEngineService service =
> engine.getService(Tapestry.DIRECT_SERVICE);
> > ILink link = service.getLink(cycle, form, params);
> > 
> > produces a NPE within getLink. I looked at the code at it's this
> line:
> > 
> > if (complex)
> >    context[i++] = renderPage.getPageName();
> > 
> > I reproduced it directly in my code with:
> > 
> > log.debug("Page: "+cycle.getPage().getPageName());
> > 
> > cycle.getPage() is returning null, and I have no idea why. 
> > I've checked
> > cycle, engine and service. They are not null and returning correct
> > identifying strings. Any ideas as to what I am missing here?
> > 
> > thanks,
> > Jonny
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


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


RE: NullPointerException in DirectService.getLink

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
You are implementing a service that does not use a Tapestry page ... that's why cycle.getPage()
returns null.  You might need to use a different service or create one of your own to fit your
needs.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: Jonny Wray [mailto:jonny_wray@yahoo.com] 
> Sent: Wednesday, June 16, 2004 2:00 PM
> To: Tapestry users
> Subject: NullPointerException in DirectService.getLink
> 
> 
> 
> Hi,
> 
> My code:
> 
> IRequestCycle cycle = page.getRequestCycle();
> IEngine engine = cycle.getEngine();
> IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
> ILink link = service.getLink(cycle, form, params);
> 
> produces a NPE within getLink. I looked at the code at it's this line:
> 
> if (complex)
>    context[i++] = renderPage.getPageName();
> 
> I reproduced it directly in my code with:
> 
> log.debug("Page: "+cycle.getPage().getPageName());
> 
> cycle.getPage() is returning null, and I have no idea why. 
> I've checked
> cycle, engine and service. They are not null and returning correct
> identifying strings. Any ideas as to what I am missing here?
> 
> thanks,
> Jonny
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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