// Path: src/main/java/com/pureperfect/ferret/vfs/WebFileSystem.java
// public class WebFileSystem
// {
// 	private static final WebFileSystem singleton = new WebFileSystem();
// 
// 	private WebFileSystem()
// 	{
// 		// singleton
// 	}
// 
// 	/**
// 	 * Get the appropriate virtual web resource.
// 	 * 
// 	 * @param parent
// 	 *            The parent directory
// 	 * 
// 	 * @param context
// 	 *            the servlet context for the application
// 	 * @param path
// 	 *            the path to the folder or file
// 	 * @return the appropriate virtual resource
// 	 */
// 	public PathElement getVirtualPath(WebDirectory parent,
// 			ServletContext context, String path)
// 	{
// 		// Directories
// 		if (isWebDirectory(context, path))
// 		{
// 			return new ImplWebDirectory(parent, context, path);
// 		}
// 		// Handle Archives as URLs
// 		else if (path.endsWith(".jar"))
// 		{
// 			try
// 			{
// 				final URL jar = context.getResource(path);
// 
// 				return new ImplArchive(parent, jar);
// 			}
// 			catch (Throwable t)
// 			{
// 				throw new ScanException(t);
// 			}
// 		}
// 		// Class files
// 		else if (path.endsWith(".class"))
// 		{
// 			return new ImplWebClassFile(parent, context, path);
// 		}
// 		// Plain files
// 		else
// 		{
// 			return new ImplWebFile(parent, context, path);
// 		}
// 	}
// 
// 	private static boolean isWebDirectory(ServletContext context, String path)
// 	{
// 		/*
// 		 * If it ends with a '/' its definitely a directory. However not ending
// 		 * with a slash is equally valid (e.g. /WEB-INF/lib). The only way to
// 		 * resolve this is to see if the resource actually exists, but does not
// 		 * have a stream since directories cannot be streamed. This is a rather
// 		 * resource intensive approach, but I don't have a quicker solution at
// 		 * the moment for reliably testing whether or not a give path is a
// 		 * directory.
// 		 */
// 		try
// 		{
// 			return path.endsWith("/")
// 					|| (context.getResource(path) != null && context
// 							.getResourceAsStream(path) == null);
// 		}
// 		catch (MalformedURLException e)
// 		{
// 			throw new ScanException(e);
// 		}
// 	}
// 
// 	/**
// 	 * Get an instance of the file system.
// 	 * 
// 	 * @return an instance of the file system
// 	 */
// 	public static WebFileSystem getInstance()
// 	{
// 		return singleton;
// 	}
// }


import java.util.Set;
import javax.servlet.ServletContext;
import com.pureperfect.ferret.vfs.WebFileSystem;
	/**
	 * Add all files outside of WEB-INF/ to the scan path.
	 * 
	 * @param context
	 *            the servlet context
	 */
	public void addPublicResources(final ServletContext context)
	{
		Set<String> paths = context.getResourcePaths("/");

		for (String path : paths)
		{
			// Skip /WEB-INF/
			if (!("/WEB-INF/".equals(path)))
			{
				add(context, path);
			}
		}
	}

	/**
	 * Add a file in the WAR to the scan path.
	 * 
	 * @param context
	 *            The servlet context
	 * @param path
	 *            The path to the file
	 */
	public void add(ServletContext context, String path)
	{
// Path: src/main/java/com/pureperfect/ferret/vfs/WebFileSystem.java
// public class WebFileSystem
// {
// 	private static final WebFileSystem singleton = new WebFileSystem();
// 
// 	private WebFileSystem()
// 	{
// 		// singleton
// 	}
// 
// 	/**
// 	 * Get the appropriate virtual web resource.
// 	 * 
// 	 * @param parent
// 	 *            The parent directory
// 	 * 
// 	 * @param context
// 	 *            the servlet context for the application
// 	 * @param path
// 	 *            the path to the folder or file
// 	 * @return the appropriate virtual resource
// 	 */
// 	public PathElement getVirtualPath(WebDirectory parent,
// 			ServletContext context, String path)
// 	{
// 		// Directories
// 		if (isWebDirectory(context, path))
// 		{
// 			return new ImplWebDirectory(parent, context, path);
// 		}
// 		// Handle Archives as URLs
// 		else if (path.endsWith(".jar"))
// 		{
// 			try
// 			{
// 				final URL jar = context.getResource(path);
// 
// 				return new ImplArchive(parent, jar);
// 			}
// 			catch (Throwable t)
// 			{
// 				throw new ScanException(t);
// 			}
// 		}
// 		// Class files
// 		else if (path.endsWith(".class"))
// 		{
// 			return new ImplWebClassFile(parent, context, path);
// 		}
// 		// Plain files
// 		else
// 		{
// 			return new ImplWebFile(parent, context, path);
// 		}
// 	}
// 
// 	private static boolean isWebDirectory(ServletContext context, String path)
// 	{
// 		/*
// 		 * If it ends with a '/' its definitely a directory. However not ending
// 		 * with a slash is equally valid (e.g. /WEB-INF/lib). The only way to
// 		 * resolve this is to see if the resource actually exists, but does not
// 		 * have a stream since directories cannot be streamed. This is a rather
// 		 * resource intensive approach, but I don't have a quicker solution at
// 		 * the moment for reliably testing whether or not a give path is a
// 		 * directory.
// 		 */
// 		try
// 		{
// 			return path.endsWith("/")
// 					|| (context.getResource(path) != null && context
// 							.getResourceAsStream(path) == null);
// 		}
// 		catch (MalformedURLException e)
// 		{
// 			throw new ScanException(e);
// 		}
// 	}
// 
// 	/**
// 	 * Get an instance of the file system.
// 	 * 
// 	 * @return an instance of the file system
// 	 */
// 	public static WebFileSystem getInstance()
// 	{
// 		return singleton;
// 	}
// }


// Path: src/main/java/com/pureperfect/ferret/WebScanner.java
import java.util.Set;
import javax.servlet.ServletContext;
import com.pureperfect.ferret.vfs.WebFileSystem;

	/**
	 * Add all files outside of WEB-INF/ to the scan path.
	 * 
	 * @param context
	 *            the servlet context
	 */
	public void addPublicResources(final ServletContext context)
	{
		Set<String> paths = context.getResourcePaths("/");

		for (String path : paths)
		{
			// Skip /WEB-INF/
			if (!("/WEB-INF/".equals(path)))
			{
				add(context, path);
			}
		}
	}

	/**
	 * Add a file in the WAR to the scan path.
	 * 
	 * @param context
	 *            The servlet context
	 * @param path
	 *            The path to the file
	 */
	public void add(ServletContext context, String path)
	{
		super.add(WebFileSystem.getInstance().getVirtualPath(null, context,