Hello all,

I need to check the existence of an image in a  folder.

Here is what I first did  :

@Inject
@Path("context:images/folder")
private Asset imageFolder ;

public boolean isExists() {
   Resource image = imageFolder.getResource().forFile(getImageName()) ;
   return image.exists() ;
}

What I expect is image to point to context:images/folder/myimage.jpg, but it does not and this method always return false. In fact the "folder" part of the path is not present in the image resource, which is : context:images/myimage.jpg.

Now I'm not sure if this is a bug or if I'm wrong on the way forFile() is supposed to work. So any hint would be appreciated.

Thank you,

José

PS : btw there is a workaround, I'm not too happy with it :
String imageFilename = imageFolder.getResource().toURL().getFile() + getImageName() ;
File imageFile = new File(imageFilename) ;
return imageFile.exists() && imageFile.canRead() ;




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

Reply via email to