Thanks Sergey,
It works now when wrapping a PNG byte[] in a ByteArrayInputStream. 
It doesn't work wrapping a JPEG byte[]. I guess thats a problem with
the image encoder - nothing to do with CXF at all. I could create
download, save it and look at it with PaintShop Pro and it was 
fine, but it wouldn't load in iether IE or firefox as a JPEG. 

Mission accomplished!
Thanks again.
Doug


On Thu, 1 May 2008, Sergey Beryozkin wrote:
> Hi
>
> byte[] is supported by a BinaryDataProvider so it should be fine, though I
> have to admit there's no system test at the moment verifying the byte blob
> can be received fine. There's definitely an os.write((byte[])o) there.
>
> InputStream and File as return types are also supported so can you try,
> just for a test, see if wrapping the generated byte[] in either
> ByteArrayInputStream or File (with saving byte[] to the disk first) helps.
>
> As far as the byte[] itself is concerned, is there any way to verify that
> the image is actualy has been generated without errors in the first place ?
>
> Cheers, Sergey
>
> >I have been using CXF 2.1 to do the JSR-311 thing and its
> > been working pretty well.
> > Now I would like to serve up a generated image (JPG/PNG) as the
> > URL target (actually its a graph created with JFreeChart).
> >
> > @GET
> > @Path("graph/{clientId}/image.png")
> > @ProduceMime("image/png")
> > public SOMETHING graph(@UriParam("clientId") String id,
> >                 @HttpContext UriInfo info) { ... }
> >
> > My image is generated in the form of a byte[] array.
> > I am just wondering if its ok to replace "SOMETHING"
> > in the above with byte[] or should it be massaged into
> > some other form?
> >
> > When I try to dynamically embed into a webpage it doesn't show up.
> > node.innerHTML = "<p><img src='" + url +"' height='200' width='300'
> > alt='a graph'/></p>";
> >
> > If I download explicitly within Firefox I get
> > The image "http://...../graph/zubegu/image.png"; cannot be displayed
> > because it contains errors.
> > If I hit save page as then the image downloads, saves and opens
> > in an external viewer just fine.
> >
> > Not sure whats going wrong here.
> > There seems to be no problems server side.
> >
> > Thanks
> > Doug
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Reply via email to