forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathParamEx.java
More file actions
35 lines (26 loc) · 1.28 KB
/
PathParamEx.java
File metadata and controls
35 lines (26 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.zetcode;
import com.zetcode.conf.AppConfig;
import io.undertow.Undertow;
import io.undertow.servlet.Servlets;
import io.undertow.servlet.api.DeploymentInfo;
import org.jboss.resteasy.core.ResteasyDeploymentImpl;
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
import org.jboss.resteasy.spi.ResteasyDeployment;
import org.jboss.weld.environment.servlet.Listener;
// http://localhost:8080/api/reverse/falcon
public class PathParamEx {
public static void main(String[] args) {
var server = new UndertowJaxrsServer();
Undertow.Builder serverBuilder = Undertow.builder().addHttpListener(8080, "0.0.0.0");
ResteasyDeployment deployment = new ResteasyDeploymentImpl();
DeploymentInfo deploymentInfo = server.undertowDeployment(deployment, "/");
deployment.setApplicationClass(AppConfig.class.getName());
deployment.setInjectorFactoryClass("org.jboss.resteasy.cdi.CdiInjectorFactory");
deploymentInfo.setClassLoader(PathParamEx.class.getClassLoader());
deploymentInfo.setDeploymentName("My Application");
deploymentInfo.setContextPath("/api");
deploymentInfo.addListeners(Servlets.listener(Listener.class));
server.deploy(deploymentInfo);
server.start(serverBuilder);
}
}