From 749cad712575ab9890aa35a38c87bea49f7eea61 Mon Sep 17 00:00:00 2001 From: Mbea Date: Fri, 31 Mar 2023 16:27:37 -0700 Subject: [PATCH 01/15] Updated versions of Spring, Spring Security, Springboot spring-security-web, servlet API, commons-fileupload. --- aws-serverless-java-container-core/pom.xml | 44 +++++++++++++++---- .../AwsHttpApiV2SecurityContextWriter.java | 2 +- .../proxy/AwsProxyExceptionHandler.java | 6 +-- .../proxy/AwsProxySecurityContextWriter.java | 2 +- .../serverless/proxy/LogFormatter.java | 2 +- .../serverless/proxy/RequestReader.java | 2 +- .../proxy/SecurityContextWriter.java | 2 +- .../internal/LambdaContainerHandler.java | 2 +- .../jaxrs/AwsHttpApiV2SecurityContext.java | 4 +- .../jaxrs/AwsProxySecurityContext.java | 3 +- .../ApacheCombinedServletLogFormatter.java | 7 ++- .../internal/servlet/AwsAsyncContext.java | 6 +-- .../AwsHttpApiV2HttpServletRequestReader.java | 4 +- .../AwsHttpApiV2ProxyHttpServletRequest.java | 8 ++-- .../servlet/AwsHttpServletRequest.java | 33 +++++--------- .../servlet/AwsHttpServletRequestWrapper.java | 4 +- .../servlet/AwsHttpServletResponse.java | 16 +++---- .../internal/servlet/AwsHttpSession.java | 6 +-- .../AwsLambdaServletContainerHandler.java | 10 ++--- .../servlet/AwsProxyHttpServletRequest.java | 32 +++++++++----- .../AwsProxyHttpServletRequestReader.java | 8 ++-- .../AwsProxyHttpServletResponseWriter.java | 4 +- .../servlet/AwsProxyRequestDispatcher.java | 6 +-- .../internal/servlet/AwsProxyRequestPart.java | 2 +- .../internal/servlet/AwsServletContext.java | 43 ++++++++++++++++-- .../servlet/AwsServletInputStream.java | 4 +- .../servlet/AwsServletRegistration.java | 2 +- .../internal/servlet/FilterChainHolder.java | 2 +- .../internal/servlet/FilterChainManager.java | 4 +- .../proxy/internal/servlet/FilterHolder.java | 6 +-- .../ServletLambdaContainerHandlerBuilder.java | 2 +- .../servlet/filters/UrlPathValidator.java | 8 ++-- .../testutils/AwsProxyRequestBuilder.java | 10 +---- .../proxy/internal/testutils/MockServlet.java | 8 ++-- .../proxy/model/MultiValuedTreeMap.java | 2 +- .../proxy/AwsProxyExceptionHandlerTest.java | 6 +-- .../AwsProxySecurityContextWriterTest.java | 3 +- .../serverless/proxy/ResponseWriterTest.java | 2 +- .../internal/LambdaContainerHandlerTest.java | 2 +- .../jaxrs/HttpApiV2SecurityContextTest.java | 4 +- ...ApacheCombinedServletLogFormatterTest.java | 5 +-- .../internal/servlet/AwsAsyncContextTest.java | 12 ++--- .../servlet/AwsFilterChainManagerTest.java | 2 +- ...HttpApiV2HttpServletRequestReaderTest.java | 4 +- .../servlet/AwsHttpServletRequestTest.java | 8 ++-- .../servlet/AwsHttpServletResponseTest.java | 6 +-- .../AwsProxyHttpServletRequestFormTest.java | 8 ++-- .../AwsProxyHttpServletRequestReaderTest.java | 8 ++-- .../AwsProxyHttpServletRequestTest.java | 8 ++-- .../AwsProxyRequestDispatcherTest.java | 8 ++-- .../servlet/AwsServletContextTest.java | 6 +-- .../servlet/AwsServletRegistrationTest.java | 2 +- ...vletLambdaContainerHandlerBuilderTest.java | 2 +- .../servlet/filters/UrlPathValidatorTest.java | 9 ++-- .../pom.xml | 14 +++--- .../SpringBootLambdaContainerHandler.java | 14 ++---- .../spring/SpringBootProxyHandlerBuilder.java | 4 +- ...sReactiveServletEmbeddedServerFactory.java | 2 +- ...erverlessServletEmbeddedServerFactory.java | 2 +- .../proxy/spring/SecurityAppTest.java | 4 +- .../proxy/spring/ServletAppTest.java | 5 +-- ...rlessServletEmbeddedServerFactoryTest.java | 4 +- .../spring/servletapp/MessageController.java | 2 +- .../proxy/spring/servletapp/UserData.java | 6 +-- 64 files changed, 250 insertions(+), 218 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index f86819ecc..82135d77a 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -17,9 +17,24 @@ 2.1.1 - 3.1.0 + 5.0.0 + + + apache.snapshots + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots/ + + false + + + true + + + + + @@ -30,16 +45,16 @@ - javax.servlet - javax.servlet-api - ${servlet.version} + jakarta.servlet + jakarta.servlet-api + 5.0.0 - javax.ws.rs - javax.ws.rs-api - ${jaxrs.version} + jakarta.ws.rs + jakarta.ws.rs-api + 3.0.0-M1 @@ -58,10 +73,15 @@ - + + + org.apache.commons + commons-fileupload2 + 2.0-SNAPSHOT @@ -105,9 +125,14 @@ org.springframework.security spring-security-web - 5.7.8 + 6.0.2 test + + jakarta.activation + jakarta.activation-api + 2.1.0 + @@ -220,4 +245,5 @@ + diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsHttpApiV2SecurityContextWriter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsHttpApiV2SecurityContextWriter.java index 05d4ed1a2..d4192141a 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsHttpApiV2SecurityContextWriter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsHttpApiV2SecurityContextWriter.java @@ -16,7 +16,7 @@ import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequest; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; public class AwsHttpApiV2SecurityContextWriter implements SecurityContextWriter { @Override diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandler.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandler.java index cf2aae3e7..1e30f1415 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandler.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandler.java @@ -22,9 +22,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.io.OutputStream; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriter.java index 4805e1193..8a58bc478 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriter.java @@ -16,7 +16,7 @@ import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; /** * Default implementation of SecurityContextWriter. Creates a SecurityContext object based on an API Gateway diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/LogFormatter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/LogFormatter.java index dcd524f91..8bc75ca9c 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/LogFormatter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/LogFormatter.java @@ -12,7 +12,7 @@ */ package com.amazonaws.serverless.proxy; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; /** * Implementations of the log formatter interface are used by {@link com.amazonaws.serverless.proxy.internal.LambdaContainerHandler} class to log each request diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/RequestReader.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/RequestReader.java index e0203d76b..d8293d649 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/RequestReader.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/RequestReader.java @@ -17,7 +17,7 @@ import com.amazonaws.serverless.proxy.model.ContainerConfig; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; /** diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/SecurityContextWriter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/SecurityContextWriter.java index 32430d816..27a4c6c75 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/SecurityContextWriter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/SecurityContextWriter.java @@ -15,7 +15,7 @@ import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; /** * This object is used by the container implementation to generated a Jax-Rs SecurityContext object from the diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandler.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandler.java index e29b1072c..d736d6373 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandler.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandler.java @@ -28,7 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; import java.io.IOException; import java.io.InputStream; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsHttpApiV2SecurityContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsHttpApiV2SecurityContext.java index 6060fb2e2..f0e1f963d 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsHttpApiV2SecurityContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsHttpApiV2SecurityContext.java @@ -21,8 +21,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; import java.nio.charset.StandardCharsets; import java.security.Principal; import java.util.Base64; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsProxySecurityContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsProxySecurityContext.java index b05822971..7c128cabe 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsProxySecurityContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/jaxrs/AwsProxySecurityContext.java @@ -14,10 +14,9 @@ import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.serverless.proxy.model.CognitoAuthorizerClaims; -import com.amazonaws.serverless.proxy.model.RequestSource; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; import java.security.Principal; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatter.java index 715e6f8d9..e0c7a7357 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatter.java @@ -13,15 +13,14 @@ package com.amazonaws.serverless.proxy.internal.servlet; import com.amazonaws.serverless.proxy.LogFormatter; -import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.serverless.proxy.model.AwsProxyRequestContext; import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequestContext; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.core.SecurityContext; import java.time.*; import java.time.format.DateTimeFormatter; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContext.java index 251624541..4a46a70fa 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContext.java @@ -16,9 +16,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReader.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReader.java index bacedbaa4..c40740c96 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReader.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReader.java @@ -18,8 +18,8 @@ import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequest; import com.amazonaws.services.lambda.runtime.Context; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.SecurityContext; public class AwsHttpApiV2HttpServletRequestReader extends RequestReader { static final String INVALID_REQUEST_ERROR = "The incoming event is not a valid HTTP API v2 proxy request"; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java index c03facc32..d81105bd5 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java @@ -23,10 +23,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.http.*; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.*; +import jakarta.servlet.http.*; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java index d2157e3d8..358ccdfba 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java @@ -22,25 +22,20 @@ import com.amazonaws.serverless.proxy.model.MultiValuedTreeMap; import com.amazonaws.services.lambda.runtime.Context; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileUploadException; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload2.FileItem; +import org.apache.commons.fileupload2.FileUploadException; +import org.apache.commons.fileupload2.disk.DiskFileItemFactory; +import org.apache.commons.fileupload2.jaksrvlt.JakSrvltFileUpload; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.NullInputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.DispatcherType; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.*; +import jakarta.servlet.http.*; +import jakarta.ws.rs.core.MediaType; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -185,14 +180,6 @@ public boolean isRequestedSessionIdFromURL() { } - @Override - @Deprecated - public boolean isRequestedSessionIdFromUrl() { - log.debug("Trying to access session. Lambda functions are stateless and should not rely on the session"); - return false; - } - - //------------------------------------------------------------- // Implementation - ServletRequest //------------------------------------------------------------- @@ -525,14 +512,14 @@ protected Map getMultipartFormParametersMap() { if (multipartFormParameters != null) { return multipartFormParameters; } - if (!ServletFileUpload.isMultipartContent(this)) { // isMultipartContent also checks the content type + if (!JakSrvltFileUpload.isMultipartContent(this)) { // isMultipartContent also checks the content type multipartFormParameters = new HashMap<>(); return multipartFormParameters; } Timer.start("SERVLET_REQUEST_GET_MULTIPART_PARAMS"); multipartFormParameters = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); + JakSrvltFileUpload upload = new JakSrvltFileUpload(new DiskFileItemFactory()); try { List items = upload.parseRequest(this); diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java index e151c03da..d87b707ec 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java @@ -15,8 +15,8 @@ import com.amazonaws.serverless.proxy.internal.LambdaContainerHandler; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.*; -import javax.servlet.http.*; +import jakarta.servlet.*; +import jakarta.servlet.http.*; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java index 65677d00a..814958dfa 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java @@ -21,14 +21,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.DispatcherType; -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java index 8c3df7f86..eb1f728f9 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java @@ -15,9 +15,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionContext; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionContext; import java.time.Instant; import java.util.Collections; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsLambdaServletContainerHandler.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsLambdaServletContainerHandler.java index 52631da54..b35bba92c 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsLambdaServletContainerHandler.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsLambdaServletContainerHandler.java @@ -19,18 +19,16 @@ import com.amazonaws.serverless.proxy.ResponseWriter; import com.amazonaws.serverless.proxy.SecurityContextWriter; -import com.amazonaws.services.lambda.runtime.Context; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java index c85bf80a4..a4ee15150 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java @@ -24,10 +24,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.http.*; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.*; +import jakarta.servlet.http.*; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; + import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; @@ -483,14 +484,6 @@ public RequestDispatcher getRequestDispatcher(String s) { } - @Override - @Deprecated - public String getRealPath(String s) { - // we are in an archive on a remote server - return null; - } - - @Override public int getRemotePort() { return 0; @@ -542,6 +535,21 @@ public AsyncContext getAsyncContext() { return asyncContext; } + @Override + public String getRequestId() { + return request.getRequestContext().getRequestId(); + } + + @Override + public String getProtocolRequestId() { + return ""; + } + + @Override + public ServletConnection getServletConnection() { + return null; + } + //------------------------------------------------------------- // Methods - Private //------------------------------------------------------------- diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReader.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReader.java index 932041db9..ec56285f7 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReader.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReader.java @@ -18,10 +18,10 @@ import com.amazonaws.serverless.proxy.model.ContainerConfig; import com.amazonaws.services.lambda.runtime.Context; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; /** * Simple implementation of the RequestReader interface that receives an AwsProxyRequest diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java index b6061e1e7..0e230e9a7 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java @@ -22,8 +22,8 @@ import com.amazonaws.serverless.proxy.model.RequestSource; import com.amazonaws.services.lambda.runtime.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import java.util.Base64; import java.util.HashMap; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java index fc52d1dba..5ed2ccf44 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java @@ -19,9 +19,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestPart.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestPart.java index a6a418c2c..c2d1fa62d 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestPart.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestPart.java @@ -17,7 +17,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.http.Part; +import jakarta.servlet.http.Part; import java.io.ByteArrayInputStream; import java.io.FileOutputStream; import java.io.IOException; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java index 44ec701ee..a362dfc25 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java @@ -20,9 +20,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.activation.MimetypesFileTypeMap; -import javax.servlet.*; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.activation.MimetypesFileTypeMap; +import jakarta.servlet.*; +import jakarta.servlet.ServletContext; +import jakarta.servlet.descriptor.JspConfigDescriptor; import java.io.File; import java.io.InputStream; @@ -79,7 +80,6 @@ public AwsServletContext(AwsLambdaServletContainerHandler containerHandler) { this.servletRegistrations = new HashMap<>(); } - //------------------------------------------------------------- // Implementation - ServletContext //------------------------------------------------------------- @@ -95,6 +95,36 @@ public String getContextPath() { return ""; } + @Override + public void setResponseCharacterEncoding(String encoding) { + // do nothing; + } + + @Override + public String getResponseCharacterEncoding() { + return ""; + } + + @Override + public void setRequestCharacterEncoding(String encoding) { + // do nothing; + } + + @Override + public String getRequestCharacterEncoding() { + return ""; + } + + @Override + public void setSessionTimeout(int sessionTimeout) { + // do nothing; + } + + @Override + public int getSessionTimeout() { + return 1; + } + @Override public ServletContext getContext(String s) { @@ -345,6 +375,11 @@ public ServletRegistration.Dynamic addServlet(String s, Class } } + @Override + public ServletRegistration.Dynamic addJspFile(String s, String s1) { + return null; + } + @Override public T createServlet(Class aClass) throws ServletException { diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletInputStream.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletInputStream.java index 552e75a89..eb155a364 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletInputStream.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletInputStream.java @@ -16,8 +16,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; import java.io.IOException; import java.io.InputStream; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistration.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistration.java index 021503c13..9fdc3b3b6 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistration.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistration.java @@ -14,7 +14,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.*; +import jakarta.servlet.*; import java.util.*; /** diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainHolder.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainHolder.java index bec7a8f4b..b45eed4a1 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainHolder.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainHolder.java @@ -16,7 +16,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; +import jakarta.servlet.*; import java.io.IOException; import java.util.ArrayList; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainManager.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainManager.java index 1bf6f4b2a..835170bb5 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainManager.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterChainManager.java @@ -14,8 +14,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.Collections; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterHolder.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterHolder.java index 987dff14c..c3a4cdb81 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterHolder.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/FilterHolder.java @@ -14,9 +14,9 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.servlet.*; -import javax.servlet.annotation.WebFilter; -import javax.servlet.annotation.WebInitParam; +import jakarta.servlet.*; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.annotation.WebInitParam; import java.util.*; /** diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilder.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilder.java index caead2aaf..b44ec7f26 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilder.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilder.java @@ -18,7 +18,7 @@ import com.amazonaws.serverless.proxy.model.AwsProxyResponse; import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequest; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidator.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidator.java index c69b39c91..aadb26efd 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidator.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidator.java @@ -15,10 +15,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; -import javax.servlet.annotation.WebFilter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java index 6fae6db78..adcebb89d 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java @@ -23,8 +23,8 @@ import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayInputStream; import java.io.File; @@ -35,12 +35,6 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.function.BiConsumer; -import java.util.function.BinaryOperator; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collector; -import java.util.stream.Collectors; /** diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/MockServlet.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/MockServlet.java index b93625bfb..6dd2ade66 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/MockServlet.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/MockServlet.java @@ -2,10 +2,10 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class MockServlet extends HttpServlet { diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/MultiValuedTreeMap.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/MultiValuedTreeMap.java index feeab6f2b..ad0593a1f 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/MultiValuedTreeMap.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/model/MultiValuedTreeMap.java @@ -14,7 +14,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import java.io.Serializable; import java.util.ArrayList; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandlerTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandlerTest.java index dd3417db4..f94371d69 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandlerTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxyExceptionHandlerTest.java @@ -17,9 +17,9 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriterTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriterTest.java index 34af09df7..8a2134f48 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriterTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/AwsProxySecurityContextWriterTest.java @@ -1,13 +1,12 @@ package com.amazonaws.serverless.proxy; import com.amazonaws.serverless.proxy.model.AwsProxyRequest; -import com.amazonaws.serverless.proxy.AwsProxySecurityContextWriter; import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; import com.amazonaws.services.lambda.runtime.Context; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.SecurityContext; import java.lang.reflect.Method; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/ResponseWriterTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/ResponseWriterTest.java index 48c544629..609fb0fdb 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/ResponseWriterTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/ResponseWriterTest.java @@ -8,7 +8,7 @@ import com.amazonaws.services.lambda.runtime.Context; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; public class ResponseWriterTest { diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandlerTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandlerTest.java index 31a2c575b..98b45fd1b 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandlerTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/LambdaContainerHandlerTest.java @@ -13,7 +13,7 @@ import org.apache.http.impl.execchain.RequestAbortedException; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.concurrent.CountDownLatch; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/jaxrs/HttpApiV2SecurityContextTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/jaxrs/HttpApiV2SecurityContextTest.java index 0fda7b975..a4c6aa311 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/jaxrs/HttpApiV2SecurityContextTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/jaxrs/HttpApiV2SecurityContextTest.java @@ -5,8 +5,8 @@ import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequest; import org.junit.jupiter.api.Test; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatterTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatterTest.java index e07932680..69b2d7985 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatterTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ApacheCombinedServletLogFormatterTest.java @@ -7,15 +7,14 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.time.Clock; import java.time.Instant; import java.time.ZoneId; import static com.amazonaws.serverless.proxy.RequestReader.API_GATEWAY_CONTEXT_PROPERTY; -import static com.amazonaws.serverless.proxy.RequestReader.API_GATEWAY_EVENT_PROPERTY; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.ArgumentMatchers.eq; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContextTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContextTest.java index b5b79bba1..2177fa8bb 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContextTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsAsyncContextTest.java @@ -12,12 +12,12 @@ import com.amazonaws.services.lambda.runtime.Context; import org.junit.jupiter.api.Test; -import javax.servlet.AsyncContext; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.concurrent.CountDownLatch; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java index 4eedc0f93..7e7fba49b 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java @@ -9,7 +9,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.*; +import jakarta.servlet.*; import java.io.IOException; import java.util.EnumSet; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReaderTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReaderTest.java index e35fedb7d..12f694bc1 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReaderTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2HttpServletRequestReaderTest.java @@ -7,8 +7,8 @@ import com.amazonaws.serverless.proxy.model.HttpApiV2ProxyRequestContext; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.HttpHeaders; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.HttpHeaders; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestTest.java index 35903333b..051c12fc6 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestTest.java @@ -5,13 +5,11 @@ import com.amazonaws.serverless.proxy.internal.testutils.MockLambdaContext; import com.amazonaws.serverless.proxy.model.ContainerConfig; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; -import javax.servlet.ServletException; -import javax.servlet.http.Cookie; -import javax.ws.rs.core.HttpHeaders; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.Cookie; +import jakarta.ws.rs.core.HttpHeaders; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponseTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponseTest.java index 39fe7144b..6c951a4f1 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponseTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponseTest.java @@ -6,9 +6,9 @@ import org.junit.jupiter.api.Test; -import javax.servlet.http.Cookie; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.http.Cookie; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.io.PrintWriter; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java index a185a1f8a..07a2f410e 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java @@ -10,10 +10,10 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.junit.jupiter.api.Test; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.nio.charset.Charset; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReaderTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReaderTest.java index 486e923aa..f92c37168 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReaderTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestReaderTest.java @@ -6,13 +6,11 @@ import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.serverless.proxy.model.ContainerConfig; import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; -import com.amazonaws.services.lambda.runtime.Context; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.SecurityContext; -import java.lang.reflect.Method; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.SecurityContext; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestTest.java index af272e231..855fae403 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestTest.java @@ -8,10 +8,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.SecurityContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.SecurityContext; import java.io.IOException; import java.io.InputStream; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcherTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcherTest.java index 03c06ad24..254ce04a0 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcherTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcherTest.java @@ -13,10 +13,10 @@ import org.junit.jupiter.api.Test; import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.charset.Charset; import java.util.concurrent.CountDownLatch; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java index 35f6723b6..5817527e2 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistrationTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistrationTest.java index 105abc61d..80bb38060 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistrationTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletRegistrationTest.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.Test; -import javax.servlet.*; +import jakarta.servlet.*; import java.io.IOException; import java.util.Enumeration; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilderTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilderTest.java index 5ae5aae02..73f8d7908 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilderTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/ServletLambdaContainerHandlerBuilderTest.java @@ -8,7 +8,7 @@ import com.amazonaws.services.lambda.runtime.Context; import org.junit.jupiter.api.Test; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.concurrent.CountDownLatch; import static org.junit.jupiter.api.Assertions.*; diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidatorTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidatorTest.java index 11a018eb4..fa6712c7c 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidatorTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/filters/UrlPathValidatorTest.java @@ -1,17 +1,14 @@ package com.amazonaws.serverless.proxy.internal.servlet.filters; -import com.amazonaws.serverless.proxy.internal.servlet.AwsHttpServletRequest; import com.amazonaws.serverless.proxy.internal.servlet.AwsHttpServletResponse; import com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest; -import com.amazonaws.serverless.proxy.internal.servlet.FilterHolder; import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; import org.junit.jupiter.api.Test; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; -import java.io.IOException; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; diff --git a/aws-serverless-java-container-springboot2/pom.xml b/aws-serverless-java-container-springboot2/pom.xml index 33bb8171b..c955649d6 100644 --- a/aws-serverless-java-container-springboot2/pom.xml +++ b/aws-serverless-java-container-springboot2/pom.xml @@ -15,11 +15,10 @@ 1.10-SNAPSHOT - 5.3.27 - 2.7.11 - 5.7.8 - 1.8 - 1.8 + 6.0.5 + 3.0.4 + 6.0.2 + 17 @@ -171,6 +170,11 @@ 1.1.1 test + + jakarta.activation + jakarta.activation-api + 2.1.0 + diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java index ce6bad7b1..1f7719e9a 100644 --- a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java +++ b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java @@ -14,7 +14,6 @@ import com.amazonaws.serverless.exceptions.ContainerInitializationException; import com.amazonaws.serverless.proxy.*; -import com.amazonaws.serverless.proxy.internal.LambdaContainerHandler; import com.amazonaws.serverless.proxy.internal.servlet.*; import com.amazonaws.serverless.proxy.internal.testutils.Timer; import com.amazonaws.serverless.proxy.model.AwsProxyRequest; @@ -25,19 +24,14 @@ import com.amazonaws.services.lambda.runtime.Context; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.StandardEnvironment; -import org.springframework.web.context.ConfigurableWebApplicationContext; -import org.springframework.web.servlet.DispatcherServlet; - -import javax.servlet.Servlet; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServletRequest; + +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.http.HttpServletRequest; import java.util.concurrent.CountDownLatch; /** diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java index b9894834c..cdec18551 100644 --- a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java +++ b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java @@ -13,13 +13,11 @@ package com.amazonaws.serverless.proxy.spring; import com.amazonaws.serverless.exceptions.ContainerInitializationException; -import com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest; import com.amazonaws.serverless.proxy.internal.servlet.ServletLambdaContainerHandlerBuilder; -import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.serverless.proxy.model.AwsProxyResponse; import org.springframework.boot.WebApplicationType; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; public final class SpringBootProxyHandlerBuilder extends ServletLambdaContainerHandlerBuilder< RequestType, diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java index 9b2c04948..3376452e2 100644 --- a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java +++ b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java @@ -22,7 +22,7 @@ import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; -import javax.servlet.*; +import jakarta.servlet.*; import java.io.IOException; import java.util.Enumeration; diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java index ad228f7d4..fbc31145d 100644 --- a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java +++ b/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java @@ -21,7 +21,7 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.core.Ordered; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) public class ServerlessServletEmbeddedServerFactory implements ServletWebServerFactory, WebServer { diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java index e322e1a67..d0b579509 100644 --- a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java +++ b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java @@ -8,8 +8,8 @@ import com.amazonaws.serverless.proxy.spring.securityapp.SecurityConfig; import org.junit.jupiter.api.Test; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java index f5e2e8185..aacf5444c 100644 --- a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java +++ b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java @@ -3,7 +3,6 @@ import com.amazonaws.serverless.proxy.internal.LambdaContainerHandler; import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; import com.amazonaws.serverless.proxy.internal.testutils.MockLambdaContext; -import com.amazonaws.serverless.proxy.model.AwsProxyRequest; import com.amazonaws.serverless.proxy.model.AwsProxyResponse; import com.amazonaws.serverless.proxy.model.ContainerConfig; import com.amazonaws.serverless.proxy.spring.servletapp.*; @@ -11,8 +10,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java index 2fddcf0a5..5ffd4a311 100644 --- a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java +++ b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java @@ -13,8 +13,8 @@ import org.springframework.boot.WebApplicationType; import org.springframework.boot.web.servlet.ServletContextInitializer; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; import static org.junit.jupiter.api.Assertions.fail; diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java index 6bd516324..927822a4e 100644 --- a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java +++ b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.HashMap; import java.util.Map; diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java index e180c1738..379291a39 100644 --- a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java +++ b/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java @@ -1,9 +1,9 @@ package com.amazonaws.serverless.proxy.spring.servletapp; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; public class UserData { @NotBlank From 9cf61f0ff285a5dc1432b95bc73facd470b4f26c Mon Sep 17 00:00:00 2001 From: Mbea Date: Sat, 1 Apr 2023 02:08:25 -0700 Subject: [PATCH 02/15] - Did the namespace change on the other components - Fixed 2 failing tests in AwsServletContextTest by adding version 2.0.0 of the angus-mail dependency --- aws-serverless-java-container-core/pom.xml | 6 ++++ .../internal/servlet/AwsServletContext.java | 4 ++- .../proxy/jersey/JerseyHandlerFilter.java | 22 ++++++------- .../jersey/JerseyLambdaContainerHandler.java | 15 +++++---- .../jersey/JerseyServletResponseWriter.java | 6 ++-- .../AwsProxyServletContextSupplier.java | 8 ++--- .../AwsProxyServletRequestSupplier.java | 4 +-- .../AwsProxyServletResponseSupplier.java | 4 +-- .../proxy/jersey/EchoJerseyResource.java | 31 +++++++------------ .../proxy/jersey/JerseyAwsProxyTest.java | 6 ++-- .../proxy/jersey/JerseyInjectionTest.java | 2 +- .../proxy/jersey/JerseyParamEncodingTest.java | 2 +- .../proxy/jersey/ResourceBinder.java | 2 +- .../providers/CustomExceptionMapper.java | 12 +++---- .../providers/ServletRequestFilter.java | 8 ++--- .../spark/SparkLambdaContainerHandler.java | 8 ++--- .../embeddedserver/LambdaEmbeddedServer.java | 2 +- .../spark/HelloWorldSparkStreamTest.java | 2 +- .../proxy/spark/HelloWorldSparkTest.java | 4 +-- .../SparkLambdaContainerHandlerTest.java | 4 +-- .../spark/filter/CustomHeaderFilter.java | 14 ++++----- .../spark/filter/UnauthenticatedFilter.java | 16 +++++----- .../spring/SpringLambdaContainerHandler.java | 6 ++-- .../spring/SpringProxyHandlerBuilder.java | 2 +- .../proxy/spring/SpringAwsProxyTest.java | 15 +++------ .../spring/SpringServletContextTest.java | 4 +-- .../proxy/spring/StaticAppProxyTest.java | 2 +- .../proxy/spring/echoapp/ContextResource.java | 14 ++++----- .../spring/echoapp/CustomHeaderFilter.java | 14 ++++----- .../proxy/spring/echoapp/EchoResource.java | 4 +-- .../spring/echoapp/EchoSpringAppConfig.java | 2 +- .../spring/echoapp/UnauthenticatedFilter.java | 16 +++++----- .../echoapp/model/ValidatedUserModel.java | 2 +- .../spring/extensibility/CustomServlet.java | 6 ++-- .../extensibility/CustomServletTest.java | 2 +- .../CustomSpringLambdaContainerHandler.java | 4 +-- .../struts/StrutsLambdaContainerHandler.java | 8 ++--- .../proxy/struts/StrutsAwsProxyTest.java | 2 +- .../proxy/struts/echoapp/EchoAction.java | 4 +-- .../struts/echoapp/EchoRequestInfoAction.java | 4 +-- .../src/main/java/resource/PingResource.java | 12 +++---- .../test/java/StreamLambdaHandlerTest.java | 8 ++--- .../test/java/StreamLambdaHandlerTest.java | 8 ++--- .../src/main/java/SpringApiConfig.java | 4 +-- .../test/java/StreamLambdaHandlerTest.java | 8 ++--- .../test/java/StreamLambdaHandlerTest.java | 8 ++--- .../test/java/StreamLambdaHandlerTest.java | 8 ++--- .../sample/jersey/PetsResource.java | 6 ++-- .../sample/spark/SparkResources.java | 2 +- .../sample/spark/StreamLambdaHandler.java | 4 +-- .../spark/filter/CognitoIdentityFilter.java | 12 +++---- .../spring/PetStoreSpringAppConfig.java | 4 +-- .../sample/spring/StreamLambdaHandler.java | 4 +-- .../spring/filter/CognitoIdentityFilter.java | 12 +++---- .../sample/springboot2/Application.java | 4 +-- .../springboot2/StreamLambdaHandler.java | 4 +-- .../filter/CognitoIdentityFilter.java | 12 +++---- 57 files changed, 203 insertions(+), 210 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 82135d77a..7c2159d7c 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -83,6 +83,12 @@ commons-fileupload2 2.0-SNAPSHOT + + org.eclipse.angus + angus-mail + 2.0.0 + + diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java index a362dfc25..4531b14ae 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java @@ -17,13 +17,14 @@ import com.amazonaws.serverless.proxy.internal.SecurityUtils; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import jakarta.activation.spi.MimeTypeRegistryProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.activation.MimetypesFileTypeMap; import jakarta.servlet.*; import jakarta.servlet.ServletContext; import jakarta.servlet.descriptor.JspConfigDescriptor; +import jakarta.activation.MimetypesFileTypeMap; import java.io.File; import java.io.InputStream; @@ -166,6 +167,7 @@ public String getMimeType(String s) { if (mimeTypes == null) { mimeTypes = new MimetypesFileTypeMap(); } + // TODO: The getContentType method of the MimetypesFileTypeMap returns application/octet-stream // instead of null when the type cannot be found. We should replace with an implementation that // loads the System mime types ($JAVA_HOME/lib/mime.types diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyHandlerFilter.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyHandlerFilter.java index 27e3157f0..79d030bda 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyHandlerFilter.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyHandlerFilter.java @@ -26,17 +26,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.core.UriBuilder; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.UriBuilder; import java.io.IOException; import java.io.InputStream; diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyLambdaContainerHandler.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyLambdaContainerHandler.java index fe50cd0fd..e290e284b 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyLambdaContainerHandler.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyLambdaContainerHandler.java @@ -30,14 +30,13 @@ import org.glassfish.jersey.process.internal.RequestScoped; import org.glassfish.jersey.server.ResourceConfig; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.Application; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.core.Application; import java.util.EnumSet; import java.util.concurrent.CountDownLatch; diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyServletResponseWriter.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyServletResponseWriter.java index 938c6f9ff..870390f80 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyServletResponseWriter.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/JerseyServletResponseWriter.java @@ -22,9 +22,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.InternalServerErrorException; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.InternalServerErrorException; import java.io.IOException; import java.io.OutputStream; diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletContextSupplier.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletContextSupplier.java index 78f8c5c5a..4d93a89ab 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletContextSupplier.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletContextSupplier.java @@ -15,10 +15,10 @@ import org.glassfish.jersey.server.ContainerRequest; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.core.Context; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.core.Context; import java.util.function.Supplier; diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletRequestSupplier.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletRequestSupplier.java index fe1b21f13..c3a4653bf 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletRequestSupplier.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletRequestSupplier.java @@ -15,8 +15,8 @@ import org.glassfish.jersey.server.ContainerRequest; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.Context; import java.util.function.Supplier; diff --git a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletResponseSupplier.java b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletResponseSupplier.java index 1fb6dc175..d4123f22e 100644 --- a/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletResponseSupplier.java +++ b/aws-serverless-java-container-jersey/src/main/java/com/amazonaws/serverless/proxy/jersey/suppliers/AwsProxyServletResponseSupplier.java @@ -15,8 +15,8 @@ import org.glassfish.jersey.server.ContainerRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.Context; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.core.Context; import java.util.function.Supplier; diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/EchoJerseyResource.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/EchoJerseyResource.java index 5da93ca08..d05c6814f 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/EchoJerseyResource.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/EchoJerseyResource.java @@ -13,41 +13,34 @@ package com.amazonaws.serverless.proxy.jersey; import com.amazonaws.serverless.proxy.RequestReader; -import com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest; import com.amazonaws.serverless.proxy.jersey.providers.ServletRequestFilter; import com.amazonaws.serverless.proxy.model.AwsProxyRequestContext; import com.amazonaws.serverless.proxy.jersey.model.MapResponseModel; import com.amazonaws.serverless.proxy.jersey.model.SingleValueModel; -import org.apache.commons.io.IOUtils; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataMultiPart; import org.glassfish.jersey.media.multipart.FormDataParam; -import javax.inject.Inject; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.*; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.core.UriInfo; - -import java.io.ByteArrayInputStream; +import jakarta.inject.Inject; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.*; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.core.UriInfo; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; -import java.util.HashMap; import java.util.List; import java.util.Random; -import static com.amazonaws.serverless.proxy.jersey.JerseyHandlerFilter.JERSEY_SERVLET_REQUEST_PROPERTY; - /** * Jersey application class for aws-serverless-java-container unit proxy diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyAwsProxyTest.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyAwsProxyTest.java index 179555323..b845a0b69 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyAwsProxyTest.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyAwsProxyTest.java @@ -33,9 +33,9 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.IOException; import java.util.Arrays; import java.util.Collection; diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyInjectionTest.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyInjectionTest.java index cfbe5c9bb..e253f34a3 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyInjectionTest.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyInjectionTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import org.glassfish.jersey.internal.inject.AbstractBinder; import org.glassfish.jersey.media.multipart.MultiPartFeature; diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java index 25bb26bd4..9dc1ab32a 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java @@ -18,7 +18,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.io.UnsupportedEncodingException; diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/ResourceBinder.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/ResourceBinder.java index e98ea805a..f35bffd49 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/ResourceBinder.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/ResourceBinder.java @@ -2,7 +2,7 @@ import org.glassfish.jersey.internal.inject.AbstractBinder; -import javax.inject.Singleton; +import jakarta.inject.Singleton; public class ResourceBinder extends AbstractBinder { @Override diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/CustomExceptionMapper.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/CustomExceptionMapper.java index e435aff96..61cddee1b 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/CustomExceptionMapper.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/CustomExceptionMapper.java @@ -1,11 +1,11 @@ package com.amazonaws.serverless.proxy.jersey.providers; -import javax.inject.Inject; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import jakarta.inject.Inject; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; @Provider @@ -16,7 +16,7 @@ public CustomExceptionMapper() { } @Inject - public javax.inject.Provider request; + public jakarta.inject.Provider request; @Override public Response toResponse(UnsupportedOperationException throwable) { diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/ServletRequestFilter.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/ServletRequestFilter.java index 70d65a64c..8ccfe488f 100644 --- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/ServletRequestFilter.java +++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/providers/ServletRequestFilter.java @@ -1,10 +1,10 @@ package com.amazonaws.serverless.proxy.jersey.providers; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.core.Context; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.core.Context; import java.io.IOException; diff --git a/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandler.java b/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandler.java index 6b2168aa9..9c1b47511 100644 --- a/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandler.java +++ b/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandler.java @@ -31,10 +31,10 @@ import spark.Spark; import spark.embeddedserver.EmbeddedServers; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; -import javax.servlet.Servlet; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.Servlet; +import jakarta.servlet.http.HttpServletRequest; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServer.java b/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServer.java index fadca4941..8d79c613c 100644 --- a/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServer.java +++ b/aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServer.java @@ -25,7 +25,7 @@ import spark.ssl.SslStores; import spark.staticfiles.StaticFilesConfiguration; -import javax.servlet.Filter; +import jakarta.servlet.Filter; import java.util.Map; import java.util.Optional; diff --git a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkStreamTest.java b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkStreamTest.java index 56087ed62..33bc19f1d 100644 --- a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkStreamTest.java +++ b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkStreamTest.java @@ -15,7 +15,7 @@ import org.junit.jupiter.params.provider.MethodSource; import spark.Spark; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java index 5402b6a9c..b687784ec 100644 --- a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java +++ b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java @@ -13,8 +13,8 @@ import org.junit.jupiter.params.provider.MethodSource; import spark.Spark; -import javax.servlet.http.Cookie; -import javax.ws.rs.core.HttpHeaders; +import jakarta.servlet.http.Cookie; +import jakarta.ws.rs.core.HttpHeaders; import java.util.Arrays; import java.util.Collection; diff --git a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandlerTest.java b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandlerTest.java index 52f2a5388..a5c5e824b 100644 --- a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandlerTest.java +++ b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandlerTest.java @@ -13,8 +13,8 @@ import org.junit.jupiter.api.Test; import spark.Spark; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import java.util.EnumSet; diff --git a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/CustomHeaderFilter.java b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/CustomHeaderFilter.java index e3733f3a9..8f4bc99ac 100644 --- a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/CustomHeaderFilter.java +++ b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/CustomHeaderFilter.java @@ -1,13 +1,13 @@ package com.amazonaws.serverless.proxy.spark.filter; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/UnauthenticatedFilter.java b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/UnauthenticatedFilter.java index 742072ca5..efa41a2d3 100644 --- a/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/UnauthenticatedFilter.java +++ b/aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/filter/UnauthenticatedFilter.java @@ -1,14 +1,14 @@ package com.amazonaws.serverless.proxy.spark.filter; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringLambdaContainerHandler.java b/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringLambdaContainerHandler.java index 22f7c17cd..5e56dba62 100644 --- a/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringLambdaContainerHandler.java +++ b/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringLambdaContainerHandler.java @@ -23,9 +23,9 @@ import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; -import javax.servlet.Servlet; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.http.HttpServletRequest; import java.util.concurrent.CountDownLatch; diff --git a/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringProxyHandlerBuilder.java b/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringProxyHandlerBuilder.java index b1f35c809..5614b94df 100644 --- a/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringProxyHandlerBuilder.java +++ b/aws-serverless-java-container-spring/src/main/java/com/amazonaws/serverless/proxy/spring/SpringProxyHandlerBuilder.java @@ -18,7 +18,7 @@ import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; public class SpringProxyHandlerBuilder extends ServletLambdaContainerHandlerBuilder< RequestType, diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java index 6c744f6b5..1101efc8c 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java @@ -21,19 +21,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestExecutionListeners; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; -import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.servlet.DispatcherServlet; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringServletContextTest.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringServletContextTest.java index cfc39b845..11b6c7c5f 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringServletContextTest.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringServletContextTest.java @@ -17,8 +17,8 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import java.util.EnumSet; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/StaticAppProxyTest.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/StaticAppProxyTest.java index d2b74b26a..9e828119f 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/StaticAppProxyTest.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/StaticAppProxyTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MediaType; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/ContextResource.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/ContextResource.java index d52237566..8f7eaf2a0 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/ContextResource.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/ContextResource.java @@ -17,13 +17,13 @@ import org.springframework.web.context.ServletContextAware; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; import static org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/CustomHeaderFilter.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/CustomHeaderFilter.java index ca0030439..f6427db65 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/CustomHeaderFilter.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/CustomHeaderFilter.java @@ -1,13 +1,13 @@ package com.amazonaws.serverless.proxy.spring.echoapp; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java index ceb358bea..cfcc9f878 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java @@ -15,8 +15,8 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpServletRequest; import java.io.IOException; import java.net.URI; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoSpringAppConfig.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoSpringAppConfig.java index a4d5f069c..cf4aa495e 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoSpringAppConfig.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoSpringAppConfig.java @@ -24,7 +24,7 @@ public MockLambdaContext lambdaContext() { } @Bean - public javax.validation.Validator localValidatorFactoryBean() { + public jakarta.validation.Validator localValidatorFactoryBean() { return new LocalValidatorFactoryBean(); } } diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/UnauthenticatedFilter.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/UnauthenticatedFilter.java index ba16d905f..ac88119e0 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/UnauthenticatedFilter.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/UnauthenticatedFilter.java @@ -1,14 +1,14 @@ package com.amazonaws.serverless.proxy.spring.echoapp; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/model/ValidatedUserModel.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/model/ValidatedUserModel.java index 56c157e83..1e5b83c37 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/model/ValidatedUserModel.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/model/ValidatedUserModel.java @@ -3,7 +3,7 @@ import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; public class ValidatedUserModel { @NotEmpty diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServlet.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServlet.java index 2b8604d3a..5c344b4d5 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServlet.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServlet.java @@ -2,9 +2,9 @@ import org.springframework.context.ApplicationContext; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; public class CustomServlet extends HttpServlet { diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServletTest.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServletTest.java index dd3d3fd71..5959a8110 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServletTest.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomServletTest.java @@ -4,7 +4,7 @@ import com.amazonaws.serverless.proxy.internal.testutils.MockLambdaContext; import org.junit.jupiter.api.Test; -import javax.ws.rs.HttpMethod; +import jakarta.ws.rs.HttpMethod; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomSpringLambdaContainerHandler.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomSpringLambdaContainerHandler.java index 3ed872330..4e5fe2783 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomSpringLambdaContainerHandler.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/extensibility/CustomSpringLambdaContainerHandler.java @@ -9,8 +9,8 @@ import com.amazonaws.serverless.proxy.spring.SpringLambdaContainerHandler; import org.springframework.web.context.ConfigurableWebApplicationContext; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.http.HttpServletRequest; public class CustomSpringLambdaContainerHandler extends SpringLambdaContainerHandler { diff --git a/aws-serverless-java-container-struts/src/main/java/com/amazonaws/serverless/proxy/struts/StrutsLambdaContainerHandler.java b/aws-serverless-java-container-struts/src/main/java/com/amazonaws/serverless/proxy/struts/StrutsLambdaContainerHandler.java index 09c460cfa..257de488c 100644 --- a/aws-serverless-java-container-struts/src/main/java/com/amazonaws/serverless/proxy/struts/StrutsLambdaContainerHandler.java +++ b/aws-serverless-java-container-struts/src/main/java/com/amazonaws/serverless/proxy/struts/StrutsLambdaContainerHandler.java @@ -35,10 +35,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; -import javax.servlet.Servlet; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.Servlet; +import jakarta.servlet.http.HttpServletRequest; import java.util.EnumSet; import java.util.concurrent.CountDownLatch; diff --git a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/StrutsAwsProxyTest.java b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/StrutsAwsProxyTest.java index f48547241..6d7e2a37f 100644 --- a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/StrutsAwsProxyTest.java +++ b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/StrutsAwsProxyTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; diff --git a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoAction.java b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoAction.java index d64a54eca..ad6c63180 100644 --- a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoAction.java +++ b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoAction.java @@ -4,8 +4,8 @@ import org.apache.commons.io.IOUtils; import org.apache.struts2.ServletActionContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoRequestInfoAction.java b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoRequestInfoAction.java index 554156e9d..e810f3197 100644 --- a/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoRequestInfoAction.java +++ b/aws-serverless-java-container-struts/src/test/java/com/amazonaws/serverless/proxy/struts/echoapp/EchoRequestInfoAction.java @@ -5,8 +5,8 @@ import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.ServletActionContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; diff --git a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/main/java/resource/PingResource.java b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/main/java/resource/PingResource.java index 137ed0302..1c56254fd 100644 --- a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/main/java/resource/PingResource.java +++ b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/main/java/resource/PingResource.java @@ -4,13 +4,13 @@ import java.util.Map; import java.util.HashMap; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; @Path("/ping") public class PingResource { diff --git a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java index 3f232ebc6..4a6b00b03 100644 --- a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -10,10 +10,10 @@ import org.junit.BeforeClass; import org.junit.Test; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-spark-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-spark-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java index 3f232ebc6..4a6b00b03 100644 --- a/aws-serverless-spark-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ b/aws-serverless-spark-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -10,10 +10,10 @@ import org.junit.BeforeClass; import org.junit.Test; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/main/java/SpringApiConfig.java b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/main/java/SpringApiConfig.java index 0982c6b04..83926b5dd 100644 --- a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/main/java/SpringApiConfig.java +++ b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/main/java/SpringApiConfig.java @@ -11,8 +11,8 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import ${groupId}.controller.PingController; diff --git a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java index 3f232ebc6..4a6b00b03 100644 --- a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -10,10 +10,10 @@ import org.junit.BeforeClass; import org.junit.Test; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java index 3f232ebc6..4a6b00b03 100644 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -10,10 +10,10 @@ import org.junit.BeforeClass; import org.junit.Test; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/aws-serverless-struts-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-struts-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java index 12fc9fc07..fd63840b5 100644 --- a/aws-serverless-struts-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ b/aws-serverless-struts-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -12,10 +12,10 @@ import org.junit.BeforeClass; import org.junit.Test; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/samples/jersey/pet-store/src/main/java/com/amazonaws/serverless/sample/jersey/PetsResource.java b/samples/jersey/pet-store/src/main/java/com/amazonaws/serverless/sample/jersey/PetsResource.java index 2d92510d7..c8ad7ebdd 100644 --- a/samples/jersey/pet-store/src/main/java/com/amazonaws/serverless/sample/jersey/PetsResource.java +++ b/samples/jersey/pet-store/src/main/java/com/amazonaws/serverless/sample/jersey/PetsResource.java @@ -15,9 +15,9 @@ import com.amazonaws.serverless.sample.jersey.model.Pet; import com.amazonaws.serverless.sample.jersey.model.PetData; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.UUID; @Path("/pets") diff --git a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/SparkResources.java b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/SparkResources.java index 7731a70b1..4794b7aec 100644 --- a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/SparkResources.java +++ b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/SparkResources.java @@ -5,7 +5,7 @@ import com.amazonaws.serverless.sample.spark.model.Pet; import com.amazonaws.serverless.sample.spark.model.PetData; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import java.util.UUID; diff --git a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/StreamLambdaHandler.java b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/StreamLambdaHandler.java index 40ace9d33..e02499103 100644 --- a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/StreamLambdaHandler.java +++ b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/StreamLambdaHandler.java @@ -12,8 +12,8 @@ import spark.Spark; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import java.io.IOException; import java.io.InputStream; diff --git a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/filter/CognitoIdentityFilter.java b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/filter/CognitoIdentityFilter.java index 3b0f5dd1f..e45370b0b 100644 --- a/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/filter/CognitoIdentityFilter.java +++ b/samples/spark/pet-store/src/main/java/com/amazonaws/serverless/sample/spark/filter/CognitoIdentityFilter.java @@ -7,12 +7,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import java.io.IOException; diff --git a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/PetStoreSpringAppConfig.java b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/PetStoreSpringAppConfig.java index 81179933c..5ac5403cd 100644 --- a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/PetStoreSpringAppConfig.java +++ b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/PetStoreSpringAppConfig.java @@ -22,8 +22,8 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; @Configuration diff --git a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/StreamLambdaHandler.java b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/StreamLambdaHandler.java index 71fb94cea..07675b3fe 100644 --- a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/StreamLambdaHandler.java +++ b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/StreamLambdaHandler.java @@ -10,8 +10,8 @@ import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestStreamHandler; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import java.io.IOException; import java.io.InputStream; diff --git a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/filter/CognitoIdentityFilter.java b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/filter/CognitoIdentityFilter.java index d9eefdc92..ec4242b81 100644 --- a/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/filter/CognitoIdentityFilter.java +++ b/samples/spring/pet-store/src/main/java/com/amazonaws/serverless/sample/spring/filter/CognitoIdentityFilter.java @@ -7,12 +7,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import java.io.IOException; diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java index d613fc073..aeb63a253 100644 --- a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java +++ b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java @@ -15,8 +15,8 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; @SpringBootApplication diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java index 01ea96630..6df4b5ede 100644 --- a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java +++ b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java @@ -10,8 +10,8 @@ import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestStreamHandler; -import javax.servlet.DispatcherType; -import javax.servlet.FilterRegistration; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.FilterRegistration; import java.io.IOException; import java.io.InputStream; diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java index 5c3482e40..1cc92708b 100644 --- a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java +++ b/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java @@ -7,12 +7,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import java.io.IOException; From 4db2388bfa9e2b81e30a6b4759f5f25268264448 Mon Sep 17 00:00:00 2001 From: Mbea Date: Sat, 1 Apr 2023 02:33:40 -0700 Subject: [PATCH 03/15] Update jersey.version to 3.11 to fix issues in JerseyHandlerFilter --- aws-serverless-java-container-jersey/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-serverless-java-container-jersey/pom.xml b/aws-serverless-java-container-jersey/pom.xml index ae8949859..6842a0d79 100644 --- a/aws-serverless-java-container-jersey/pom.xml +++ b/aws-serverless-java-container-jersey/pom.xml @@ -16,7 +16,7 @@ - 2.39.1 + 3.1.1 From 64721198723b63953f0430627d9c4370a53d6db0 Mon Sep 17 00:00:00 2001 From: Mbea Date: Sat, 1 Apr 2023 03:40:38 -0700 Subject: [PATCH 04/15] Upgrade jakarta.validation-api version to 3.0.2 to fix issue in UserData (cannot find symbol @NotBlank, @Email etc...) --- aws-serverless-java-container-springboot2/pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws-serverless-java-container-springboot2/pom.xml b/aws-serverless-java-container-springboot2/pom.xml index c955649d6..7e27942df 100644 --- a/aws-serverless-java-container-springboot2/pom.xml +++ b/aws-serverless-java-container-springboot2/pom.xml @@ -149,7 +149,7 @@ jakarta.validation jakarta.validation-api - 2.0.2 + 3.0.2 test @@ -175,6 +175,12 @@ jakarta.activation-api 2.1.0 + + jakarta.validation + jakarta.validation-api + 3.0.2 + test + From 8017ce6018a3a2dd0df641c655c9874ea11c2041 Mon Sep 17 00:00:00 2001 From: Mbea Date: Tue, 4 Apr 2023 21:58:02 -0700 Subject: [PATCH 05/15] Added jakarta.websocket-api 2.0.0 to fix java.lang.ExceptionInInitializerError in SecurityAppTest - Updated hibernate-validator version to 8.0.0.FINAL to fix failing test in ServletAppTest (jakarta.validation not working) - Updated Spring-core version to 6.0.7 to fix CVSS error --- aws-serverless-java-container-core/pom.xml | 12 +++++++ .../pom.xml | 33 ++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 7c2159d7c..0f2c13c55 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -99,10 +99,22 @@ + + + + + + +<<<<<<< HEAD org.apache.httpcomponents httpclient 4.5.14 +======= + org.apache.httpcomponents.client5 + httpclient5 + 5.2.1 +>>>>>>> 9d2d4d4 (Added jakarta.websocket-api 2.0.0 to fix java.lang.ExceptionInInitializerError in SecurityAppTest) test diff --git a/aws-serverless-java-container-springboot2/pom.xml b/aws-serverless-java-container-springboot2/pom.xml index 7e27942df..d98d44ca7 100644 --- a/aws-serverless-java-container-springboot2/pom.xml +++ b/aws-serverless-java-container-springboot2/pom.xml @@ -15,7 +15,7 @@ 1.10-SNAPSHOT - 6.0.5 + 6.0.7 3.0.4 6.0.2 17 @@ -146,30 +146,25 @@ test - - jakarta.validation - jakarta.validation-api - 3.0.2 - test - org.hibernate.validator hibernate-validator - 6.2.1.Final + 8.0.0.Final test + org.junit.jupiter junit-jupiter test - - - javax.activation - activation - 1.1.1 - test - + + + + + + + jakarta.activation jakarta.activation-api @@ -181,6 +176,14 @@ 3.0.2 test + + + jakarta.websocket + jakarta.websocket-api + 2.0.0 + provided + + From 1b6254e8cbe463f4f1293ccb7c2f94c160456421 Mon Sep 17 00:00:00 2001 From: Mbea Date: Wed, 5 Apr 2023 12:46:16 -0700 Subject: [PATCH 06/15] - Added jakarta-activation-api 2.1.0, jakarta.el-api 5.0.1 and org.glassfish:jakarta.el 5.0.0-M1 in Spring component's pom.xml -Updated the CommonsMultipartResolver to StandardServletMultipartResolver --- aws-serverless-java-container-spring/pom.xml | 30 +++++++++++-------- .../proxy/spring/echoapp/EchoResource.java | 6 ++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/aws-serverless-java-container-spring/pom.xml b/aws-serverless-java-container-spring/pom.xml index 444b95be0..830c8002b 100644 --- a/aws-serverless-java-container-spring/pom.xml +++ b/aws-serverless-java-container-spring/pom.xml @@ -16,8 +16,8 @@ - 5.3.27 - 5.7.8 + 6.0.7 + 6.0.2 @@ -60,18 +60,23 @@ + + + + + + - javax.activation - activation - 1.1.1 - test + jakarta.activation + jakarta.activation-api + 2.1.0 org.hibernate.validator hibernate-validator - 6.2.1.Final + 8.0.0.Final test @@ -81,18 +86,19 @@ - javax.el - javax.el-api - 3.0.0 + jakarta.el + jakarta.el-api + 5.0.1 test org.glassfish - javax.el - 3.0.0 + jakarta.el + 5.0.0-M1 test + org.springframework.security spring-security-config diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java index cfcc9f878..a6dd033a0 100644 --- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java +++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/echoapp/EchoResource.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartResolver; -import org.springframework.web.multipart.commons.CommonsMultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import jakarta.servlet.ServletContext; @@ -42,8 +42,8 @@ public class EchoResource { @Bean public MultipartResolver multipartResolver() { - CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); - multipartResolver.setMaxUploadSize(1000000); + MultipartResolver multipartResolver = new StandardServletMultipartResolver(); + //multipartResolver.setMaxUploadSize(1000000); return multipartResolver; } From 3abb8fc4db9dbf073b8c6def6b1f0238b71f5d74 Mon Sep 17 00:00:00 2001 From: Mbea Date: Wed, 5 Apr 2023 13:51:43 -0700 Subject: [PATCH 07/15] - added jakarta.ws.rs-api 3.1.0 to pom.xml in Jersey component to fix tests failing in JerseyAwsProxyTest class with error (java.lang.NoClassDefFoundError: jakarta/ws/rs/core/EntityPart) --- aws-serverless-java-container-jersey/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aws-serverless-java-container-jersey/pom.xml b/aws-serverless-java-container-jersey/pom.xml index 6842a0d79..ef4a43712 100644 --- a/aws-serverless-java-container-jersey/pom.xml +++ b/aws-serverless-java-container-jersey/pom.xml @@ -105,6 +105,13 @@ junit-jupiter test + + + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 + + From 43179c08ba1664b628a87da065a517dba45b8296 Mon Sep 17 00:00:00 2001 From: Mbea Date: Thu, 6 Apr 2023 01:37:21 -0700 Subject: [PATCH 08/15] - excluded Spark and struts modules from the build - updated dependencies versions in Jersey, Spring and SpringBoot archetypes --- .../resources/archetype-resources/pom.xml | 3 +- .../resources/archetype-resources/pom.xml | 2 +- aws-serverless-springboot2-archetype/pom.xml | 80 --------- .../META-INF/maven/archetype-metadata.xml | 39 ----- .../resources/archetype-resources/README.md | 99 ----------- .../archetype-resources/build.gradle | 29 ---- .../resources/archetype-resources/pom.xml | 155 ------------------ .../archetype-resources/src/assembly/bin.xml | 27 --- .../src/main/java/Application.java | 24 --- .../src/main/java/StreamLambdaHandler.java | 39 ----- .../main/java/controller/PingController.java | 20 --- .../src/main/resources/application.properties | 3 - .../test/java/StreamLambdaHandlerTest.java | 90 ---------- .../archetype-resources/template.yml | 52 ------ .../projects/base/archetype.properties | 3 - .../src/test/resources/projects/base/goal.txt | 1 - pom.xml | 8 +- 17 files changed, 7 insertions(+), 667 deletions(-) delete mode 100644 aws-serverless-springboot2-archetype/pom.xml delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/README.md delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/build.gradle delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/pom.xml delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/Application.java delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java delete mode 100644 aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/template.yml delete mode 100644 aws-serverless-springboot2-archetype/src/test/resources/projects/base/archetype.properties delete mode 100644 aws-serverless-springboot2-archetype/src/test/resources/projects/base/goal.txt diff --git a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/pom.xml index 1783f79a3..57dfdd6d7 100644 --- a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/pom.xml +++ b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/pom.xml @@ -14,7 +14,8 @@ 1.8 1.8 - 2.39.1 + + 3.1.1 2.15.0 diff --git a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/pom.xml index 3fbd51264..85e071a08 100644 --- a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/pom.xml +++ b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/pom.xml @@ -16,7 +16,7 @@ 1.8 1.8 - 5.3.27 + 6.0.7 4.13.2 2.19.0 diff --git a/aws-serverless-springboot2-archetype/pom.xml b/aws-serverless-springboot2-archetype/pom.xml deleted file mode 100644 index 1e7279dbf..000000000 --- a/aws-serverless-springboot2-archetype/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - 4.0.0 - - - com.amazonaws.serverless - aws-serverless-java-container - 1.10-SNAPSHOT - - - com.amazonaws.serverless.archetypes - aws-serverless-springboot2-archetype - 1.10-SNAPSHOT - maven-archetype - - - https://github.com/awslabs/aws-serverless-java-container.git - HEAD - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - src/main/resources - true - - archetype-resources/pom.xml - archetype-resources/README.md - - - - src/main/resources - false - - archetype-resources/pom.xml - - - - - - - org.apache.maven.archetype - archetype-packaging - 3.0.1 - - - - - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - \ - - - - org.apache.maven.plugins - maven-archetype-plugin - 3.0.1 - - - - integration-test - - - - - - - - diff --git a/aws-serverless-springboot2-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/aws-serverless-springboot2-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 5379692ba..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - src/main/java - - **/*.java - - - - src/main/resources - - **/*.properties - - - - src/test/java - - **/*.java - - - - src/assembly - - * - - - - - - template.yml - README.md - build.gradle - - - - \ No newline at end of file diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/README.md b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/README.md deleted file mode 100644 index 1017a83ad..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/README.md +++ /dev/null @@ -1,99 +0,0 @@ -#set($resourceName = $artifactId) -#macro(replaceChar $originalName, $char) - #if($originalName.contains($char)) - #set($tokens = $originalName.split($char)) - #set($newResourceName = "") - #foreach($token in $tokens) - #set($newResourceName = $newResourceName + $token.substring(0,1).toUpperCase() + $token.substring(1).toLowerCase()) - #end - ${newResourceName} - #else - #set($newResourceName = $originalName.substring(0,1).toUpperCase() + $originalName.substring(1)) - ${newResourceName} - #end -#end -#set($resourceName = "#replaceChar($resourceName, '-')") -#set($resourceName = "#replaceChar($resourceName, '.')") -#set($resourceName = $resourceName.replaceAll("\n", "").trim()) -# \${artifactId} serverless API -The \${artifactId} project, created with [`aws-serverless-java-container`](https://github.com/awslabs/aws-serverless-java-container). - -The starter project defines a simple `/ping` resource that can accept `GET` requests with its tests. - -The project folder also includes a `template.yml` file. You can use this [SAM](https://github.com/awslabs/serverless-application-model) file to deploy the project to AWS Lambda and Amazon API Gateway or test in local with the [SAM CLI](https://github.com/awslabs/aws-sam-cli). - -#[[##]]# Pre-requisites -* [AWS CLI](https://aws.amazon.com/cli/) -* [SAM CLI](https://github.com/awslabs/aws-sam-cli) -* [Gradle](https://gradle.org/) or [Maven](https://maven.apache.org/) - -#[[##]]# Building the project -You can use the SAM CLI to quickly build the project -```bash -$ mvn archetype:generate -DartifactId=\${artifactId} -DarchetypeGroupId=com.amazonaws.serverless.archetypes -DarchetypeArtifactId=aws-serverless-jersey-archetype -DarchetypeVersion=${project.version} -DgroupId=\${groupId} -Dversion=\${version} -Dinteractive=false -$ cd \${artifactId} -$ sam build -Building resource '\${resourceName}Function' -Running JavaGradleWorkflow:GradleBuild -Running JavaGradleWorkflow:CopyArtifacts - -Build Succeeded - -Built Artifacts : .aws-sam/build -Built Template : .aws-sam/build/template.yaml - -Commands you can use next -========================= -[*] Invoke Function: sam local invoke -[*] Deploy: sam deploy --guided -``` - -#[[##]]# Testing locally with the SAM CLI - -From the project root folder - where the `template.yml` file is located - start the API with the SAM CLI. - -```bash -$ sam local start-api - -... -Mounting ${groupId}.StreamLambdaHandler::handleRequest (java11) at http://127.0.0.1:3000/{proxy+} [OPTIONS GET HEAD POST PUT DELETE PATCH] -... -``` - -Using a new shell, you can send a test ping request to your API: - -```bash -$ curl -s http://127.0.0.1:3000/ping | python -m json.tool - -{ - "pong": "Hello, World!" -} -``` - -#[[##]]# Deploying to AWS -To deploy the application in your AWS account, you can use the SAM CLI's guided deployment process and follow the instructions on the screen - -``` -$ sam deploy --guided -``` - -Once the deployment is completed, the SAM CLI will print out the stack's outputs, including the new application URL. You can use `curl` or a web browser to make a call to the URL - -``` -... -------------------------------------------------------------------------------------------------------------- -OutputKey-Description OutputValue -------------------------------------------------------------------------------------------------------------- -\${resourceName}Api - URL for application https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/pets -------------------------------------------------------------------------------------------------------------- -``` - -Copy the `OutputValue` into a browser or use curl to test your first request: - -```bash -$ curl -s https://xxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/ping | python -m json.tool - -{ - "pong": "Hello, World!" -} -``` diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/build.gradle b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/build.gradle deleted file mode 100644 index d6946e7f0..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'java' - -repositories { - jcenter() - mavenLocal() - mavenCentral() -} - -dependencies { - implementation ( - 'org.springframework.boot:spring-boot-starter-web:2.7.11', - 'com.amazonaws.serverless:aws-serverless-java-container-springboot2:[1.0,)', - 'io.symphonia:lambda-logging:1.0.3' - ) - - testImplementation("junit:junit:4.13.2") -} - -task buildZip(type: Zip) { - from compileJava - from processResources - into('lib') { - from(configurations.compileClasspath) { - exclude 'tomcat-embed-*' - } - } -} - -build.dependsOn buildZip diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 53404bdb1..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ -#set($dollar = '$') - - - 4.0.0 - - \${groupId} - \${artifactId} - \${version} - jar - - Serverless Spring Boot 2 API - https://github.com/awslabs/aws-serverless-java-container - - - org.springframework.boot - spring-boot-starter-parent - 2.7.11 - - - - 1.8 - 1.8 - - - - - com.amazonaws.serverless - aws-serverless-java-container-springboot2 - ${project.version} - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - - junit - junit - 4.12 - test - - - - - - shaded-jar - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - false - - - - package - - shade - - - - - org.apache.tomcat.embed:* - - - - - - - - - - - assembly-zip - - true - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - default-jar - none - - - - - org.apache.maven.plugins - maven-install-plugin - 3.0.0-M1 - - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.2.0 - - - copy-dependencies - package - - copy-dependencies - - - ${dollar}{project.build.directory}${dollar}{file.separator}lib - runtime - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.3.0 - - - zip-assembly - package - - single - - - ${dollar}{project.artifactId}-${dollar}{project.version} - - src${dollar}{file.separator}assembly${dollar}{file.separator}bin.xml - - false - - - - - - - - - diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml deleted file mode 100644 index 1e085057d..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml +++ /dev/null @@ -1,27 +0,0 @@ - - lambda-package - - zip - - false - - - - ${project.build.directory}${file.separator}lib - lib - - tomcat-embed* - - - - - ${project.build.directory}${file.separator}classes - - ** - - ${file.separator} - - - \ No newline at end of file diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/Application.java b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/Application.java deleted file mode 100644 index 1b74086f7..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/Application.java +++ /dev/null @@ -1,24 +0,0 @@ -#macro(loggingOff) - logging.level.root:OFF -#end -#set($logging = "#loggingOff()") -#set($logging = $logging.replaceAll("\n", "").trim()) -package ${groupId}; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Import; - -import ${groupId}.controller.PingController; - - -@SpringBootApplication -// We use direct @Import instead of @ComponentScan to speed up cold starts -// @ComponentScan(basePackages = "${groupId}.controller") -@Import({ PingController.class }) -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } -} \ No newline at end of file diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java deleted file mode 100644 index dca9650d3..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -package ${groupId}; - - -import com.amazonaws.serverless.exceptions.ContainerInitializationException; -import com.amazonaws.serverless.proxy.model.AwsProxyRequest; -import com.amazonaws.serverless.proxy.model.AwsProxyResponse; -import com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler; -import com.amazonaws.services.lambda.runtime.Context; -import com.amazonaws.services.lambda.runtime.RequestStreamHandler; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - - -public class StreamLambdaHandler implements RequestStreamHandler { - private static SpringBootLambdaContainerHandler handler; - static { - try { - handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(Application.class); - // For applications that take longer than 10 seconds to start, use the async builder: - // handler = new SpringBootProxyHandlerBuilder() - // .defaultProxy() - // .asyncInit() - // .springBootApplication(Application.class) - // .buildAndInitialize(); - } catch (ContainerInitializationException e) { - // if we fail here. We re-throw the exception to force another cold start - e.printStackTrace(); - throw new RuntimeException("Could not initialize Spring Boot application", e); - } - } - - @Override - public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) - throws IOException { - handler.proxyStream(inputStream, outputStream, context); - } -} \ No newline at end of file diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java deleted file mode 100644 index 94f517f07..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java +++ /dev/null @@ -1,20 +0,0 @@ -package ${groupId}.controller; - - -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import java.util.HashMap; -import java.util.Map; - - -@RestController -@EnableWebMvc -public class PingController { - @RequestMapping(path = "/ping", method = RequestMethod.GET) - public Map ping() { - Map pong = new HashMap<>(); - pong.put("pong", "Hello, World!"); - return pong; - } -} diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties deleted file mode 100644 index ec1cb9792..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Reduce logging level to make sure the application works with SAM local -# https://github.com/awslabs/aws-serverless-java-container/issues/134 -logging.level.root=WARN \ No newline at end of file diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java deleted file mode 100644 index 4a6b00b03..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package ${groupId}; - - -import com.amazonaws.serverless.proxy.internal.LambdaContainerHandler; -import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; -import com.amazonaws.serverless.proxy.internal.testutils.MockLambdaContext; -import com.amazonaws.serverless.proxy.model.AwsProxyResponse; -import com.amazonaws.services.lambda.runtime.Context; - -import org.junit.BeforeClass; -import org.junit.Test; - -import jakarta.ws.rs.HttpMethod; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import static org.junit.Assert.*; - - -public class StreamLambdaHandlerTest { - - private static StreamLambdaHandler handler; - private static Context lambdaContext; - - @BeforeClass - public static void setUp() { - handler = new StreamLambdaHandler(); - lambdaContext = new MockLambdaContext(); - } - - @Test - public void ping_streamRequest_respondsWithHello() { - InputStream requestStream = new AwsProxyRequestBuilder("/ping", HttpMethod.GET) - .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - .buildStream(); - ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); - - handle(requestStream, responseStream); - - AwsProxyResponse response = readResponse(responseStream); - assertNotNull(response); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode()); - - assertFalse(response.isBase64Encoded()); - - assertTrue(response.getBody().contains("pong")); - assertTrue(response.getBody().contains("Hello, World!")); - - assertTrue(response.getMultiValueHeaders().containsKey(HttpHeaders.CONTENT_TYPE)); - assertTrue(response.getMultiValueHeaders().getFirst(HttpHeaders.CONTENT_TYPE).startsWith(MediaType.APPLICATION_JSON)); - } - - @Test - public void invalidResource_streamRequest_responds404() { - InputStream requestStream = new AwsProxyRequestBuilder("/pong", HttpMethod.GET) - .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - .buildStream(); - ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); - - handle(requestStream, responseStream); - - AwsProxyResponse response = readResponse(responseStream); - assertNotNull(response); - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode()); - } - - private void handle(InputStream is, ByteArrayOutputStream os) { - try { - handler.handleRequest(is, os, lambdaContext); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getMessage()); - } - } - - private AwsProxyResponse readResponse(ByteArrayOutputStream responseStream) { - try { - return LambdaContainerHandler.getObjectMapper().readValue(responseStream.toByteArray(), AwsProxyResponse.class); - } catch (IOException e) { - e.printStackTrace(); - fail("Error while parsing response: " + e.getMessage()); - } - return null; - } -} diff --git a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/template.yml b/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/template.yml deleted file mode 100644 index 8d8e0946a..000000000 --- a/aws-serverless-springboot2-archetype/src/main/resources/archetype-resources/template.yml +++ /dev/null @@ -1,52 +0,0 @@ -#set($resourceName = $artifactId) -#macro(replaceChar $originalName, $char) - #if($originalName.contains($char)) - #set($tokens = $originalName.split($char)) - #set($newResourceName = "") - #foreach($token in $tokens) - #set($newResourceName = $newResourceName + $token.substring(0,1).toUpperCase() + $token.substring(1).toLowerCase()) - #end - ${newResourceName} - #else - #set($newResourceName = $originalName.substring(0,1).toUpperCase() + $originalName.substring(1)) - ${newResourceName} - #end -#end -#set($resourceName = "#replaceChar($resourceName, '-')") -#set($resourceName = "#replaceChar($resourceName, '.')") -#set($resourceName = $resourceName.replaceAll("\n", "").trim()) -#macro(regionVar) - AWS::Region -#end -#set($awsRegion = "#regionVar()") -#set($awsRegion = $awsRegion.replaceAll("\n", "").trim()) -AWSTemplateFormatVersion: '2010-09-09' -Transform: AWS::Serverless-2016-10-31 -Description: AWS Serverless Spring Boot 2 API - ${groupId}::${artifactId} -Globals: - Api: - EndpointConfiguration: REGIONAL - -Resources: - ${resourceName}Function: - Type: AWS::Serverless::Function - Properties: - Handler: ${groupId}.StreamLambdaHandler::handleRequest - Runtime: java11 - CodeUri: . - MemorySize: 512 - Policies: AWSLambdaBasicExecutionRole - Timeout: 30 - Events: - ProxyResource: - Type: Api - Properties: - Path: /{proxy+} - Method: any - -Outputs: - ${resourceName}Api: - Description: URL for application - Value: !Sub 'https://${ServerlessRestApi}.execute-api.${${awsRegion}}.amazonaws.com/Prod/ping' - Export: - Name: ${resourceName}Api diff --git a/aws-serverless-springboot2-archetype/src/test/resources/projects/base/archetype.properties b/aws-serverless-springboot2-archetype/src/test/resources/projects/base/archetype.properties deleted file mode 100644 index 7df3bf6e1..000000000 --- a/aws-serverless-springboot2-archetype/src/test/resources/projects/base/archetype.properties +++ /dev/null @@ -1,3 +0,0 @@ -groupId=test.service -artifactId=springboot-archetype-test -version=1.0-SNAPSHOT diff --git a/aws-serverless-springboot2-archetype/src/test/resources/projects/base/goal.txt b/aws-serverless-springboot2-archetype/src/test/resources/projects/base/goal.txt deleted file mode 100644 index 597acc768..000000000 --- a/aws-serverless-springboot2-archetype/src/test/resources/projects/base/goal.txt +++ /dev/null @@ -1 +0,0 @@ -package \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3bf6fbf0d..babeeb899 100644 --- a/pom.xml +++ b/pom.xml @@ -27,13 +27,13 @@ aws-serverless-java-container-core aws-serverless-java-container-jersey - aws-serverless-java-container-spark + aws-serverless-java-container-spring - aws-serverless-java-container-struts + aws-serverless-java-container-springboot2 - aws-serverless-struts-archetype + aws-serverless-jersey-archetype - aws-serverless-spark-archetype + aws-serverless-spring-archetype aws-serverless-springboot2-archetype From 7639de8eabb5bd26b15402e94e9f7ff338a17f1f Mon Sep 17 00:00:00 2001 From: Mbea Date: Thu, 6 Apr 2023 01:58:50 -0700 Subject: [PATCH 09/15] chore: removed unnecessary comments --- aws-serverless-java-container-core/pom.xml | 15 --------------- aws-serverless-java-container-spring/pom.xml | 7 ------- aws-serverless-java-container-springboot2/pom.xml | 11 ++--------- pom.xml | 4 ---- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 0f2c13c55..32ff479c4 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -71,13 +71,6 @@ ${jackson.version} - - - org.apache.commons commons-fileupload2 @@ -89,7 +82,6 @@ 2.0.0 - org.apache.httpcomponents @@ -98,13 +90,6 @@ compile - - - - - - - <<<<<<< HEAD org.apache.httpcomponents diff --git a/aws-serverless-java-container-spring/pom.xml b/aws-serverless-java-container-spring/pom.xml index 830c8002b..286117995 100644 --- a/aws-serverless-java-container-spring/pom.xml +++ b/aws-serverless-java-container-spring/pom.xml @@ -59,13 +59,6 @@ test - - - - - - - jakarta.activation jakarta.activation-api diff --git a/aws-serverless-java-container-springboot2/pom.xml b/aws-serverless-java-container-springboot2/pom.xml index d98d44ca7..dddbf5520 100644 --- a/aws-serverless-java-container-springboot2/pom.xml +++ b/aws-serverless-java-container-springboot2/pom.xml @@ -28,7 +28,6 @@ aws-serverless-java-container-core 1.10-SNAPSHOT - org.springframework spring-webflux @@ -158,13 +157,7 @@ junit-jupiter test - - - - - - - + jakarta.activation jakarta.activation-api @@ -176,7 +169,7 @@ 3.0.2 test - + jakarta.websocket jakarta.websocket-api diff --git a/pom.xml b/pom.xml index babeeb899..b3439903b 100644 --- a/pom.xml +++ b/pom.xml @@ -27,13 +27,9 @@ aws-serverless-java-container-core aws-serverless-java-container-jersey - aws-serverless-java-container-spring - aws-serverless-java-container-springboot2 - aws-serverless-jersey-archetype - aws-serverless-spring-archetype aws-serverless-springboot2-archetype From 51642dc16b0204dfb67773fb622934e931bdf2fa Mon Sep 17 00:00:00 2001 From: Mbea Date: Thu, 6 Apr 2023 09:58:08 -0700 Subject: [PATCH 10/15] Renamed springboot2 directory and module to springboot3 --- .../pom.xml | 2 +- .../proxy/spring/SpringBootLambdaContainerHandler.java | 0 .../serverless/proxy/spring/SpringBootProxyHandlerBuilder.java | 0 .../ServerlessReactiveServletEmbeddedServerFactory.java | 0 .../spring/embedded/ServerlessServletEmbeddedServerFactory.java | 0 .../com/amazonaws/serverless/proxy/spring/SecurityAppTest.java | 0 .../com/amazonaws/serverless/proxy/spring/ServletAppTest.java | 0 .../java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java | 0 .../com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java | 0 .../embedded/ServerlessServletEmbeddedServerFactoryTest.java | 0 .../serverless/proxy/spring/securityapp/LambdaHandler.java | 0 .../serverless/proxy/spring/securityapp/MessageController.java | 0 .../proxy/spring/securityapp/SecurityApplication.java | 0 .../serverless/proxy/spring/securityapp/SecurityConfig.java | 0 .../serverless/proxy/spring/servletapp/LambdaHandler.java | 0 .../serverless/proxy/spring/servletapp/LambdaStreamHandler.java | 0 .../serverless/proxy/spring/servletapp/MessageController.java | 0 .../serverless/proxy/spring/servletapp/MessageData.java | 0 .../serverless/proxy/spring/servletapp/ServletApplication.java | 0 .../amazonaws/serverless/proxy/spring/servletapp/UserData.java | 0 .../serverless/proxy/spring/slowapp/LambdaHandler.java | 0 .../serverless/proxy/spring/slowapp/MessageController.java | 0 .../serverless/proxy/spring/slowapp/SlowTestApplication.java | 0 .../serverless/proxy/spring/webfluxapp/LambdaHandler.java | 0 .../serverless/proxy/spring/webfluxapp/MessageController.java | 0 .../serverless/proxy/spring/webfluxapp/MessageData.java | 0 .../proxy/spring/webfluxapp/WebFluxTestApplication.java | 0 pom.xml | 2 +- 28 files changed, 2 insertions(+), 2 deletions(-) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/pom.xml (99%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/LambdaHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/MessageController.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityApplication.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityConfig.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaStreamHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageData.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/ServletApplication.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/LambdaHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/MessageController.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/SlowTestApplication.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/LambdaHandler.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageController.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageData.java (100%) rename {aws-serverless-java-container-springboot2 => aws-serverless-java-container-springboot3}/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/WebFluxTestApplication.java (100%) diff --git a/aws-serverless-java-container-springboot2/pom.xml b/aws-serverless-java-container-springboot3/pom.xml similarity index 99% rename from aws-serverless-java-container-springboot2/pom.xml rename to aws-serverless-java-container-springboot3/pom.xml index dddbf5520..6f6679a1a 100644 --- a/aws-serverless-java-container-springboot2/pom.xml +++ b/aws-serverless-java-container-springboot3/pom.xml @@ -8,7 +8,7 @@ 4.0.0 com.amazonaws.serverless - aws-serverless-java-container-springboot2 + aws-serverless-java-container-springboot3 AWS Serverless Java container support - SpringBoot 2 implementation Allows Java applications written for SpringBoot 2 to run in AWS Lambda https://aws.amazon.com/lambda diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java b/aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java rename to aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootLambdaContainerHandler.java diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java b/aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java rename to aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/SpringBootProxyHandlerBuilder.java diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java b/aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java rename to aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessReactiveServletEmbeddedServerFactory.java diff --git a/aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java b/aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java rename to aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactory.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/SecurityAppTest.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/ServletAppTest.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/WebFluxAppTest.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/LambdaHandler.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/LambdaHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/LambdaHandler.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/LambdaHandler.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/MessageController.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/MessageController.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/MessageController.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/MessageController.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityApplication.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityApplication.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityApplication.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityApplication.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityConfig.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityConfig.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityConfig.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/securityapp/SecurityConfig.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaHandler.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaHandler.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaHandler.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaStreamHandler.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaStreamHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaStreamHandler.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/LambdaStreamHandler.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageController.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageData.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageData.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageData.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/MessageData.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/ServletApplication.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/ServletApplication.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/ServletApplication.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/ServletApplication.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/servletapp/UserData.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/LambdaHandler.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/LambdaHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/LambdaHandler.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/LambdaHandler.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/MessageController.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/MessageController.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/MessageController.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/MessageController.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/SlowTestApplication.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/SlowTestApplication.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/SlowTestApplication.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/slowapp/SlowTestApplication.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/LambdaHandler.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/LambdaHandler.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/LambdaHandler.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/LambdaHandler.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageController.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageController.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageController.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageController.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageData.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageData.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageData.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/MessageData.java diff --git a/aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/WebFluxTestApplication.java b/aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/WebFluxTestApplication.java similarity index 100% rename from aws-serverless-java-container-springboot2/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/WebFluxTestApplication.java rename to aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/webfluxapp/WebFluxTestApplication.java diff --git a/pom.xml b/pom.xml index b3439903b..cbcfda7f4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ aws-serverless-java-container-core aws-serverless-java-container-jersey aws-serverless-java-container-spring - aws-serverless-java-container-springboot2 + aws-serverless-java-container-springboot3 aws-serverless-jersey-archetype aws-serverless-spring-archetype aws-serverless-springboot2-archetype From dbdb614b167073c63834ed3f68db137c8578bde6 Mon Sep 17 00:00:00 2001 From: Mbea Date: Tue, 11 Apr 2023 10:22:15 -0700 Subject: [PATCH 11/15] fix: updated name and description in SpringBoot3 component pom.xml --- .../pom.xml | 4 +- aws-serverless-springboot3-archetype/pom.xml | 80 +++++++++ .../META-INF/maven/archetype-metadata.xml | 39 +++++ .../resources/archetype-resources/README.md | 99 +++++++++++ .../archetype-resources/build.gradle | 29 ++++ .../resources/archetype-resources/pom.xml | 155 ++++++++++++++++++ .../archetype-resources/src/assembly/bin.xml | 27 +++ .../src/main/java/Application.java | 24 +++ .../src/main/java/StreamLambdaHandler.java | 39 +++++ .../main/java/controller/PingController.java | 20 +++ .../src/main/resources/application.properties | 3 + .../test/java/StreamLambdaHandlerTest.java | 90 ++++++++++ .../archetype-resources/template.yml | 52 ++++++ .../projects/base/archetype.properties | 3 + .../src/test/resources/projects/base/goal.txt | 1 + pom.xml | 2 +- 16 files changed, 664 insertions(+), 3 deletions(-) create mode 100644 aws-serverless-springboot3-archetype/pom.xml create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/README.md create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/build.gradle create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/Application.java create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java create mode 100644 aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/template.yml create mode 100644 aws-serverless-springboot3-archetype/src/test/resources/projects/base/archetype.properties create mode 100644 aws-serverless-springboot3-archetype/src/test/resources/projects/base/goal.txt diff --git a/aws-serverless-java-container-springboot3/pom.xml b/aws-serverless-java-container-springboot3/pom.xml index 6f6679a1a..e810ecdf7 100644 --- a/aws-serverless-java-container-springboot3/pom.xml +++ b/aws-serverless-java-container-springboot3/pom.xml @@ -9,8 +9,8 @@ com.amazonaws.serverless aws-serverless-java-container-springboot3 - AWS Serverless Java container support - SpringBoot 2 implementation - Allows Java applications written for SpringBoot 2 to run in AWS Lambda + AWS Serverless Java container support - SpringBoot 3 implementation + Allows Java applications written for SpringBoot 3 to run in AWS Lambda https://aws.amazon.com/lambda 1.10-SNAPSHOT diff --git a/aws-serverless-springboot3-archetype/pom.xml b/aws-serverless-springboot3-archetype/pom.xml new file mode 100644 index 000000000..4003610a3 --- /dev/null +++ b/aws-serverless-springboot3-archetype/pom.xml @@ -0,0 +1,80 @@ + + 4.0.0 + + + com.amazonaws.serverless + aws-serverless-java-container + 1.10-SNAPSHOT + + + com.amazonaws.serverless.archetypes + aws-serverless-springboot3-archetype + 1.10-SNAPSHOT + maven-archetype + + + https://github.com/awslabs/aws-serverless-java-container.git + HEAD + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + src/main/resources + true + + archetype-resources/pom.xml + archetype-resources/README.md + + + + src/main/resources + false + + archetype-resources/pom.xml + + + + + + + org.apache.maven.archetype + archetype-packaging + 3.0.1 + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + \ + + + + org.apache.maven.plugins + maven-archetype-plugin + 3.0.1 + + + + integration-test + + + + + + + + diff --git a/aws-serverless-springboot3-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/aws-serverless-springboot3-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 000000000..5379692ba --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,39 @@ + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/*.properties + + + + src/test/java + + **/*.java + + + + src/assembly + + * + + + + + + template.yml + README.md + build.gradle + + + + \ No newline at end of file diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/README.md b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/README.md new file mode 100644 index 000000000..1017a83ad --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/README.md @@ -0,0 +1,99 @@ +#set($resourceName = $artifactId) +#macro(replaceChar $originalName, $char) + #if($originalName.contains($char)) + #set($tokens = $originalName.split($char)) + #set($newResourceName = "") + #foreach($token in $tokens) + #set($newResourceName = $newResourceName + $token.substring(0,1).toUpperCase() + $token.substring(1).toLowerCase()) + #end + ${newResourceName} + #else + #set($newResourceName = $originalName.substring(0,1).toUpperCase() + $originalName.substring(1)) + ${newResourceName} + #end +#end +#set($resourceName = "#replaceChar($resourceName, '-')") +#set($resourceName = "#replaceChar($resourceName, '.')") +#set($resourceName = $resourceName.replaceAll("\n", "").trim()) +# \${artifactId} serverless API +The \${artifactId} project, created with [`aws-serverless-java-container`](https://github.com/awslabs/aws-serverless-java-container). + +The starter project defines a simple `/ping` resource that can accept `GET` requests with its tests. + +The project folder also includes a `template.yml` file. You can use this [SAM](https://github.com/awslabs/serverless-application-model) file to deploy the project to AWS Lambda and Amazon API Gateway or test in local with the [SAM CLI](https://github.com/awslabs/aws-sam-cli). + +#[[##]]# Pre-requisites +* [AWS CLI](https://aws.amazon.com/cli/) +* [SAM CLI](https://github.com/awslabs/aws-sam-cli) +* [Gradle](https://gradle.org/) or [Maven](https://maven.apache.org/) + +#[[##]]# Building the project +You can use the SAM CLI to quickly build the project +```bash +$ mvn archetype:generate -DartifactId=\${artifactId} -DarchetypeGroupId=com.amazonaws.serverless.archetypes -DarchetypeArtifactId=aws-serverless-jersey-archetype -DarchetypeVersion=${project.version} -DgroupId=\${groupId} -Dversion=\${version} -Dinteractive=false +$ cd \${artifactId} +$ sam build +Building resource '\${resourceName}Function' +Running JavaGradleWorkflow:GradleBuild +Running JavaGradleWorkflow:CopyArtifacts + +Build Succeeded + +Built Artifacts : .aws-sam/build +Built Template : .aws-sam/build/template.yaml + +Commands you can use next +========================= +[*] Invoke Function: sam local invoke +[*] Deploy: sam deploy --guided +``` + +#[[##]]# Testing locally with the SAM CLI + +From the project root folder - where the `template.yml` file is located - start the API with the SAM CLI. + +```bash +$ sam local start-api + +... +Mounting ${groupId}.StreamLambdaHandler::handleRequest (java11) at http://127.0.0.1:3000/{proxy+} [OPTIONS GET HEAD POST PUT DELETE PATCH] +... +``` + +Using a new shell, you can send a test ping request to your API: + +```bash +$ curl -s http://127.0.0.1:3000/ping | python -m json.tool + +{ + "pong": "Hello, World!" +} +``` + +#[[##]]# Deploying to AWS +To deploy the application in your AWS account, you can use the SAM CLI's guided deployment process and follow the instructions on the screen + +``` +$ sam deploy --guided +``` + +Once the deployment is completed, the SAM CLI will print out the stack's outputs, including the new application URL. You can use `curl` or a web browser to make a call to the URL + +``` +... +------------------------------------------------------------------------------------------------------------- +OutputKey-Description OutputValue +------------------------------------------------------------------------------------------------------------- +\${resourceName}Api - URL for application https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/pets +------------------------------------------------------------------------------------------------------------- +``` + +Copy the `OutputValue` into a browser or use curl to test your first request: + +```bash +$ curl -s https://xxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/ping | python -m json.tool + +{ + "pong": "Hello, World!" +} +``` diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/build.gradle b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/build.gradle new file mode 100644 index 000000000..36a13b5d7 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'java' + +repositories { + jcenter() + mavenLocal() + mavenCentral() +} + +dependencies { + implementation ( + 'org.springframework.boot:spring-boot-starter-web:2.7.10', + 'com.amazonaws.serverless:aws-serverless-java-container-springboot2:[1.0,)', + 'io.symphonia:lambda-logging:1.0.3' + ) + + testImplementation("junit:junit:4.13.2") +} + +task buildZip(type: Zip) { + from compileJava + from processResources + into('lib') { + from(configurations.compileClasspath) { + exclude 'tomcat-embed-*' + } + } +} + +build.dependsOn buildZip diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 000000000..1489ddf24 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,155 @@ +#set($dollar = '$') + + + 4.0.0 + + \${groupId} + \${artifactId} + \${version} + jar + + Serverless Spring Boot 2 API + https://github.com/awslabs/aws-serverless-java-container + + + org.springframework.boot + spring-boot-starter-parent + 3.0.4 + + + + 1.8 + 1.8 + + + + + com.amazonaws.serverless + aws-serverless-java-container-springboot2 + ${project.version} + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + junit + junit + 4.12 + test + + + + + + shaded-jar + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + false + + + + package + + shade + + + + + org.apache.tomcat.embed:* + + + + + + + + + + + assembly-zip + + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + default-jar + none + + + + + org.apache.maven.plugins + maven-install-plugin + 3.0.0-M1 + + true + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.2.0 + + + copy-dependencies + package + + copy-dependencies + + + ${dollar}{project.build.directory}${dollar}{file.separator}lib + runtime + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + zip-assembly + package + + single + + + ${dollar}{project.artifactId}-${dollar}{project.version} + + src${dollar}{file.separator}assembly${dollar}{file.separator}bin.xml + + false + + + + + + + + + diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml new file mode 100644 index 000000000..1e085057d --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/assembly/bin.xml @@ -0,0 +1,27 @@ + + lambda-package + + zip + + false + + + + ${project.build.directory}${file.separator}lib + lib + + tomcat-embed* + + + + + ${project.build.directory}${file.separator}classes + + ** + + ${file.separator} + + + \ No newline at end of file diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/Application.java b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/Application.java new file mode 100644 index 000000000..1b74086f7 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/Application.java @@ -0,0 +1,24 @@ +#macro(loggingOff) + logging.level.root:OFF +#end +#set($logging = "#loggingOff()") +#set($logging = $logging.replaceAll("\n", "").trim()) +package ${groupId}; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +import ${groupId}.controller.PingController; + + +@SpringBootApplication +// We use direct @Import instead of @ComponentScan to speed up cold starts +// @ComponentScan(basePackages = "${groupId}.controller") +@Import({ PingController.class }) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java new file mode 100644 index 000000000..dca9650d3 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambdaHandler.java @@ -0,0 +1,39 @@ +package ${groupId}; + + +import com.amazonaws.serverless.exceptions.ContainerInitializationException; +import com.amazonaws.serverless.proxy.model.AwsProxyRequest; +import com.amazonaws.serverless.proxy.model.AwsProxyResponse; +import com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler; +import com.amazonaws.services.lambda.runtime.Context; +import com.amazonaws.services.lambda.runtime.RequestStreamHandler; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + + +public class StreamLambdaHandler implements RequestStreamHandler { + private static SpringBootLambdaContainerHandler handler; + static { + try { + handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(Application.class); + // For applications that take longer than 10 seconds to start, use the async builder: + // handler = new SpringBootProxyHandlerBuilder() + // .defaultProxy() + // .asyncInit() + // .springBootApplication(Application.class) + // .buildAndInitialize(); + } catch (ContainerInitializationException e) { + // if we fail here. We re-throw the exception to force another cold start + e.printStackTrace(); + throw new RuntimeException("Could not initialize Spring Boot application", e); + } + } + + @Override + public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) + throws IOException { + handler.proxyStream(inputStream, outputStream, context); + } +} \ No newline at end of file diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java new file mode 100644 index 000000000..94f517f07 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/java/controller/PingController.java @@ -0,0 +1,20 @@ +package ${groupId}.controller; + + +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +import java.util.HashMap; +import java.util.Map; + + +@RestController +@EnableWebMvc +public class PingController { + @RequestMapping(path = "/ping", method = RequestMethod.GET) + public Map ping() { + Map pong = new HashMap<>(); + pong.put("pong", "Hello, World!"); + return pong; + } +} diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties new file mode 100644 index 000000000..ec1cb9792 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/main/resources/application.properties @@ -0,0 +1,3 @@ +# Reduce logging level to make sure the application works with SAM local +# https://github.com/awslabs/aws-serverless-java-container/issues/134 +logging.level.root=WARN \ No newline at end of file diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java new file mode 100644 index 000000000..4a6b00b03 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/src/test/java/StreamLambdaHandlerTest.java @@ -0,0 +1,90 @@ +package ${groupId}; + + +import com.amazonaws.serverless.proxy.internal.LambdaContainerHandler; +import com.amazonaws.serverless.proxy.internal.testutils.AwsProxyRequestBuilder; +import com.amazonaws.serverless.proxy.internal.testutils.MockLambdaContext; +import com.amazonaws.serverless.proxy.model.AwsProxyResponse; +import com.amazonaws.services.lambda.runtime.Context; + +import org.junit.BeforeClass; +import org.junit.Test; + +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.Assert.*; + + +public class StreamLambdaHandlerTest { + + private static StreamLambdaHandler handler; + private static Context lambdaContext; + + @BeforeClass + public static void setUp() { + handler = new StreamLambdaHandler(); + lambdaContext = new MockLambdaContext(); + } + + @Test + public void ping_streamRequest_respondsWithHello() { + InputStream requestStream = new AwsProxyRequestBuilder("/ping", HttpMethod.GET) + .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) + .buildStream(); + ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); + + handle(requestStream, responseStream); + + AwsProxyResponse response = readResponse(responseStream); + assertNotNull(response); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode()); + + assertFalse(response.isBase64Encoded()); + + assertTrue(response.getBody().contains("pong")); + assertTrue(response.getBody().contains("Hello, World!")); + + assertTrue(response.getMultiValueHeaders().containsKey(HttpHeaders.CONTENT_TYPE)); + assertTrue(response.getMultiValueHeaders().getFirst(HttpHeaders.CONTENT_TYPE).startsWith(MediaType.APPLICATION_JSON)); + } + + @Test + public void invalidResource_streamRequest_responds404() { + InputStream requestStream = new AwsProxyRequestBuilder("/pong", HttpMethod.GET) + .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) + .buildStream(); + ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); + + handle(requestStream, responseStream); + + AwsProxyResponse response = readResponse(responseStream); + assertNotNull(response); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode()); + } + + private void handle(InputStream is, ByteArrayOutputStream os) { + try { + handler.handleRequest(is, os, lambdaContext); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + private AwsProxyResponse readResponse(ByteArrayOutputStream responseStream) { + try { + return LambdaContainerHandler.getObjectMapper().readValue(responseStream.toByteArray(), AwsProxyResponse.class); + } catch (IOException e) { + e.printStackTrace(); + fail("Error while parsing response: " + e.getMessage()); + } + return null; + } +} diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/template.yml b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/template.yml new file mode 100644 index 000000000..8d8e0946a --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/template.yml @@ -0,0 +1,52 @@ +#set($resourceName = $artifactId) +#macro(replaceChar $originalName, $char) + #if($originalName.contains($char)) + #set($tokens = $originalName.split($char)) + #set($newResourceName = "") + #foreach($token in $tokens) + #set($newResourceName = $newResourceName + $token.substring(0,1).toUpperCase() + $token.substring(1).toLowerCase()) + #end + ${newResourceName} + #else + #set($newResourceName = $originalName.substring(0,1).toUpperCase() + $originalName.substring(1)) + ${newResourceName} + #end +#end +#set($resourceName = "#replaceChar($resourceName, '-')") +#set($resourceName = "#replaceChar($resourceName, '.')") +#set($resourceName = $resourceName.replaceAll("\n", "").trim()) +#macro(regionVar) + AWS::Region +#end +#set($awsRegion = "#regionVar()") +#set($awsRegion = $awsRegion.replaceAll("\n", "").trim()) +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: AWS Serverless Spring Boot 2 API - ${groupId}::${artifactId} +Globals: + Api: + EndpointConfiguration: REGIONAL + +Resources: + ${resourceName}Function: + Type: AWS::Serverless::Function + Properties: + Handler: ${groupId}.StreamLambdaHandler::handleRequest + Runtime: java11 + CodeUri: . + MemorySize: 512 + Policies: AWSLambdaBasicExecutionRole + Timeout: 30 + Events: + ProxyResource: + Type: Api + Properties: + Path: /{proxy+} + Method: any + +Outputs: + ${resourceName}Api: + Description: URL for application + Value: !Sub 'https://${ServerlessRestApi}.execute-api.${${awsRegion}}.amazonaws.com/Prod/ping' + Export: + Name: ${resourceName}Api diff --git a/aws-serverless-springboot3-archetype/src/test/resources/projects/base/archetype.properties b/aws-serverless-springboot3-archetype/src/test/resources/projects/base/archetype.properties new file mode 100644 index 000000000..7df3bf6e1 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/test/resources/projects/base/archetype.properties @@ -0,0 +1,3 @@ +groupId=test.service +artifactId=springboot-archetype-test +version=1.0-SNAPSHOT diff --git a/aws-serverless-springboot3-archetype/src/test/resources/projects/base/goal.txt b/aws-serverless-springboot3-archetype/src/test/resources/projects/base/goal.txt new file mode 100644 index 000000000..597acc768 --- /dev/null +++ b/aws-serverless-springboot3-archetype/src/test/resources/projects/base/goal.txt @@ -0,0 +1 @@ +package \ No newline at end of file diff --git a/pom.xml b/pom.xml index cbcfda7f4..08627db23 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ aws-serverless-java-container-springboot3 aws-serverless-jersey-archetype aws-serverless-spring-archetype - aws-serverless-springboot2-archetype + aws-serverless-springboot3-archetype From 578e3d7778248a9b176d50f9d4e6cb991c309842 Mon Sep 17 00:00:00 2001 From: Mbea Date: Fri, 14 Apr 2023 10:43:57 -0700 Subject: [PATCH 12/15] - Updated the pet-store samples - Updated some dependencies versions --- aws-serverless-java-container-core/pom.xml | 22 +++++++------------ .../internal/servlet/AwsServletContext.java | 18 +++++++-------- aws-serverless-java-container-spring/pom.xml | 7 +++--- .../pom.xml | 2 +- .../resources/archetype-resources/pom.xml | 2 +- samples/jersey/pet-store/pom.xml | 4 ++-- samples/quarkus/pet-store/pom.xml | 4 ++-- samples/spring/pet-store/pom.xml | 7 +++--- samples/spring/pet-store/template.yml | 2 +- .../pet-store/README.md | 0 .../pet-store/build.gradle | 0 .../pet-store/pom.xml | 11 +++++----- .../pet-store/src/assembly/bin.xml | 0 .../sample/springboot3}/Application.java | 0 .../springboot3}/StreamLambdaHandler.java | 0 .../controller/PetsController.java | 0 .../filter/CognitoIdentityFilter.java | 0 .../sample/springboot3}/model/Error.java | 0 .../sample/springboot3}/model/Pet.java | 0 .../sample/springboot3}/model/PetData.java | 0 .../pet-store/src/main/resources/logback.xml | 0 .../pet-store/template.yml | 4 ++-- 22 files changed, 38 insertions(+), 45 deletions(-) rename samples/{springboot2 => springboot3}/pet-store/README.md (100%) rename samples/{springboot2 => springboot3}/pet-store/build.gradle (100%) rename samples/{springboot2 => springboot3}/pet-store/pom.xml (96%) rename samples/{springboot2 => springboot3}/pet-store/src/assembly/bin.xml (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/Application.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/StreamLambdaHandler.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/controller/PetsController.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/filter/CognitoIdentityFilter.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/model/Error.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/model/Pet.java (100%) rename samples/{springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2 => springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3}/model/PetData.java (100%) rename samples/{springboot2 => springboot3}/pet-store/src/main/resources/logback.xml (100%) rename samples/{springboot2 => springboot3}/pet-store/template.yml (90%) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 32ff479c4..0f0bf9516 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -16,7 +16,7 @@ - 2.1.1 + 3.1.0 5.0.0 @@ -47,14 +47,14 @@ jakarta.servlet jakarta.servlet-api - 5.0.0 + ${servlet.version} jakarta.ws.rs jakarta.ws.rs-api - 3.0.0-M1 + ${jaxrs.version} @@ -79,7 +79,7 @@ org.eclipse.angus angus-mail - 2.0.0 + 2.0.1 @@ -91,15 +91,9 @@ -<<<<<<< HEAD - org.apache.httpcomponents - httpclient - 4.5.14 -======= org.apache.httpcomponents.client5 httpclient5 5.2.1 ->>>>>>> 9d2d4d4 (Added jakarta.websocket-api 2.0.0 to fix java.lang.ExceptionInInitializerError in SecurityAppTest) test @@ -118,9 +112,9 @@ test - org.apache.httpcomponents - httpcore - 4.4.16 + org.apache.httpcomponents.core5 + httpcore5 + 5.2.1 compile true @@ -134,7 +128,7 @@ jakarta.activation jakarta.activation-api - 2.1.0 + 2.1.1 diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java index 4531b14ae..e1688c9fc 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java @@ -46,8 +46,8 @@ public class AwsServletContext //------------------------------------------------------------- // Constants - Public // ------------------------------------------------------------- - public static final int SERVLET_API_MAJOR_VERSION = 3; - public static final int SERVLET_API_MINOR_VERSION = 1; + public static final int SERVLET_API_MAJOR_VERSION = 5; + public static final int SERVLET_API_MINOR_VERSION = 0; public static final String SERVER_INFO = LambdaContainerHandler.SERVER_INFO + "/" + SERVLET_API_MAJOR_VERSION + "." + SERVLET_API_MINOR_VERSION; @@ -98,32 +98,32 @@ public String getContextPath() { @Override public void setResponseCharacterEncoding(String encoding) { - // do nothing; + throw new UnsupportedOperationException(); } @Override public String getResponseCharacterEncoding() { - return ""; + return null; } @Override public void setRequestCharacterEncoding(String encoding) { - // do nothing; + throw new UnsupportedOperationException(); } @Override public String getRequestCharacterEncoding() { - return ""; + return null; } @Override public void setSessionTimeout(int sessionTimeout) { - // do nothing; + throw new UnsupportedOperationException(); } @Override public int getSessionTimeout() { - return 1; + return 15; } @@ -379,7 +379,7 @@ public ServletRegistration.Dynamic addServlet(String s, Class @Override public ServletRegistration.Dynamic addJspFile(String s, String s1) { - return null; + throw new UnsupportedOperationException(); } diff --git a/aws-serverless-java-container-spring/pom.xml b/aws-serverless-java-container-spring/pom.xml index 286117995..f1ae95db2 100644 --- a/aws-serverless-java-container-spring/pom.xml +++ b/aws-serverless-java-container-spring/pom.xml @@ -63,6 +63,7 @@ jakarta.activation jakarta.activation-api 2.1.0 + test @@ -86,9 +87,9 @@ - org.glassfish - jakarta.el - 5.0.0-M1 + org.glassfish.expressly + expressly + 5.0.0 test diff --git a/aws-serverless-java-container-springboot3/pom.xml b/aws-serverless-java-container-springboot3/pom.xml index e810ecdf7..08856cf54 100644 --- a/aws-serverless-java-container-springboot3/pom.xml +++ b/aws-serverless-java-container-springboot3/pom.xml @@ -16,7 +16,7 @@ 6.0.7 - 3.0.4 + 3.0.5 6.0.2 17 diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml index 1489ddf24..edb821900 100644 --- a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml @@ -16,7 +16,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.4 + 3.0.5 diff --git a/samples/jersey/pet-store/pom.xml b/samples/jersey/pet-store/pom.xml index f6b5bed42..2f0b8f567 100644 --- a/samples/jersey/pet-store/pom.xml +++ b/samples/jersey/pet-store/pom.xml @@ -26,8 +26,8 @@ 1.8 1.8 - 2.39.1 - 2.15.0 + 3.1.1 + 2.14.2 diff --git a/samples/quarkus/pet-store/pom.xml b/samples/quarkus/pet-store/pom.xml index 0147be882..5484ffade 100644 --- a/samples/quarkus/pet-store/pom.xml +++ b/samples/quarkus/pet-store/pom.xml @@ -8,8 +8,8 @@ 3.8.1 true - 1.8 - 1.8 + 17.0.6 + 17.0.6 UTF-8 UTF-8 1.0.1.Final diff --git a/samples/spring/pet-store/pom.xml b/samples/spring/pet-store/pom.xml index 73cf9dc1a..0b85ff945 100644 --- a/samples/spring/pet-store/pom.xml +++ b/samples/spring/pet-store/pom.xml @@ -24,9 +24,8 @@ - 1.8 - 1.8 - 5.3.27 + 17 + 6.0.7 4.13.2 2.19.0 @@ -35,7 +34,7 @@ com.amazonaws.serverless aws-serverless-java-container-spring - [1.9,) + [2.0,) diff --git a/samples/spring/pet-store/template.yml b/samples/spring/pet-store/template.yml index c485cf4c6..5a029f8ae 100644 --- a/samples/spring/pet-store/template.yml +++ b/samples/spring/pet-store/template.yml @@ -12,7 +12,7 @@ Resources: Type: AWS::Serverless::Function Properties: Handler: com.amazonaws.serverless.sample.spring.StreamLambdaHandler::handleRequest - Runtime: java11 + Runtime: java17 CodeUri: . MemorySize: 512 Policies: AWSLambdaBasicExecutionRole diff --git a/samples/springboot2/pet-store/README.md b/samples/springboot3/pet-store/README.md similarity index 100% rename from samples/springboot2/pet-store/README.md rename to samples/springboot3/pet-store/README.md diff --git a/samples/springboot2/pet-store/build.gradle b/samples/springboot3/pet-store/build.gradle similarity index 100% rename from samples/springboot2/pet-store/build.gradle rename to samples/springboot3/pet-store/build.gradle diff --git a/samples/springboot2/pet-store/pom.xml b/samples/springboot3/pet-store/pom.xml similarity index 96% rename from samples/springboot2/pet-store/pom.xml rename to samples/springboot3/pet-store/pom.xml index 534d565d7..dc1dcc36f 100644 --- a/samples/springboot2/pet-store/pom.xml +++ b/samples/springboot3/pet-store/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.amazonaws.serverless.sample - serverless-springboot2-example + serverless-springboot3-example 1.0-SNAPSHOT Spring Boot example for the aws-serverless-java-container library Simple pet store written with the Spring framework and Spring Boot @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.11 + 3.0.5 @@ -25,8 +25,7 @@ - 1.8 - 1.8 + 17 @@ -43,8 +42,8 @@ com.amazonaws.serverless - aws-serverless-java-container-springboot2 - [1.6,) + aws-serverless-java-container-springboot3 + [2.0,) diff --git a/samples/springboot2/pet-store/src/assembly/bin.xml b/samples/springboot3/pet-store/src/assembly/bin.xml similarity index 100% rename from samples/springboot2/pet-store/src/assembly/bin.xml rename to samples/springboot3/pet-store/src/assembly/bin.xml diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/Application.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/Application.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/StreamLambdaHandler.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/StreamLambdaHandler.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/controller/PetsController.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/controller/PetsController.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/controller/PetsController.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/controller/PetsController.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/filter/CognitoIdentityFilter.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/filter/CognitoIdentityFilter.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/filter/CognitoIdentityFilter.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/Error.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/Error.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/Error.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/Error.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/Pet.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/Pet.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/Pet.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/Pet.java diff --git a/samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/PetData.java b/samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/PetData.java similarity index 100% rename from samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/model/PetData.java rename to samples/springboot3/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot3/model/PetData.java diff --git a/samples/springboot2/pet-store/src/main/resources/logback.xml b/samples/springboot3/pet-store/src/main/resources/logback.xml similarity index 100% rename from samples/springboot2/pet-store/src/main/resources/logback.xml rename to samples/springboot3/pet-store/src/main/resources/logback.xml diff --git a/samples/springboot2/pet-store/template.yml b/samples/springboot3/pet-store/template.yml similarity index 90% rename from samples/springboot2/pet-store/template.yml rename to samples/springboot3/pet-store/template.yml index c7a17276f..ec78e3ebe 100644 --- a/samples/springboot2/pet-store/template.yml +++ b/samples/springboot3/pet-store/template.yml @@ -11,8 +11,8 @@ Resources: PetStoreFunction: Type: AWS::Serverless::Function Properties: - Handler: com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler::handleRequest - Runtime: java11 + Handler: com.amazonaws.serverless.sample.springboot3.StreamLambdaHandler::handleRequest + Runtime: java17 CodeUri: . MemorySize: 1512 Policies: AWSLambdaBasicExecutionRole From d41e9c5ad9dbcb502bdc43cccb630b89c0f7a3d3 Mon Sep 17 00:00:00 2001 From: mbfreder Date: Mon, 17 Apr 2023 00:49:15 -0700 Subject: [PATCH 13/15] - moved to Servlet 6.0.0 - updated build.gradle files to be aligned to the Maven poms - moved all poms to 2.0-SNAPSHOT --- aws-serverless-java-container-core/pom.xml | 6 ++-- .../AwsHttpApiV2ProxyHttpServletRequest.java | 21 +++++++---- .../servlet/AwsHttpServletRequest.java | 1 - .../servlet/AwsHttpServletRequestWrapper.java | 25 +++++++------ .../servlet/AwsHttpServletResponse.java | 36 +++++++++---------- .../internal/servlet/AwsHttpSession.java | 31 ---------------- .../servlet/AwsProxyRequestDispatcher.java | 6 +--- .../internal/servlet/AwsServletContext.java | 35 +----------------- .../servlet/AwsFilterChainManagerTest.java | 4 +-- .../internal/servlet/AwsHttpSessionTest.java | 28 --------------- .../servlet/AwsServletContextTest.java | 5 ++- aws-serverless-java-container-jersey/pom.xml | 6 ++-- aws-serverless-java-container-spring/pom.xml | 8 ++--- .../pom.xml | 8 ++--- aws-serverless-jersey-archetype/pom.xml | 4 +-- aws-serverless-spring-archetype/pom.xml | 4 +-- aws-serverless-springboot3-archetype/pom.xml | 4 +-- .../resources/archetype-resources/pom.xml | 7 ++-- pom.xml | 2 +- samples/jersey/pet-store/build.gradle | 8 ++--- samples/jersey/pet-store/pom.xml | 4 +-- samples/micronaut/pet-store/build.gradle | 10 +++--- samples/quarkus/pet-store/pom.xml | 2 +- samples/spring/pet-store/build.gradle | 6 ++-- samples/spring/pet-store/pom.xml | 5 +-- samples/springboot3/pet-store/build.gradle | 4 +-- samples/springboot3/pet-store/pom.xml | 2 +- 27 files changed, 99 insertions(+), 183 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 0f0bf9516..645916e75 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -6,18 +6,18 @@ AWS Serverless Java container support - Core Allows Java applications written for a servlet container to run in AWS Lambda https://aws.amazon.com/lambda - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT .. 3.1.0 - 5.0.0 + 6.0.0 diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java index d81105bd5..85c8d8c12 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java @@ -428,12 +428,6 @@ public RequestDispatcher getRequestDispatcher(String s) { return getServletContext().getRequestDispatcher(s); } - @Override - public String getRealPath(String s) { - // we are in an archive on a remote server - return null; - } - @Override public int getRemotePort() { return 0; @@ -480,6 +474,21 @@ public AsyncContext getAsyncContext() { return asyncContext; } + @Override + public String getRequestId() { + return null; + } + + @Override + public String getProtocolRequestId() { + return null; + } + + @Override + public ServletConnection getServletConnection() { + return null; + } + private MultiValuedTreeMap parseRawQueryString(String qs) { if (qs == null || "".equals(qs.trim())) { return new MultiValuedTreeMap<>(); diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java index 358ccdfba..99b2782c5 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java @@ -179,7 +179,6 @@ public boolean isRequestedSessionIdFromURL() { return false; } - //------------------------------------------------------------- // Implementation - ServletRequest //------------------------------------------------------------- diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java index d87b707ec..00c7d77d7 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java @@ -177,11 +177,6 @@ public boolean isRequestedSessionIdFromURL() { return originalRequest.isRequestedSessionIdFromURL(); } - @Override - public boolean isRequestedSessionIdFromUrl() { - return originalRequest.isRequestedSessionIdFromUrl(); - } - @Override public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException { return originalRequest.authenticate(httpServletResponse); @@ -343,11 +338,6 @@ public RequestDispatcher getRequestDispatcher(String s) { return originalRequest.getRequestDispatcher(s); } - @Override - public String getRealPath(String s) { - return originalRequest.getRealPath(s); - } - @Override public int getRemotePort() { return originalRequest.getRemotePort(); @@ -402,4 +392,19 @@ public AsyncContext getAsyncContext() { public DispatcherType getDispatcherType() { return originalRequest.getDispatcherType(); } + + @Override + public String getRequestId() { + return null; + } + + @Override + public String getProtocolRequestId() { + return null; + } + + @Override + public ServletConnection getServletConnection() { + return null; + } } diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java index 814958dfa..e325b50d5 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java @@ -152,24 +152,24 @@ public String encodeRedirectURL(String s) { } - @Override - @Deprecated - public String encodeUrl(String s) { - return this.encodeURL(s); - } +// @Override +// @Deprecated +// public String encodeUrl(String s) { +// return this.encodeURL(s); +// } - @Override - @Deprecated - public String encodeRedirectUrl(String s) { - return this.encodeRedirectURL(s); - } +// @Override +// @Deprecated +// public String encodeRedirectUrl(String s) { +// return this.encodeRedirectURL(s); +// } @Override public void sendError(int i, String s) throws IOException { request.setAttribute(AwsHttpServletRequest.DISPATCHER_TYPE_ATTRIBUTE, DispatcherType.ERROR); - setStatus(i, s); + setStatus(i); flushBuffer(); } @@ -259,13 +259,13 @@ public void setStatus(int i) { } - @Override - @Deprecated - public void setStatus(int i, String s) { - if (!canSetHeader()) return; - statusCode = i; - statusMessage = s; - } +// @Override +// @Deprecated +// public void setStatus(int i, String s) { +// if (!canSetHeader()) return; +// statusCode = i; +// statusMessage = s; +// } @Override diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java index eb1f728f9..2163320da 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSession.java @@ -17,7 +17,6 @@ import jakarta.servlet.ServletContext; import jakarta.servlet.http.HttpSession; -import jakarta.servlet.http.HttpSessionContext; import java.time.Instant; import java.util.Collections; @@ -87,60 +86,30 @@ public int getMaxInactiveInterval() { return maxInactiveInterval; } - @Override - @Deprecated - public HttpSessionContext getSessionContext() { - throw new UnsupportedOperationException("Session context is deprecated and no longer supported"); - } - @Override public Object getAttribute(String name) { touch(); return attributes.get(name); } - @Override - @Deprecated - public Object getValue(String name) { - throw new UnsupportedOperationException("Session values are deprecated and not supported"); - } - @Override public Enumeration getAttributeNames() { touch(); return Collections.enumeration(attributes.keySet()); } - @Override - @Deprecated - public String[] getValueNames() { - throw new UnsupportedOperationException("Session values are deprecated and not supported"); - } - @Override public void setAttribute(String name, Object value) { touch(); attributes.put(name, value); } - @Override - @Deprecated - public void putValue(String name, Object value) { - throw new UnsupportedOperationException("Session values are deprecated and not supported"); - } - @Override public void removeAttribute(String name) { touch(); attributes.remove(name); } - @Override - @Deprecated - public void removeValue(String name) { - throw new UnsupportedOperationException("Session values are deprecated and not supported"); - } - @Override public void invalidate() { valid = false; diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java index 5ed2ccf44..1d2f3e3ca 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java @@ -80,7 +80,7 @@ public void forward(ServletRequest servletRequest, ServletResponse servletRespon } if (isNamedDispatcher) { - lambdaContainerHandler.doFilter((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse, getServlet(dispatchTo)); + lambdaContainerHandler.doFilter((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse, getServlet((HttpServletRequest)servletRequest)); return; } @@ -149,8 +149,4 @@ private Servlet getServlet(HttpServletRequest req) { return ((AwsServletContext)lambdaContainerHandler.getServletContext()).getServletForPath(req.getPathInfo()); } - private Servlet getServlet(String servletName) throws ServletException { - return ((AwsServletContext)lambdaContainerHandler.getServletContext()).getServlet(servletName); - } - } diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java index e1688c9fc..cd84f8504 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java @@ -123,7 +123,7 @@ public void setSessionTimeout(int sessionTimeout) { @Override public int getSessionTimeout() { - return 15; + return 0; } @@ -206,13 +206,6 @@ public RequestDispatcher getNamedDispatcher(String s) { return new AwsProxyRequestDispatcher(s, true, containerHandler); } - - @Override - @Deprecated - public Servlet getServlet(String s) throws ServletException { - return servletRegistrations.get(s).getServlet(); - } - public Servlet getServletForPath(String path) { String[] pathParts = path.split("/"); for (AwsServletRegistration reg : servletRegistrations.values()) { @@ -238,38 +231,12 @@ public Servlet getServletForPath(String path) { return null; } - - @Override - @Deprecated - public Enumeration getServlets() { - return Collections.enumeration(servletRegistrations.entrySet().stream() - .map((e) -> { - return e.getValue().getServlet(); - } ) - .collect(Collectors.toList())); - } - - - @Override - @Deprecated - public Enumeration getServletNames() { - return Collections.enumeration(servletRegistrations.keySet()); - } - - @Override public void log(String s) { log.info(SecurityUtils.encode(s)); } - @Override - @Deprecated - public void log(Exception e, String s) { - log.error(SecurityUtils.encode(s), e); - } - - @Override public void log(String s, Throwable throwable) { log.error(SecurityUtils.encode(s), throwable); diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java index 7e7fba49b..1a51b5581 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsFilterChainManagerTest.java @@ -229,11 +229,11 @@ void filterChain_executeMultipleFilters_expectRunEachTime() { @Test void filterChain_multipleServlets_callsCorrectServlet() throws IOException, ServletException { - MockServlet servlet1 = (MockServlet) servletContext.getServlet(SERVLET1_NAME); + MockServlet servlet1 = (MockServlet) ((AwsServletRegistration) servletContext.getServletRegistration(SERVLET1_NAME)).getServlet(); ServletConfig servlet1Config = ((AwsServletRegistration) servletContext.getServletRegistration(SERVLET1_NAME)).getServletConfig(); servlet1.init(servlet1Config); - MockServlet servlet2 = (MockServlet) servletContext.getServlet(SERVLET2_NAME); + MockServlet servlet2 = (MockServlet) ((AwsServletRegistration) servletContext.getServletRegistration(SERVLET2_NAME)).getServlet(); ServletConfig servlet2Config = ((AwsServletRegistration) servletContext.getServletRegistration(SERVLET2_NAME)).getServletConfig(); servlet2.init(servlet2Config); diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSessionTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSessionTest.java index 77dd4bd32..bcca83dda 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSessionTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpSessionTest.java @@ -34,34 +34,6 @@ void new_creationTimePopulatedCorrectly() { assertEquals(session.getLastAccessedTime(), session.getCreationTime()); } - @Test - void values_throwsUnsupportedOperationException() { - int exCount = 0; - AwsHttpSession sess = new AwsHttpSession("id"); - - try { - sess.putValue("test", "test"); - } catch (UnsupportedOperationException e) { - exCount++; - } - try { - sess.removeValue("test"); - } catch (UnsupportedOperationException e) { - exCount++; - } - try { - sess.getValue("test"); - } catch (UnsupportedOperationException e) { - exCount++; - } - try { - sess.getValueNames(); - } catch (UnsupportedOperationException e) { - exCount++; - } - assertEquals(4, exCount); - } - @Test void attributes_dataStoredCorrectly() throws InterruptedException { AwsHttpSession sess = new AwsHttpSession("id"); diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java index 5817527e2..ed84462a5 100644 --- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java +++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContextTest.java @@ -217,9 +217,8 @@ void servletMappings_expectCorrectServlet() { void addServlet_callsDefaultConstructor() throws ServletException { AwsServletContext ctx = new AwsServletContext(null); ctx.addServlet("srv1", TestServlet.class); - assertNotNull(ctx.getServlet("srv1")); - assertNotNull(ctx.getServletRegistration("srv1")); - assertEquals("", ((TestServlet)ctx.getServlet("srv1")).getId()); + assertNotNull(((AwsServletRegistration) ctx.getServletRegistration("srv1")).getServlet()); + assertEquals("", ((TestServlet)((AwsServletRegistration) ctx.getServletRegistration("srv1")).getServlet()).getId()); } @Test diff --git a/aws-serverless-java-container-jersey/pom.xml b/aws-serverless-java-container-jersey/pom.xml index ef4a43712..e94af8030 100644 --- a/aws-serverless-java-container-jersey/pom.xml +++ b/aws-serverless-java-container-jersey/pom.xml @@ -6,12 +6,12 @@ AWS Serverless Java container support - Jersey implementation Allows Java applications written for Jersey to run in AWS Lambda https://aws.amazon.com/lambda - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT .. @@ -24,7 +24,7 @@ com.amazonaws.serverless aws-serverless-java-container-core - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.fasterxml.jackson.core diff --git a/aws-serverless-java-container-spring/pom.xml b/aws-serverless-java-container-spring/pom.xml index f1ae95db2..8cf77bb25 100644 --- a/aws-serverless-java-container-spring/pom.xml +++ b/aws-serverless-java-container-spring/pom.xml @@ -6,17 +6,17 @@ AWS Serverless Java container support - Spring implementation Allows Java applications written for the Spring framework to run in AWS Lambda https://aws.amazon.com/lambda - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT .. - 6.0.7 + 6.0.8 6.0.2 @@ -25,7 +25,7 @@ com.amazonaws.serverless aws-serverless-java-container-core - 1.10-SNAPSHOT + 2.0-SNAPSHOT diff --git a/aws-serverless-java-container-springboot3/pom.xml b/aws-serverless-java-container-springboot3/pom.xml index 08856cf54..34557c57a 100644 --- a/aws-serverless-java-container-springboot3/pom.xml +++ b/aws-serverless-java-container-springboot3/pom.xml @@ -3,7 +3,7 @@ aws-serverless-java-container com.amazonaws.serverless - 1.10-SNAPSHOT + 2.0-SNAPSHOT 4.0.0 @@ -12,10 +12,10 @@ AWS Serverless Java container support - SpringBoot 3 implementation Allows Java applications written for SpringBoot 3 to run in AWS Lambda https://aws.amazon.com/lambda - 1.10-SNAPSHOT + 2.0-SNAPSHOT - 6.0.7 + 6.0.8 3.0.5 6.0.2 17 @@ -26,7 +26,7 @@ com.amazonaws.serverless aws-serverless-java-container-core - 1.10-SNAPSHOT + 2.0-SNAPSHOT org.springframework diff --git a/aws-serverless-jersey-archetype/pom.xml b/aws-serverless-jersey-archetype/pom.xml index c13c05869..6df742a57 100644 --- a/aws-serverless-jersey-archetype/pom.xml +++ b/aws-serverless-jersey-archetype/pom.xml @@ -4,12 +4,12 @@ com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless.archetypes aws-serverless-jersey-archetype - 1.10-SNAPSHOT + 2.0-SNAPSHOT maven-archetype diff --git a/aws-serverless-spring-archetype/pom.xml b/aws-serverless-spring-archetype/pom.xml index 83dc79743..396f5e798 100644 --- a/aws-serverless-spring-archetype/pom.xml +++ b/aws-serverless-spring-archetype/pom.xml @@ -4,12 +4,12 @@ com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless.archetypes aws-serverless-spring-archetype - 1.10-SNAPSHOT + 2.0-SNAPSHOT maven-archetype diff --git a/aws-serverless-springboot3-archetype/pom.xml b/aws-serverless-springboot3-archetype/pom.xml index 4003610a3..040f43536 100644 --- a/aws-serverless-springboot3-archetype/pom.xml +++ b/aws-serverless-springboot3-archetype/pom.xml @@ -4,12 +4,12 @@ com.amazonaws.serverless aws-serverless-java-container - 1.10-SNAPSHOT + 2.0-SNAPSHOT com.amazonaws.serverless.archetypes aws-serverless-springboot3-archetype - 1.10-SNAPSHOT + 2.0-SNAPSHOT maven-archetype diff --git a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml index edb821900..fd770a9b4 100644 --- a/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml +++ b/aws-serverless-springboot3-archetype/src/main/resources/archetype-resources/pom.xml @@ -10,7 +10,7 @@ \${version} jar - Serverless Spring Boot 2 API + Serverless Spring Boot 3 API https://github.com/awslabs/aws-serverless-java-container @@ -20,14 +20,13 @@ - 1.8 - 1.8 + 17 com.amazonaws.serverless - aws-serverless-java-container-springboot2 + aws-serverless-java-container-springboot3 ${project.version} diff --git a/pom.xml b/pom.xml index 08627db23..1dca94c7c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.amazonaws.serverless aws-serverless-java-container pom - 1.10-SNAPSHOT + 2.0-SNAPSHOT AWS Serverless Java container A Java framework to run Spring, Spring Boot, Jersey, Spark, and Struts applications inside AWS Lambda https://github.com/awslabs/aws-serverless-java-container diff --git a/samples/jersey/pet-store/build.gradle b/samples/jersey/pet-store/build.gradle index b32dc8ef8..5b073ebe1 100644 --- a/samples/jersey/pet-store/build.gradle +++ b/samples/jersey/pet-store/build.gradle @@ -7,18 +7,18 @@ repositories { dependencies { implementation ( - 'com.amazonaws.serverless:aws-serverless-java-container-jersey:[1.9,)', - 'com.fasterxml.jackson.core:jackson-databind:2.15.0', + 'com.amazonaws.serverless:aws-serverless-java-container-jersey:[2.0,)', + 'com.fasterxml.jackson.core:jackson-databind:2.14.2', 'io.symphonia:lambda-logging:1.0.3' ) - implementation("org.glassfish.jersey.media:jersey-media-json-jackson:2.39.1") { + implementation("org.glassfish.jersey.media:jersey-media-json-jackson:3.1.1") { exclude group: 'com.fasterxml.jackson.core', module: "jackson-annotations" exclude group: 'com.fasterxml.jackson.core', module: "jackson-databind" exclude group: 'com.fasterxml.jackson.core', module: "jackson-core" } - implementation("org.glassfish.jersey.inject:jersey-hk2:2.39.1") { + implementation("org.glassfish.jersey.inject:jersey-hk2:3.1.1") { exclude group: 'javax.inject', module: "javax.inject" } } diff --git a/samples/jersey/pet-store/pom.xml b/samples/jersey/pet-store/pom.xml index 2f0b8f567..0505d04f7 100644 --- a/samples/jersey/pet-store/pom.xml +++ b/samples/jersey/pet-store/pom.xml @@ -6,7 +6,7 @@ com.amazonaws.serverless.sample serverless-jersey-example - 1.0-SNAPSHOT + 2.0-SNAPSHOT Jersey example for the aws-serverless-java-container library Simple pet store written in Jersey https://aws.amazon.com/lambda/ @@ -34,7 +34,7 @@ com.amazonaws.serverless aws-serverless-java-container-jersey - [1.9,) + [2.0,) diff --git a/samples/micronaut/pet-store/build.gradle b/samples/micronaut/pet-store/build.gradle index 6282d2d2c..b262a4699 100644 --- a/samples/micronaut/pet-store/build.gradle +++ b/samples/micronaut/pet-store/build.gradle @@ -1,10 +1,10 @@ plugins { id "java" - id "com.github.johnrengelman.shadow" version "5.0.0" + id "com.github.johnrengelman.shadow" version "8.1.1" id "application" id "net.ltgt.apt-eclipse" version "0.21" - id "org.springframework.boot" version "2.1.12.RELEASE" - id "io.spring.dependency-management" version "1.0.6.RELEASE" + id "org.springframework.boot" version "3.0.5" + id "io.spring.dependency-management" version "1.1.0" } version "0.1" @@ -53,8 +53,8 @@ dependencies { // spring support implementation("org.springframework.boot:spring-boot-starter-web") - runtime("io.micronaut.spring:micronaut-spring-boot:1.0.1") - runtime("io.micronaut.spring:micronaut-spring-web:1.0.1") + runtime("io.micronaut.spring:micronaut-spring-boot:5.0.0-M1") + runtime("io.micronaut.spring:micronaut-spring-web:5.0.0-M1") } test.classpath += configurations.developmentOnly diff --git a/samples/quarkus/pet-store/pom.xml b/samples/quarkus/pet-store/pom.xml index 5484ffade..13229ee5d 100644 --- a/samples/quarkus/pet-store/pom.xml +++ b/samples/quarkus/pet-store/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.amazonaws.serverless.sample serverless-quarkus-example - 1.0-SNAPSHOT + 2.0-SNAPSHOT 3.8.1 true diff --git a/samples/spring/pet-store/build.gradle b/samples/spring/pet-store/build.gradle index 759aa0610..46a7df708 100644 --- a/samples/spring/pet-store/build.gradle +++ b/samples/spring/pet-store/build.gradle @@ -7,9 +7,9 @@ repositories { dependencies { implementation ( - 'org.springframework:spring-webmvc:5.3.27', - 'org.springframework:spring-context:5.3.27', - 'com.amazonaws.serverless:aws-serverless-java-container-spring:[1.0,)', + 'org.springframework:spring-webmvc:6.0.7', + 'org.springframework:spring-context:6.0.7', + 'com.amazonaws.serverless:aws-serverless-java-container-spring:[2.0,)', 'org.apache.logging.log4j:log4j-core:2.19.0', 'org.apache.logging.log4j:log4j-api:2.19.0', 'org.apache.logging.log4j:log4j-slf4j-impl:2.19.0', diff --git a/samples/spring/pet-store/pom.xml b/samples/spring/pet-store/pom.xml index 0b85ff945..2194cee2d 100644 --- a/samples/spring/pet-store/pom.xml +++ b/samples/spring/pet-store/pom.xml @@ -6,7 +6,7 @@ com.amazonaws.serverless.sample serverless-spring-example - 1.0-SNAPSHOT + 2.0-SNAPSHOT Spring example for the aws-serverless-java-container library Simple pet store written with the Spring framework https://aws.amazon.com/lambda/ @@ -24,10 +24,11 @@ - 17 6.0.7 4.13.2 2.19.0 + 17.0.6 + 17.0.6 diff --git a/samples/springboot3/pet-store/build.gradle b/samples/springboot3/pet-store/build.gradle index 60affd722..37ba61a59 100644 --- a/samples/springboot3/pet-store/build.gradle +++ b/samples/springboot3/pet-store/build.gradle @@ -8,10 +8,10 @@ repositories { dependencies { implementation ( - implementation('org.springframework.boot:spring-boot-starter-web:2.7.11') { + implementation('org.springframework.boot:spring-boot-starter-web:3.0.5') { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' }, - 'com.amazonaws.serverless:aws-serverless-java-container-springboot2:[1.4,)', + 'com.amazonaws.serverless:aws-serverless-java-container-springboot3:[2.0,)', 'io.symphonia:lambda-logging:1.0.3' ) testImplementation("junit:junit") diff --git a/samples/springboot3/pet-store/pom.xml b/samples/springboot3/pet-store/pom.xml index dc1dcc36f..3f0f283ad 100644 --- a/samples/springboot3/pet-store/pom.xml +++ b/samples/springboot3/pet-store/pom.xml @@ -5,7 +5,7 @@ com.amazonaws.serverless.sample serverless-springboot3-example - 1.0-SNAPSHOT + 2.0-SNAPSHOT Spring Boot example for the aws-serverless-java-container library Simple pet store written with the Spring framework and Spring Boot https://aws.amazon.com/lambda/ From 4b1a7b4c7eb76eb36186e927828e448b86e4ab23 Mon Sep 17 00:00:00 2001 From: mbfreder Date: Thu, 20 Apr 2023 09:12:17 -0700 Subject: [PATCH 14/15] Removed java-9 profiles along with the old com.sun.activation:jakarta.activation dependency. --- aws-serverless-java-container-core/pom.xml | 22 ----------------- .../AwsHttpApiV2ProxyHttpServletRequest.java | 4 ++-- .../servlet/AwsHttpServletRequestWrapper.java | 4 ++-- .../servlet/AwsHttpServletResponse.java | 24 ------------------- .../servlet/AwsProxyRequestDispatcher.java | 2 +- .../internal/servlet/AwsServletContext.java | 2 +- aws-serverless-java-container-spring/pom.xml | 2 +- .../pom.xml | 1 - 8 files changed, 7 insertions(+), 54 deletions(-) diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml index 645916e75..ad00d2ef8 100644 --- a/aws-serverless-java-container-core/pom.xml +++ b/aws-serverless-java-container-core/pom.xml @@ -125,11 +125,6 @@ 6.0.2 test - - jakarta.activation - jakarta.activation-api - 2.1.1 - @@ -226,21 +221,4 @@ - - - - java9-plus - - [9,) - - - - com.sun.activation - jakarta.activation - 1.2.2 - - - - - diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java index 85c8d8c12..bdf11b819 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java @@ -476,12 +476,12 @@ public AsyncContext getAsyncContext() { @Override public String getRequestId() { - return null; + return request.getRequestContext().getRequestId(); } @Override public String getProtocolRequestId() { - return null; + return ""; } @Override diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java index 00c7d77d7..3817e7971 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequestWrapper.java @@ -395,12 +395,12 @@ public DispatcherType getDispatcherType() { @Override public String getRequestId() { - return null; + return originalRequest.getRequestId(); } @Override public String getProtocolRequestId() { - return null; + return ""; } @Override diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java index e325b50d5..c46af7a9b 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java @@ -152,20 +152,6 @@ public String encodeRedirectURL(String s) { } -// @Override -// @Deprecated -// public String encodeUrl(String s) { -// return this.encodeURL(s); -// } - - -// @Override -// @Deprecated -// public String encodeRedirectUrl(String s) { -// return this.encodeRedirectURL(s); -// } - - @Override public void sendError(int i, String s) throws IOException { request.setAttribute(AwsHttpServletRequest.DISPATCHER_TYPE_ATTRIBUTE, DispatcherType.ERROR); @@ -258,16 +244,6 @@ public void setStatus(int i) { statusCode = i; } - -// @Override -// @Deprecated -// public void setStatus(int i, String s) { -// if (!canSetHeader()) return; -// statusCode = i; -// statusMessage = s; -// } - - @Override public int getStatus() { return (statusCode <= 0?SC_OK:statusCode); diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java index 1d2f3e3ca..f314ba0d0 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyRequestDispatcher.java @@ -80,7 +80,7 @@ public void forward(ServletRequest servletRequest, ServletResponse servletRespon } if (isNamedDispatcher) { - lambdaContainerHandler.doFilter((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse, getServlet((HttpServletRequest)servletRequest)); + lambdaContainerHandler.doFilter((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse, ((AwsServletRegistration)servletRequest.getServletContext().getServletRegistration(dispatchTo)).getServlet()); return; } diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java index cd84f8504..634f44ff1 100644 --- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java +++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java @@ -46,7 +46,7 @@ public class AwsServletContext //------------------------------------------------------------- // Constants - Public // ------------------------------------------------------------- - public static final int SERVLET_API_MAJOR_VERSION = 5; + public static final int SERVLET_API_MAJOR_VERSION = 6; public static final int SERVLET_API_MINOR_VERSION = 0; public static final String SERVER_INFO = LambdaContainerHandler.SERVER_INFO + "/" + SERVLET_API_MAJOR_VERSION + "." + SERVLET_API_MINOR_VERSION; diff --git a/aws-serverless-java-container-spring/pom.xml b/aws-serverless-java-container-spring/pom.xml index 8cf77bb25..5fe784a4f 100644 --- a/aws-serverless-java-container-spring/pom.xml +++ b/aws-serverless-java-container-spring/pom.xml @@ -62,7 +62,7 @@ jakarta.activation jakarta.activation-api - 2.1.0 + 2.1.1 test diff --git a/aws-serverless-java-container-springboot3/pom.xml b/aws-serverless-java-container-springboot3/pom.xml index 34557c57a..c20fab9f3 100644 --- a/aws-serverless-java-container-springboot3/pom.xml +++ b/aws-serverless-java-container-springboot3/pom.xml @@ -18,7 +18,6 @@ 6.0.8 3.0.5 6.0.2 - 17 From 980ebfa13166b0993b95481c28707c5be9f76e72 Mon Sep 17 00:00:00 2001 From: mbfreder Date: Mon, 24 Apr 2023 14:25:33 -0700 Subject: [PATCH 15/15] chore(deps): Updated sample apps --- .../src/main/resources/archetype-resources/build.gradle | 2 +- .../src/main/resources/archetype-resources/build.gradle | 6 +++--- pom.xml | 2 +- samples/jersey/pet-store/build.gradle | 2 +- samples/jersey/pet-store/pom.xml | 2 +- samples/jersey/pet-store/template.yml | 2 +- samples/quarkus/pet-store/pom.xml | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/build.gradle b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/build.gradle index 949112fcf..b1ddfd4a4 100644 --- a/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/build.gradle +++ b/aws-serverless-jersey-archetype/src/main/resources/archetype-resources/build.gradle @@ -7,7 +7,7 @@ repositories { dependencies { implementation ( - 'com.amazonaws.serverless:aws-serverless-java-container-jersey:[1.9,)', + 'com.amazonaws.serverless:aws-serverless-java-container-jersey:[2.0,)', 'com.fasterxml.jackson.core:jackson-databind:2.15.0', 'io.symphonia:lambda-logging:1.0.3' ) diff --git a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/build.gradle b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/build.gradle index 66093c4b1..7aedaf58a 100644 --- a/aws-serverless-spring-archetype/src/main/resources/archetype-resources/build.gradle +++ b/aws-serverless-spring-archetype/src/main/resources/archetype-resources/build.gradle @@ -7,9 +7,9 @@ repositories { dependencies { implementation ( - 'org.springframework:spring-webmvc:5.3.27', - 'org.springframework:spring-context:5.3.27', - 'com.amazonaws.serverless:aws-serverless-java-container-spring:[1.0,)', + 'org.springframework:spring-webmvc:6.0.8', + 'org.springframework:spring-context:6.0.8', + 'com.amazonaws.serverless:aws-serverless-java-container-spring:[2.0,)', 'org.apache.logging.log4j:log4j-core:2.19.0', 'org.apache.logging.log4j:log4j-api:2.19.0', 'org.apache.logging.log4j:log4j-slf4j-impl:2.19.0', diff --git a/pom.xml b/pom.xml index 1dca94c7c..2c97633a8 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ https://github.com/awslabs/aws-serverless-java-container scm:git:https://github.com/awslabs/aws-serverless-java-container.git HEAD - + diff --git a/samples/jersey/pet-store/build.gradle b/samples/jersey/pet-store/build.gradle index 5b073ebe1..11ad779d6 100644 --- a/samples/jersey/pet-store/build.gradle +++ b/samples/jersey/pet-store/build.gradle @@ -8,7 +8,7 @@ repositories { dependencies { implementation ( 'com.amazonaws.serverless:aws-serverless-java-container-jersey:[2.0,)', - 'com.fasterxml.jackson.core:jackson-databind:2.14.2', + 'com.fasterxml.jackson.core:jackson-databind:2.15.0', 'io.symphonia:lambda-logging:1.0.3' ) diff --git a/samples/jersey/pet-store/pom.xml b/samples/jersey/pet-store/pom.xml index 0505d04f7..58511ca20 100644 --- a/samples/jersey/pet-store/pom.xml +++ b/samples/jersey/pet-store/pom.xml @@ -27,7 +27,7 @@ 1.8 1.8 3.1.1 - 2.14.2 + 2.15.0 diff --git a/samples/jersey/pet-store/template.yml b/samples/jersey/pet-store/template.yml index f715064c4..a3fd2bfa0 100644 --- a/samples/jersey/pet-store/template.yml +++ b/samples/jersey/pet-store/template.yml @@ -12,7 +12,7 @@ Resources: Type: AWS::Serverless::Function Properties: Handler: com.amazonaws.serverless.sample.jersey.StreamLambdaHandler::handleRequest - Runtime: java11 + Runtime: java17 CodeUri: . MemorySize: 512 Policies: AWSLambdaBasicExecutionRole diff --git a/samples/quarkus/pet-store/pom.xml b/samples/quarkus/pet-store/pom.xml index 13229ee5d..d13958adc 100644 --- a/samples/quarkus/pet-store/pom.xml +++ b/samples/quarkus/pet-store/pom.xml @@ -8,8 +8,8 @@ 3.8.1 true - 17.0.6 - 17.0.6 + 17 + 17 UTF-8 UTF-8 1.0.1.Final