Image Cache and Scale

I have a probelm , I have a gallary of pictures with a big sizes , this pictures are on disk outside the application
I want to :
1-scale image before displaying ( I have a scale servlet to do this scale but i canot call it)
2-but scaling happens one time not every time (maybe caching it but how)

I try to do that

FileResource imageResource = new FileResource(new File("/scale?picPath="+picturePath),

		Embedded picture = new Embedded(null, imageResource);
	/scale to call the the scale servlet which is mapped but it failed

any idea to scale image before displaying and cache it to reuse again

Hi! Maybe you could resize (and cache) images using

thanks Sami Ekblad, I want to cach image with disk folder not with ram

also how can i override this (resource mapping in application class)

important question ;
I note that
in application class

public void addResource(ApplicationResource resource) {

        // Check if the resource is already mapped
        if (resourceKeyMap.containsKey(resource)) {

        // Generate key
        final String key = String.valueOf(++lastResourceKeyNumber);

        // Add the resource to mappings
        resourceKeyMap.put(resource, key);
        keyResourceMap.put(key, resource);
    if (resourceKeyMap.containsKey(resource)) // When this condition is true , i never see it true when reloading image????????

thank you guys for sharing!