Skip to content

Configuration

Customize the server with WebServiceConfigBuilder and pass the built WebServerConfig to LuxisBuilder.withConfig(...):

Luxis.app(MyApp::registerRoutes)
.withConfig(new WebServiceConfigBuilder()
.setPort(8080)
.setDefaultBlockingTimeoutMillis(5000)
.setExceptionHandler(Throwable::printStackTrace)
.setMaxBodySize(1_048_576)
.build())
.start();
MethodDescriptionDefault
setPort(int)The port the server listens on8080
setDefaultBlockingTimeoutMillis(int)Timeout for blocking pipeline steps30000
setExceptionHandler(Consumer<Exception>)Handler for uncaught exceptionsno-op
setMaxBodySize(long)Maximum request body size in bytesunlimited
setCorsConfig(CorsConfig)CORS policy configurationnone

Use CorsConfigBuilder to configure CORS. The builder also exposes allowMethod, allowHeader, exposeHeader, allowCredentials, and maxAgeSeconds:

new WebServiceConfigBuilder()
.setCorsConfig(new CorsConfigBuilder()
.allowOrigin("https://example.com")
.allowMethod("GET")
.allowMethod("POST")
.allowHeader("Authorization")
.allowCredentials(true)
.build())
.build();