Hi,

Our application needs show a list of image stored in database.  We implemented
a EngineService to stream images in DB to the page, just like the ChartService
did in the Tapestry sample application Workbench.  Separately, it is
working fine.
But here is problem when I put it in a Foreach component.

Briefly our implementation like following:

// service define in .application
<service name="StreamImage" class="com.company.service.StreamImageService"/>

// StreamImageService is similar to ChartService

// StreamImageAsset is similar to Chart

// ImageProvider is similar to IChartProvider have the method to the
image as byte[]
public byte[] getImage();

// html.
<table jwcid="@Foreach" source="ognl:images" value="ognl:eachImage">
<tr><td>Name:</td>
      <td><span jwcid="@Insert" value="ognl:eachImage.name"/></td>
</tr>
<tr><td colspan="2"><span jwcid="@Image" image="ognl:imageContent"/></td>
</tr>
</table>

// page specification.
<property-specification name="eachImage" type="com.company.ImageDescriptor"
/>

// page class implements ImageProvider

  public abstract ImageDescriptor getEachImage();

  /**
   * return all images as a List.
   */
  public List getImages() {
       ....
  }

  public byte[] getImage() {

       String name = getEachImage().getName();  /// ---> here causes
problem in Foreach.
       //... get image from database based on the name.
       // stream it to byte[]

   /**
    * the image asset.
    */
   public IAsset getImageContent() {

       return new StreamImageAsset(getPage().getRequestCycle(), this);
   }

But the problem is the return of getEachImage() in method public
byte[] getImage()
of Page class is Null!  I can get each image name as the Insert
Component did,  BUT
I can not get each image for the Image component because we use an
engine service
to create the IAsset?  Why? How to solve it?

Any idea?

Thanks a lot
",1]);D(["mb","
Sean
",0]);D(["ce"]);D(["ms","2248"]);//-->  }

  /**
   * the image asset.
   */
  public IAsset getImageContent() {

      return new StreamImageAsset(getPage().getRequestCycle(), this);
  }

But the problem is the return of getEachImage() in method public
byte[] getImage()
of Page class is Null!  I can get each image name as the Insert
Component did,  BUT
I can not get each image for the Image component because we use an
engine service
to create the IAsset?  Why? How to solve it?

Any idea?

Thanks a lot

Sean 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to