Created
November 2, 2017 22:13
-
-
Save sermojohn/928ee5f170cd74f0391a348b4a84fba0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UndertowResteasyServer { | |
public static void main(String[] args) { | |
ResteasyDeployment deployment = new ResteasyDeployment(); | |
deployment.setApplicationClass(MyRestApplication.class.getName()); | |
UndertowJaxrsServer server = new UndertowJaxrsServer(); | |
DeploymentInfo deploymentInfo = server.undertowDeployment(deployment, "/") | |
.setClassLoader(UndertowResteasyServer.class.getClassLoader()) | |
.setContextPath("/api").setDeploymentName("WS"); | |
server.deploy(deploymentInfo); | |
ResourceHandler resourceHandler = new ResourceHandler(new PathResourceManager( | |
Paths.get(new File(".").getAbsolutePath()), 100)) | |
.setDirectoryListingEnabled(true) | |
.addWelcomeFiles("index.html"); | |
server.addResourcePrefixPath("/web", resourceHandler); | |
server.start(Undertow.builder().addHttpListener(8080, "0.0.0.0")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment