package net.jawr.resource.generator;

import java.io.InputStream;

import javax.servlet.ServletContext;

import net.jawr.web.resource.bundle.generator.GeneratorContext;
import net.jawr.web.resource.bundle.generator.ResourceGenerator;
import net.jawr.web.resource.bundle.generator.StreamResourceGenerator;
import net.jawr.web.resource.bundle.generator.resolver.PrefixedPathResourceGeneratorResolver;
import net.jawr.web.resource.bundle.generator.resolver.ResourceGeneratorResolver;

public class SampleImageGenerator implements StreamResourceGenerator {

	/* (non-Javadoc)
	 * @see net.jawr.web.resource.bundle.generator.StreamResourceGenerator#createResourceAsStream(net.jawr.web.resource.bundle.generator.GeneratorContext)
	 */
	public InputStream createResourceAsStream(GeneratorContext context) {
		
		ServletContext servletContext = context.getConfig().getContext();
		return servletContext.getResourceAsStream("/img/"+context.getPath());
	}

	/* (non-Javadoc)
	 * @see net.jawr.web.resource.bundle.generator.BaseResourceGenerator#getResolver()
	 */
	@Override
	public ResourceGeneratorResolver getResolver() {
		return new PrefixedPathResourceGeneratorResolver("img");
	}

	/* (non-Javadoc)
	 * @see net.jawr.web.resource.bundle.generator.BaseResourceGenerator#getDebugModeRequestPath()
	 */
	@Override
	public String getDebugModeRequestPath() {
		return ResourceGenerator.IMG_DEBUGPATH;
	}

}

@@ -557,24 +557,240 @@
 erator %7B%0D%0A%0D%0A
+%09/** The generator resolver */%0D%0A%09private ResourceGeneratorResolver resolver;%0D%0A%09%0D%0A%09/**%0D%0A%09 * Constructor %0D%0A%09 */%0D%0A%09public SampleImageGenerator() %7B%0D%0A%09%09resolver = new PrefixedPathResourceGeneratorResolver(%22img%22);%0D%0A%09%7D%0D%0A%09%0D%0A
 %09/* (non-Jav
@@ -1365,56 +1365,16 @@
 urn 
-new PrefixedPathResourceGeneratorResolver(%22img%22)
+resolver
 ;%0D%0A%09

clean up