Commit a641f0c7 authored by Phillip Webb's avatar Phillip Webb

Polish

parent a6e4744c
......@@ -42,4 +42,5 @@ public class SampleController {
public String foo() {
throw new IllegalArgumentException("Server error");
}
}
......@@ -42,4 +42,5 @@ public class SampleController {
public String foo() {
throw new IllegalArgumentException("Server error");
}
}
......@@ -36,4 +36,5 @@ public class SampleController {
public String helloWorld() {
return this.cityService.getCity("Bath", "UK").getName();
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -26,4 +26,5 @@ public class SampleController {
public String helloWorld() {
return "hello";
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -34,4 +34,5 @@ public class SampleController {
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
}
......@@ -20,7 +20,6 @@ import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.Undertow.Builder;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.PathHandler;
import io.undertow.servlet.api.DeploymentManager;
import javax.servlet.ServletException;
......@@ -70,27 +69,32 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
return;
}
if (this.undertow == null) {
try {
HttpHandler servletHandler = this.manager.start();
if (StringUtils.isEmpty(this.contextPath)) {
this.builder.setHandler(servletHandler);
}
else {
PathHandler pathHandler = Handlers.path().addPrefixPath(
this.contextPath, servletHandler);
this.builder.setHandler(pathHandler);
}
this.undertow = this.builder.build();
}
catch (ServletException ex) {
throw new EmbeddedServletContainerException(
"Unable to start embdedded Undertow", ex);
}
this.undertow = createUndertowServer();
}
this.undertow.start();
this.started = true;
}
private Undertow createUndertowServer() {
try {
HttpHandler servletHandler = this.manager.start();
this.builder.setHandler(getContextHandler(servletHandler));
return this.builder.build();
}
catch (ServletException ex) {
throw new EmbeddedServletContainerException(
"Unable to start embdedded Undertow", ex);
}
}
private HttpHandler getContextHandler(HttpHandler servletHandler) {
if (StringUtils.isEmpty(this.contextPath)) {
return servletHandler;
}
return Handlers.path().addPrefixPath(this.contextPath, servletHandler);
}
@Override
public synchronized void stop() throws EmbeddedServletContainerException {
if (this.started) {
......@@ -104,4 +108,4 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
return this.port;
}
}
\ No newline at end of file
}
......@@ -93,4 +93,10 @@ public class UndertowEmbeddedServletContainerFactoryTests extends
ordered.verify(customizer).customize((Builder) anyObject());
}
}
@Test
public void basicSslClasspathKeyStore() throws Exception {
testBasicSllWithKeystore("classpath:test.jks");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment