I'm trying to serve static content through a ResourceHandler
in my Undertow server that has a RestEasy deployment.
public class Server {
public static void main(String[] args) throws Exception {
UndertowJaxrsServer server = new UndertowJaxrsServer();
Undertow.Builder serverBuilder = Undertow
.builder()
.addHttpListener(8080, "0.0.0.0")
.setHandler(
Handlers.path().addPrefixPath(
"/web",
new ResourceHandler(new PathResourceManager(Paths.get("/some/fixed/path"),100))
.setDirectoryListingEnabled(true)
.addWelcomeFiles("index.html")));
ResteasyDeployment deployment = new ResteasyDeployment();
deployment.setApplicationClass(MyRestApplication.class.getName());
DeploymentInfo deploymentInfo = server.undertowDeployment(deployment, "/")
.setClassLoader(Server.class.getClassLoader())
.setContextPath("/api").setDeploymentName("WS");
server.deploy(deploymentInfo);
server.start(serverBuilder);
}
}
With the above code, only the resteasy deployment works and I get a 404 for the static content (index.html).
Any pointers? Thanks!