@@ -0,0 +1,1226 @@
+package to.etc.domui.util.resources;%0A%0Aimport java.io.*;%0A%0Aimport javax.annotation.*;%0A%0Aimport to.etc.domui.server.*;%0A%0A/**%0A * This resource factory matches the root of a resource name, and if matched redirects to another file system location to%0A * obtain the resource.%0A *%0A * @author %3Ca href=%22mailto:jal@etc.to%22%3EFrits Jalvingh%3C/a%3E%0A * Created on Sep 19, 2013%0A */%0Apublic class RedirectingResourceFactory implements IResourceFactory %7B%0A%09@Nonnull%0A%09final private String m_match;%0A%0A%09@Nonnull%0A%09final private File m_newroot;%0A%0A%09final private boolean m_isfile;%0A%0A%09public RedirectingResourceFactory(boolean isfile, @Nonnull String match, @Nonnull File newroot) %7B%0A%09%09m_isfile = isfile;%0A%09%09m_match = match;%0A%09%09m_newroot = newroot;%0A%09%09if(!newroot.exists())%0A%09%09%09throw new IllegalStateException(newroot + %22: path does not exist%22);%0A%09%7D%0A%0A%09@Override%0A%09public int accept(String name) %7B%0A%09%09if(name.startsWith(m_match))%0A%09%09%09return 100;%0A%09%09return -1;%0A%09%7D%0A%0A%09@Override%0A%09public IResourceRef getResource(DomApplication da, String name, IResourceDependencyList rdl) throws Exception %7B%0A%09%09if(m_isfile)%0A%09%09%09return new WebappResourceRef(m_newroot);%0A%0A%09%09String sub = name.substring(m_match.length());%0A%09%09File f = new File(m_newroot, sub);%0A%09%09return new WebappResourceRef(f);%0A%09%7D%0A%0A%7D%0A

Add redirecting resource provider.