use of org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer in project keycloak by keycloak.
the class UndertowAppServer method start.
@Override
public void start() throws LifecycleException {
long start = System.currentTimeMillis();
undertow = new UndertowJaxrsServer();
undertow.start(Undertow.builder().addHttpListener(configuration.getBindHttpPort(), configuration.getBindAddress()));
log.infof("App server started in %dms on http://%s:%d/", (System.currentTimeMillis() - start), configuration.getBindAddress(), configuration.getBindHttpPort());
}
use of org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer in project narayana by jbosstm.
the class BaseTest method startUndertow.
protected static void startUndertow(Class<?>... classes) throws Exception {
undertow = new UndertowJaxrsServer();
undertow.start(Undertow.builder().addHttpListener(PORT, "localhost"));
// , SURL + "tx/");
undertow.deploy(new TMApplication(classes));
System.out.printf("server is ready:");
}
use of org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer in project keycloak by keycloak.
the class KeycloakServer method start.
public void start() throws Throwable {
long start = System.currentTimeMillis();
ResteasyDeployment deployment = new ResteasyDeployment();
deployment.setApplicationClass(KeycloakApplication.class.getName());
Builder builder = Undertow.builder().addHttpListener(config.getPort(), config.getHost()).setWorkerThreads(config.getWorkerThreads()).setIoThreads(config.getWorkerThreads() / 8);
if (config.getPortHttps() != -1) {
builder = builder.addHttpsListener(config.getPortHttps(), config.getHost(), createSSLContext()).setSocketOption(Options.SSL_CLIENT_AUTH_MODE, SslClientAuthMode.REQUESTED);
}
server = new UndertowJaxrsServer();
try {
server.start(builder);
DeploymentInfo di = server.undertowDeployment(deployment, "");
di.setClassLoader(getClass().getClassLoader());
di.setContextPath("/auth");
di.setDeploymentName("Keycloak");
di.setDefaultEncoding("UTF-8");
di.setDefaultServletConfig(new DefaultServletConfig(true));
// Note that the ResteasyServlet is configured via server.undertowDeployment(...);
// KEYCLOAK-14178
deployment.setProperty(ResteasyContextParameters.RESTEASY_DISABLE_HTML_SANITIZER, true);
InstanceHandle<Filter> filterInstance = new InstanceHandle<Filter>() {
@Override
public Filter getInstance() {
return new UndertowRequestFilter(sessionFactory);
}
@Override
public void release() {
}
};
FilterInfo filter = Servlets.filter("SessionFilter", UndertowRequestFilter.class, () -> filterInstance);
filter.setAsyncSupported(true);
di.addFilter(filter);
di.addFilterUrlMapping("SessionFilter", "/*", DispatcherType.REQUEST);
server.deploy(di);
sessionFactory = KeycloakApplication.getSessionFactory();
setupDevConfig();
if (config.getResourcesHome() != null) {
info("Loading resources from " + config.getResourcesHome());
}
info("Started Keycloak (http://" + config.getHost() + ":" + config.getPort() + "/auth" + (config.getPortHttps() > 0 ? ", https://" + config.getHost() + ":" + config.getPortHttps() + "/auth" : "") + ") in " + (System.currentTimeMillis() - start) + " ms\n");
} catch (RuntimeException e) {
server.stop();
throw e;
}
}
Aggregations