Sorry for flashy subject, but last time this question went into void, so ...
;)
And I'm pretty sure that any experienced Tapestry developer came upon this
problem.
Let's say I have custom service that does somethig, let's say for example
that it generates PDF. Meaning, this service calls some handler interface to
fetch PDF document instance for rendering (similar as IChartProvider
interface from Workbench that provides JChart instances). Something like:
public interface PdfHandler {
public PdfDocument getPdfDocument();
}
Of course, on user (page) side, there is special PdfLink component that
contains ServiceLink for calling this custom service.
It's all nice and easy, but problem is that my page that implements this
interface (provides PdfDocument), is dependant upon some parameter that was
paseed to it for rendering, but PDF generation is subsequent request and
page doesn't have this parameter anymore.
Now, I see 2 solutions, from which none is satisfying:
1. Interface should be something like:
public interface PdfHandler {
public PdfDocument getPdfDocument(IRequestCycle cycle);
}
thus I would be able to pass arbitrary parameters similar as DirectLink
does, and fetch it from IRequestCycle afterwards.
It's a bit uglier interface and problem is that there's no good example as
how to do it with ServiceLink...
2. I should make this needed parameter as "client" persisted page property,
thus it would persist till this subsequent request when I need to provide
PdfDocument. Interface stays clean using this aproach.
Problem with this second way is that I dunno how to do it when this
parameter is let's say primary key of some entity that is looping inside
some For component on this page?!
Is there some nice solution to this?
Regards,
Vjeran
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]