First of all thanks for the replies. I copy my code if anyone is useful

ImagenDetails.tml

   ${uploadedImage} 

ImagenDetails.java

 @InjectPage
     private ShowImagePage showImagePage;
@Property
        private Imagen imagen;

 public Link getUploadedImage(){
                    return showImagePage.getUploadedFile(imagen.getImagenId());
                } 

//Imagen is a entity with a property call ImagenId.


 showImagePage.java 
public class ShowImagePage {

    @Inject
    private LinkSource linkSource;
    
    @Inject
   private EstudioService estudioService;
   
   private String contentType = "image/jpeg";// this is the default

   private String extension = "jpg";

    private  String filename = "default";
    
    public Link getUploadedFile(String imageId) {
            return
linkSource.createPageRenderLink(ShowImagePage.class.getSimpleName(),false,
new Object[]{imageId});
    }

    public StreamResponse onActivate(final String imageId) {
                this.filename = imageId;
                return new StreamResponse() {

                    public String getContentType() {
                        return contentType;
                    }

                    public InputStream getStream() throws IOException {
                        Imagen imagen=null;
                        try {
                                                imagen = 
estudioService.findImagen(imageId);
                                                
                                        } catch (InstanceNotFoundException e) {
                                                // TODO Auto-generated catch 
block
                                                e.printStackTrace();
                                        }
                        return estudioService.dicom2jpg(imagen.getNombreFich());
                  //dicom2jpg is a function that return a InputStream from a
.dcm file. 
                    }

                    public void prepareResponse(Response response) {
                        response.setHeader("Content-Disposition",
"inline;filename=" + filename+ ((extension == null) ? "" : ("."
+extension)));
                    }
                        
        };
    }
    
 } 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5714662.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to