Fix setup of static resource
This commit is contained in:
parent
62630ae068
commit
0165e7c80e
1 changed files with 9 additions and 5 deletions
|
@ -19,11 +19,13 @@ import java.util.Vector;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.xmlrpc.XmlRpcHandler;
|
import org.apache.xmlrpc.XmlRpcHandler;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||||
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
|
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.ee9.servlet.ServletHolder;
|
import org.eclipse.jetty.ee9.servlet.ServletHolder;
|
||||||
|
import org.eclipse.jetty.util.resource.ResourceFactory;
|
||||||
|
|
||||||
import helma.framework.core.Application;
|
import helma.framework.core.Application;
|
||||||
import helma.framework.repository.FileRepository;
|
import helma.framework.repository.FileRepository;
|
||||||
|
@ -481,19 +483,21 @@ public class ApplicationManager implements XmlRpcHandler {
|
||||||
|
|
||||||
// if there is a static direcory specified, mount it
|
// if there is a static direcory specified, mount it
|
||||||
if (this.staticDir != null) {
|
if (this.staticDir != null) {
|
||||||
|
String staticPath = getAbsoluteFile(this.staticDir).getPath();
|
||||||
|
|
||||||
File staticContent = getAbsoluteFile(this.staticDir);
|
getLogger().info("Serving static from " + staticPath);
|
||||||
|
|
||||||
getLogger().info("Serving static from " + staticContent.getPath());
|
|
||||||
getLogger().info("Mounting static at " + staticMountpoint);
|
getLogger().info("Mounting static at " + staticMountpoint);
|
||||||
|
|
||||||
ResourceHandler rhandler = new ResourceHandler();
|
ResourceHandler rhandler = new ResourceHandler();
|
||||||
rhandler.setResourceBase(staticContent.getPath());
|
rhandler.setBaseResource(ResourceFactory.of(rhandler).newResource(staticPath));
|
||||||
rhandler.setWelcomeFiles(staticHome);
|
rhandler.setWelcomeFiles(staticHome);
|
||||||
|
|
||||||
staticContext = ApplicationManager.this.context.addContext(staticMountpoint, ""); //$NON-NLS-1$
|
ContextHandler staticContext = new ContextHandler();
|
||||||
|
staticContext.setContextPath(staticMountpoint);
|
||||||
|
staticContext.setBaseResourceAsString("");
|
||||||
staticContext.setHandler(rhandler);
|
staticContext.setHandler(rhandler);
|
||||||
|
|
||||||
|
ApplicationManager.this.context.addHandler(staticContext);
|
||||||
staticContext.start();
|
staticContext.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue