You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Long <st...@gmail.com> on 2007/05/07 05:30:42 UTC

Re: Tap4 IEngineService & IAsset issues

Hi,

The trick is to just pass in the parts that the service needs to get
whatever is you need, like you mentioned, the id.

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-archetype/src/main/resources/archetype-resources/src/main/java/services/RoundedCornerService.java?view=markup

shows a service that does something based on a small paramter (a string, not
a whole object)

That service is also using an object injected from Spring (not sure that
youre using Spring, but its configuration is one example of getting at
external resources  (like databases) rom a service.) which is configured
here
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/hivemodule.xml?revision=533563&view=markup
(at the bottom).

And, finally, actually calling the service is demo'ed here:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-archetype/src/main/resources/archetype-resources/src/main/java/components/widgets/RoundedCorner.java?revision=533563&view=markup

The whole bit about getServiceParameters() shows passing arbitrary params
(in your case, imagine the id).

Hope that helps some, and apologies for the late response...

-- 
Joshua Long
Sun Certified Java Programmer
http://www.joshlong.com/

On 4/30/07, Norman Franke <no...@myasd.com> wrote:
>
> Based on the Tap4 Workbench ChartService example, I've created a
> similar service that fetches pictures from a database. I encountered
> two issues that I can't figure out:
>
> 1. The URLs generated for the picture are extremely long. I assume
> this is because it's serializing my page state (where the picture
> lives). Is there a way to have it just include the primary key of the
> table instead of everything client persisted on that page? (I persist
> the database row to implement first-write-wins updating.)
>
> 2. A more puzzling problem is if a picture can't be found (doesn't
> exist in the database), I want to instead send a default "no picture
> available" image. How do I get either a InputStream or File to this
> image stored in WEB-INF from the IEngineSerivce service() menthod?
>
> Thanks!
> Norman
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>