@@ -12,21 +12,22 @@ public class SimpleServer {
1212 private static final int DEFAULT_PORT = 8080 ;
1313 private static final String DEFAULT_HOST = "0.0.0.0" ;
1414
15- private final Undertow undertow ;
16- private SimpleServer (Undertow undertow ) {
17- this .undertow = undertow ;
15+ private final Undertow . Builder undertowBuilder ;
16+ private SimpleServer (Undertow . Builder undertow ) {
17+ this .undertowBuilder = undertow ;
1818 }
1919
2020 /*
2121 * As you can see this class is not meant to abstract away the Undertow server,
2222 * its goal is simply to have some common configurations. We expose Undertow
2323 * if a different service needs to modify it in any way before we call start.
2424 */
25- public Undertow getUndertow () {
26- return undertow ;
25+ public Undertow . Builder getUndertow () {
26+ return undertowBuilder ;
2727 }
2828
2929 public void start () {
30+ Undertow undertow = undertowBuilder .build ();
3031 undertow .start ();
3132 /*
3233 * Undertow logs this on its own but we generally set 3rd party
@@ -39,14 +40,13 @@ public void start() {
3940 }
4041
4142 public static SimpleServer simpleServer (HttpHandler handler ) {
42- Undertow undertow = Undertow .builder ()
43+ Undertow . Builder undertow = Undertow .builder ()
4344 /*
4445 * This setting is needed if you want to allow '=' as a value in a cookie.
4546 * If you base64 encode any cookie values you probably want it on.
4647 */
4748 .setServerOption (UndertowOptions .ALLOW_EQUALS_IN_COOKIE_VALUE , true )
4849 .addHttpListener (DEFAULT_PORT , DEFAULT_HOST , handler )
49- .build ()
5050 ;
5151 return new SimpleServer (undertow );
5252 }
0 commit comments