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

 

Reply via email to