Skip to content

@sapessi sapessi released this Sep 30, 2019 · 6 commits to master since this release

Release 1.4 includes significant new features such as WebFlux support and asynchronous initialization as well as some minor bug fixes.

New features

  • Support for Spring WebFlux applications in the new aws-serverless-java-container-springboot2 package (#239).
  • Asynchronous initialization makes it easy to take advantage of Lambda's boosted CPU access during the 10 seconds initialization period. The asynchronous initializer starts the underlying framework in a separate thread and uses as much of the 10 seconds timeout for initialization as possible. After 10 seconds, the initializer returns control to AWS Lambda and the main request handling method waits for the background initialization to complete before handling the next event. You can read more about asynchronous initialization in the documentation. This addresses #210, #234, and #264. To make asynchronous initialization more accessible, we have also added builder objects (#144) for the Spring-based implementations (the more likely to be slow at cold start):
public class StreamLambdaHandler implements RequestStreamHandler {
    private SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
    
    public StreamLambdaHandler() throws ContainerInitializationException {
        long startTime = Instant.now().toEpochMilli();
        handler = new SpringBootProxyHandlerBuilder()
                .defaultProxy()
                .asyncInit(startTime)
                .springBootApplication(SlowApplication.class)
                .buildAndInitialize();
    }

    @Override
    public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
            throws IOException {
        handler.proxyStream(inputStream, outputStream, context);
    }
}
  • More complete implementation of the ServletContext which now allows servlet registration and can perform basic routing (#256)
  • Implementation of AsyncContext for the AwsHttpServletRequest. Note the start(Runnable runnable) method will throw an UnsupportedOperationException since we don't want to encourage background tasks in the Lambda environment.
  • Added a new setDefaultContentCharset option in the ContainerConfig object to override the HTTP-specs default of ISO-8859-1 (#269)

Bug fixes

  • Fixed an issue with getParameterValues() in AwsProxyHttpServletRequest that made the method return only the first available value for query string parameters (#280)
  • Fixed a bug in JerseyServletResponseWriter that caused exceptions not be progated from the failure() method (#273, thank you @mikaelq for the fix)
  • Fixed a bug in the default log formatter for HTTP access logs that caused ALB requests to be logged as 01/01/1970:00:00:00Z (#270, thank you @goughy000 for the fix)

Other changes

  • Updated dispatcher logic to store the DispatcherType in a request attribute. This allows Serverless Java Container's dispatcher to support any implementation/wrapping of ServletRequest (#275)
  • Changed Spring, Spring Boot, and Spring Boot 2 implementations to present themselves as embedded web servers instead of using Spring's internal functions to initialize the application context
  • Split Spring Boot 2 support into a separate package to better take advantage of the new interfaces and features in Spring Boot 2
  • Bump Jersey dependency to version 2.29.1 (#266)
  • Bump Jackson version to 2.9.10
Assets 2
You can’t perform that action at this time.