From 052511a10c2c53784a1ef4c3cc056926dab112a7 Mon Sep 17 00:00:00 2001 From: Fyro Date: Mon, 26 Dec 2022 19:56:21 +0100 Subject: [PATCH] add jakarta implementation https://github.com/swagger-api/swagger-codegen-generators/issues/1054 --- .../handlebars/JavaInflector/api.mustache | 5 +++ .../generatedAnnotation.mustache | 2 +- .../handlebars/JavaInflector/web.mustache | 4 +-- .../JavaJaxRS/ApiOriginFilter.mustache | 10 ++++-- .../JavaJaxRS/ApiResponseMessage.mustache | 7 ++++ .../JavaJaxRS/JodaDateTimeProvider.mustache | 13 ++++++- .../JavaJaxRS/JodaLocalDateProvider.mustache | 13 ++++++- .../handlebars/JavaJaxRS/api.mustache | 14 ++++++++ .../handlebars/JavaJaxRS/apiService.mustache | 11 ++++++ .../JavaJaxRS/apiServiceImpl.mustache | 11 ++++++ .../handlebars/JavaJaxRS/bootstrap.mustache | 10 +++++- .../cxf-cdi/RestApplication.mustache | 8 ++++- .../handlebars/JavaJaxRS/cxf-cdi/api.mustache | 15 ++++++++ .../JavaJaxRS/cxf-cdi/apiService.mustache | 6 ++++ .../JavaJaxRS/cxf-cdi/apiServiceImpl.mustache | 7 ++++ .../cxf-cdi/generatedAnnotation.mustache | 2 +- .../JavaJaxRS/cxf-cdi/model.mustache | 5 +++ .../JavaJaxRS/cxf-cdi/pojo.mustache | 5 +++ .../handlebars/JavaJaxRS/cxf-cdi/pom.mustache | 6 ++-- .../cxf/CXF2InterfaceComparator.mustache | 34 ++++++++++++++----- .../handlebars/JavaJaxRS/cxf/api.mustache | 13 +++++++ .../JavaJaxRS/cxf/apiServiceImpl.mustache | 6 ++++ .../JavaJaxRS/cxf/api_test.mustache | 5 +++ .../JavaJaxRS/cxf/enumOuterClass.mustache | 7 ++++ .../cxf/generatedAnnotation.mustache | 2 +- .../handlebars/JavaJaxRS/cxf/model.mustache | 5 +++ .../handlebars/JavaJaxRS/cxf/pojo.mustache | 11 ++++++ .../handlebars/JavaJaxRS/cxf/pom.mustache | 10 +++--- .../server/ApplicationContext.xml.mustache | 2 +- .../JavaJaxRS/cxf/server/pom.mustache | 27 +++++++++------ .../handlebars/JavaJaxRS/di/api.mustache | 15 +++++++- .../JavaJaxRS/di/apiService.mustache | 11 ++++++ .../JavaJaxRS/generatedAnnotation.mustache | 2 +- .../JavaJaxRS/jacksonJsonProvider.mustache | 9 ++++- .../jersey1/LocalDateProvider.mustache | 13 ++++++- .../jersey1/OffsetDateTimeProvider.mustache | 13 ++++++- .../JavaJaxRS/libraries/jersey1/api.mustache | 13 +++++++ .../libraries/jersey1/apiService.mustache | 11 ++++++ .../libraries/jersey1/apiServiceImpl.mustache | 11 ++++++ .../JavaJaxRS/libraries/jersey1/pom.mustache | 21 ++++++++---- .../jersey2/LocalDateProvider.mustache | 9 ++++- .../jersey2/OffsetDateTimeProvider.mustache | 9 ++++- .../handlebars/JavaJaxRS/model.mustache | 6 ++++ .../handlebars/JavaJaxRS/pom.mustache | 10 +++--- .../resteasy/ApiOriginFilter.mustache | 8 ++++- .../resteasy/ApiResponseMessage.mustache | 7 ++++ .../JavaJaxRS/resteasy/JacksonConfig.mustache | 6 ++++ .../resteasy/JodaDateTimeProvider.mustache | 15 ++++++-- .../resteasy/JodaLocalDateProvider.mustache | 15 ++++++-- .../resteasy/LocalDateProvider.mustache | 9 ++++- .../resteasy/OffsetDateTimeProvider.mustache | 9 ++++- .../resteasy/RestApplication.mustache | 8 ++++- .../JavaJaxRS/resteasy/api.mustache | 14 ++++++++ .../JavaJaxRS/resteasy/apiService.mustache | 6 ++++ .../resteasy/apiServiceImpl.mustache | 7 ++++ .../resteasy/eap/JacksonConfig.mustache | 10 +++++- .../resteasy/eap/RestApplication.mustache | 14 ++++++-- .../JavaJaxRS/resteasy/eap/api.mustache | 13 +++++++ .../resteasy/eap/apiServiceImpl.mustache | 6 ++++ .../resteasy/eap/generatedAnnotation.mustache | 2 +- .../JavaJaxRS/resteasy/eap/gradle.mustache | 4 +-- .../JavaJaxRS/resteasy/eap/model.mustache | 5 +++ .../JavaJaxRS/resteasy/eap/pom.mustache | 18 +++++----- .../resteasy/generatedAnnotation.mustache | 2 +- .../JavaJaxRS/resteasy/gradle.mustache | 4 +-- .../JavaJaxRS/resteasy/model.mustache | 5 +++ .../JavaJaxRS/resteasy/pom.mustache | 24 +++++++++---- .../JavaJaxRS/spec/RestApplication.mustache | 6 ++++ .../handlebars/JavaJaxRS/spec/api.mustache | 20 +++++++++-- .../spec/generatedAnnotation.mustache | 4 +-- .../handlebars/JavaJaxRS/spec/model.mustache | 6 ++++ .../handlebars/JavaJaxRS/spec/pom.mustache | 12 +++---- 72 files changed, 583 insertions(+), 105 deletions(-) diff --git a/src/main/resources/handlebars/JavaInflector/api.mustache b/src/main/resources/handlebars/JavaInflector/api.mustache index 055ef574eb..48101979ba 100644 --- a/src/main/resources/handlebars/JavaInflector/api.mustache +++ b/src/main/resources/handlebars/JavaInflector/api.mustache @@ -2,7 +2,12 @@ package {{invokerPackage}}; import io.swagger.oas.inflector.models.RequestContext; import io.swagger.oas.inflector.models.ResponseContext; +{{#jakarta}} +import jakarta.ws.rs.core.Response.Status; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response.Status; +{{/jakarta}} import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import java.io.File; diff --git a/src/main/resources/handlebars/JavaInflector/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaInflector/generatedAnnotation.mustache index a47b6faa85..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaInflector/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaInflector/generatedAnnotation.mustache @@ -1 +1 @@ -{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaInflector/web.mustache b/src/main/resources/handlebars/JavaInflector/web.mustache index 16a254d111..cbe4875d9d 100644 --- a/src/main/resources/handlebars/JavaInflector/web.mustache +++ b/src/main/resources/handlebars/JavaInflector/web.mustache @@ -4,7 +4,7 @@ swagger-inflector org.glassfish.jersey.servlet.ServletContainer - javax.ws.rs.Application + {{#jakarta}}jakarta{{/jakarta}}javax{{^jakarta}}.ws.rs.Application io.swagger.oas.inflector.OpenAPIInflector 1 @@ -21,4 +21,4 @@ CORSFilter /* - \ No newline at end of file + diff --git a/src/main/resources/handlebars/JavaJaxRS/ApiOriginFilter.mustache b/src/main/resources/handlebars/JavaJaxRS/ApiOriginFilter.mustache index b8af270a05..f9ef60c3ee 100644 --- a/src/main/resources/handlebars/JavaJaxRS/ApiOriginFilter.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/ApiOriginFilter.mustache @@ -2,11 +2,17 @@ package {{apiPackage}}; import java.io.IOException; +{{#jakarta}} +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletResponse; +{{/jakarta}} +{{^jakarta}} import javax.servlet.*; import javax.servlet.http.HttpServletResponse; +{{/jakarta}} {{>generatedAnnotation}} -public class ApiOriginFilter implements javax.servlet.Filter { +public class ApiOriginFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse res = (HttpServletResponse) response; @@ -19,4 +25,4 @@ public class ApiOriginFilter implements javax.servlet.Filter { public void destroy() {} public void init(FilterConfig filterConfig) throws ServletException {} -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/ApiResponseMessage.mustache b/src/main/resources/handlebars/JavaJaxRS/ApiResponseMessage.mustache index c883e16b5e..50f428a3aa 100644 --- a/src/main/resources/handlebars/JavaJaxRS/ApiResponseMessage.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/ApiResponseMessage.mustache @@ -1,8 +1,15 @@ package {{apiPackage}}; +{{#jakarta}} +import jakarta.xml.bind.annotation.XmlTransient; + +@jakarta.xml.bind.annotation.XmlRootElement +{{/jakarta}} +{{^jakarta}} import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement +{{/jakarta}} {{>generatedAnnotation}} public class ApiResponseMessage { public static final int ERROR = 1; diff --git a/src/main/resources/handlebars/JavaJaxRS/JodaDateTimeProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/JodaDateTimeProvider.mustache index f942179098..2e81525879 100644 --- a/src/main/resources/handlebars/JavaJaxRS/JodaDateTimeProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/JodaDateTimeProvider.mustache @@ -4,6 +4,16 @@ import com.sun.jersey.core.spi.component.ComponentContext; import com.sun.jersey.spi.inject.Injectable; import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; +{{#jakarta}} +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.UriInfo; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; @@ -11,6 +21,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.Provider; +{{/jakarta}} import org.joda.time.DateTime; import java.util.List; @@ -41,4 +52,4 @@ public class JodaDateTimeProvider extends PerRequestTypeInjectableProvidergeneratedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/apiServiceImpl.mustache index 7c9bc7c412..4ae2646850 100644 --- a/src/main/resources/handlebars/JavaJaxRS/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/apiServiceImpl.mustache @@ -14,10 +14,21 @@ import java.io.InputStream; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} import javax.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} +import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/bootstrap.mustache b/src/main/resources/handlebars/JavaJaxRS/bootstrap.mustache index 433c0389c3..72f020fcc6 100644 --- a/src/main/resources/handlebars/JavaJaxRS/bootstrap.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/bootstrap.mustache @@ -1,9 +1,17 @@ package {{apiPackage}}; +{{#jakarta}} +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +{{/jakarta}} +{{^jakarta}} import javax.servlet.http.HttpServlet; import javax.servlet.ServletContext; import javax.servlet.ServletConfig; import javax.servlet.ServletException; +{{/jakarta}} {{#useOas2}} import io.swagger.jaxrs.config.SwaggerContextService; @@ -52,4 +60,4 @@ import io.swagger.v3.oas.annotations.info.License; ) public class Bootstrap { } -{{/useOas2}} \ No newline at end of file +{{/useOas2}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/RestApplication.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/RestApplication.mustache index d3d8b238d7..722cb94e47 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/RestApplication.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/RestApplication.mustache @@ -1,9 +1,15 @@ package {{invokerPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +{{/jakarta}} @ApplicationPath("/") public class RestApplication extends Application { // Add implementation-specific details here -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache index 0cb1b1445f..41780bfce4 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/api.mustache @@ -4,12 +4,22 @@ package {{package}}; {{/imports}} import {{package}}.{{classname}}Service; +{{#jakarta}} +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; +{{/jakarta}} {{#useOas2}} import io.swagger.annotations.*; @@ -32,7 +42,12 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart; import java.util.Map; import java.util.List; {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} @Path("/{{{baseName}}}") @RequestScoped diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiService.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiService.mustache index d75faaca09..7055bc34d6 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiService.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiService.mustache @@ -13,8 +13,14 @@ import java.util.List; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiServiceImpl.mustache index b0af063d33..812338de91 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/apiServiceImpl.mustache @@ -12,9 +12,16 @@ import java.util.List; import java.io.InputStream; +{{#jakarta}} +import jakarta.enterprise.context.RequestScoped; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.enterprise.context.RequestScoped; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} @RequestScoped {{>generatedAnnotation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/generatedAnnotation.mustache index a47b6faa85..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/generatedAnnotation.mustache @@ -1 +1 @@ -{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/model.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/model.mustache index abbe476515..5edf75f7d8 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/model.mustache @@ -4,7 +4,12 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{/x-is-composed-model}} {{#models}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pojo.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pojo.mustache index 78b3ec8ca0..d8cc0f03f1 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pojo.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pojo.mustache @@ -6,7 +6,12 @@ import io.swagger.v3.oas.annotations.media.Schema; {{/useOas2}} import java.util.Objects; +{{#jakarta}} +import jakarta.xml.bind.annotation.*; +{{/jakarta}} +{{^jakarta}} import javax.xml.bind.annotation.*; +{{/jakarta}} {{#description}}{{#useOas2}}@ApiModel{{/useOas2}}{{^useOas2}}@Schema{{/useOas2}}(description = "{{{description}}}"){{/description}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pom.mustache index 9851b195cb..596f172a32 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf-cdi/pom.mustache @@ -89,9 +89,9 @@ {{#useBeanValidation}} - javax.validation - validation-api - 1.1.0.Final + jakarta.validation + jakarta.validation-api + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} provided {{/useBeanValidation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/CXF2InterfaceComparator.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/CXF2InterfaceComparator.mustache index d1fd0bf82c..8e4f060577 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/CXF2InterfaceComparator.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/CXF2InterfaceComparator.mustache @@ -5,8 +5,26 @@ import java.lang.reflect.Method; import java.util.regex.Matcher; import java.util.regex.Pattern; +{{#jakarta}} +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.HEAD; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.OPTIONS; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +{{/jakarta}} +{{^jakarta}} +import javax.ws.rs.DELETE; +import javax.ws.rs.HEAD; import javax.ws.rs.HttpMethod; +import javax.ws.rs.GET; +import javax.ws.rs.OPTIONS; import javax.ws.rs.Path; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +{{/jakarta}} import org.apache.cxf.jaxrs.ext.ResourceComparator; import org.apache.cxf.jaxrs.model.ClassResourceInfo; @@ -60,7 +78,7 @@ public class CXFInterfaceComparator implements ResourceComparator { Method[] methods = cri.getServiceClass().getInterfaces()[0].getMethods(); // Java reflexion. Check all the methods of an interface. for (Method method : methods) { - Path pathAnnotation = method.getAnnotation(javax.ws.rs.Path.class); + Path pathAnnotation = method.getAnnotation(Path.class); if (pathAnnotation != null && pathAnnotation.value() != null) { String pathValue = pathAnnotation.value(); String methodHttpVerb = getMethodHttpVerb(method); @@ -79,17 +97,17 @@ public class CXFInterfaceComparator implements ResourceComparator { } private static String getMethodHttpVerb(Method method) { - if (method.getAnnotation(javax.ws.rs.POST.class) != null) { + if (method.getAnnotation(POST.class) != null) { return HttpMethod.POST; - } else if (method.getAnnotation(javax.ws.rs.GET.class) != null) { + } else if (method.getAnnotation(GET.class) != null) { return HttpMethod.GET; - } else if (method.getAnnotation(javax.ws.rs.PUT.class) != null) { + } else if (method.getAnnotation(PUT.class) != null) { return HttpMethod.PUT; - } else if (method.getAnnotation(javax.ws.rs.OPTIONS.class) != null) { + } else if (method.getAnnotation(OPTIONS.class) != null) { return HttpMethod.OPTIONS; - } else if (method.getAnnotation(javax.ws.rs.DELETE.class) != null) { + } else if (method.getAnnotation(DELETE.class) != null) { return HttpMethod.DELETE; - } else if (method.getAnnotation(javax.ws.rs.HEAD.class) != null) { + } else if (method.getAnnotation(HEAD.class) != null) { return HttpMethod.HEAD; } assert false; @@ -117,4 +135,4 @@ public class CXFInterfaceComparator implements ResourceComparator { public int compare(OperationResourceInfo ori1, OperationResourceInfo ori2, Message message) { return 0; // Leave CXF decision } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/api.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/api.mustache index e9cf1dc7e4..f0f52851eb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/api.mustache @@ -7,9 +7,16 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; +{{#jakarta}} +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.MediaType; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.*; import javax.ws.rs.core.Response; import javax.ws.rs.core.MediaType; +{{/jakarta}} import org.apache.cxf.jaxrs.ext.multipart.*; {{#useOas2}} @@ -28,8 +35,14 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; {{/useOas2}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; import javax.validation.Valid; +{{/jakarta}} {{/useBeanValidation}} {{#appName}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/apiServiceImpl.mustache index 82ebd6da18..d0397b6f1f 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/apiServiceImpl.mustache @@ -8,8 +8,14 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; +{{#jakarta}} +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.*; import javax.ws.rs.core.Response; +{{/jakarta}} import org.apache.cxf.jaxrs.model.wadl.Description; import org.apache.cxf.jaxrs.model.wadl.DocTarget; diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache index e265b96996..b1b6bbacac 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/api_test.mustache @@ -8,7 +8,12 @@ import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; +{{/jakarta}} import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; import org.apache.cxf.jaxrs.client.WebClient; diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/enumOuterClass.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/enumOuterClass.mustache index 491a199e09..5973e0434e 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/enumOuterClass.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/enumOuterClass.mustache @@ -3,9 +3,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; {{/jackson}} {{#withXml}} +{{#jakarta}} +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +{{/jakarta}} +{{^jakarta}} import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; +{{/jakarta}} {{/withXml}} /** diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/generatedAnnotation.mustache index 49110fc1ad..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/model.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/model.mustache index fe9f571dd2..8642b990ba 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/model.mustache @@ -4,7 +4,12 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{/isComposedModel}} diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/pojo.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/pojo.mustache index 6c8429248f..656f475a03 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/pojo.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/pojo.mustache @@ -4,6 +4,16 @@ import io.swagger.annotations.ApiModelProperty; {{^useOas2}} import io.swagger.v3.oas.annotations.media.Schema; {{/useOas2}} +{{#jakarta}} +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +{{/jakarta}} +{{^jakarta}} import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlAccessType; @@ -11,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; +{{/jakarta}} import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/pom.mustache index 24aea6d203..f8de92160a 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/pom.mustache @@ -42,8 +42,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} @@ -128,8 +128,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} provided @@ -229,7 +229,7 @@ 1.2.9 2.5 {{#useBeanValidation}} - 1.1.0.Final + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} {{/useBeanValidation}} 3.2.4 2.9.1 diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache index fd1b6d6f8f..1fa7aea495 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache @@ -84,7 +84,7 @@ {{/useGzipFeature}} - + diff --git a/src/main/resources/handlebars/JavaJaxRS/cxf/server/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/cxf/server/pom.mustache index b59e397af1..b89cdc7b7d 100644 --- a/src/main/resources/handlebars/JavaJaxRS/cxf/server/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/cxf/server/pom.mustache @@ -42,8 +42,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} @@ -137,8 +137,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} provided @@ -256,14 +256,19 @@ {{/useSwaggerUI}} - javax.xml.bind - jaxb-api - 2.2.6 + jakarta.xml.bind + jakarta.xml.bind-api + {{#jakarta}}4.0.0{{/jakarta}}{{^jakarta}}2.3.3{{/jakarta}} - javax.activation - activation - 1.1.1 + com.sun.xml.bind + jaxb-impl + {{#jakarta}}4.0.1{{/jakarta}}{{^jakarta}}2.3.7{{/jakarta}} + + + jakarta.activation + jakarta.activation-api + {{#jakarta}}2.1.0{{/jakarta}}{{^jakarta}}1.2.2{{/jakarta}} @@ -290,7 +295,7 @@ 1.2.9 2.5 {{#useBeanValidation}} - 1.1.0.Final + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} {{/useBeanValidation}} {{#generateSpringApplication}} 4.3.13.RELEASE diff --git a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache index fae82cbd69..6c79865b54 100644 --- a/src/main/resources/handlebars/JavaJaxRS/di/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/di/api.mustache @@ -29,12 +29,25 @@ import java.io.InputStream; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; +{{#jakarta}} +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} @Path("/{{{baseName}}}") @@ -52,7 +65,7 @@ public class {{classname}} { protected {{classname}}() { } - @javax.inject.Inject + @{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.inject.Inject public {{classname}}({{classname}}Service delegate) { this.delegate = delegate; } diff --git a/src/main/resources/handlebars/JavaJaxRS/di/apiService.mustache b/src/main/resources/handlebars/JavaJaxRS/di/apiService.mustache index 56092f5e7c..414550b752 100644 --- a/src/main/resources/handlebars/JavaJaxRS/di/apiService.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/di/apiService.mustache @@ -13,10 +13,21 @@ import java.util.List; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/generatedAnnotation.mustache index a47b6faa85..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/generatedAnnotation.mustache @@ -1 +1 @@ -{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/jacksonJsonProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/jacksonJsonProvider.mustache index 5fa284e809..132341ff36 100644 --- a/src/main/resources/handlebars/JavaJaxRS/jacksonJsonProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/jacksonJsonProvider.mustache @@ -13,9 +13,16 @@ import com.fasterxml.jackson.datatype.joda.*; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; +{{#jakarta}} +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.Provider; +{{/jakarta}} @Provider @Produces({MediaType.APPLICATION_JSON}) @@ -36,4 +43,4 @@ public class JacksonJsonProvider extends JacksonJaxbJsonProvider { setMapper(objectMapper); } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache index 8c4cd4cbd1..a264da486f 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache @@ -4,6 +4,16 @@ import com.sun.jersey.core.spi.component.ComponentContext; import com.sun.jersey.spi.inject.Injectable; import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; +{{#jakarta}} +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.UriInfo; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; @@ -11,6 +21,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.time.LocalDate; import java.util.List; @@ -41,4 +52,4 @@ public class LocalDateProvider extends PerRequestTypeInjectableProvidergeneratedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache index d22f98fb8c..ba8b4156d8 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache @@ -17,10 +17,21 @@ import java.io.InputStream; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/pom.mustache index 4c03cfddc7..ea169f4130 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey1/pom.mustache @@ -45,8 +45,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} @@ -129,11 +129,20 @@ jersey-server ${jersey-version} +{{#jakarta}} + + jakarta.servlet + jakarta-api + ${servlet-api-version} + +{{/jakarta}} +{{^jakarta}} javax.servlet servlet-api ${servlet-api-version} +{{/jakarta}} junit @@ -180,8 +189,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} provided @@ -206,9 +215,9 @@ 2.8.9 1.7.21 4.13.1 - 2.5 + {{#jakarta}}6.0.0{{/jakarta}}{{^jakarta}}3.1.0{{/jakarta}} {{#useBeanValidation}} - 1.1.0.Final + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} {{/useBeanValidation}} UTF-8 diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache index 90a5fb6208..45a30ffee6 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache @@ -1,8 +1,15 @@ package {{apiPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.time.LocalDate; @@ -25,4 +32,4 @@ public class LocalDateProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/OffsetDateTimeProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/OffsetDateTimeProvider.mustache index fccb0deb16..6ab5876892 100644 --- a/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/OffsetDateTimeProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/libraries/jersey2/OffsetDateTimeProvider.mustache @@ -1,8 +1,15 @@ package {{apiPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.time.OffsetDateTime; @@ -25,4 +32,4 @@ public class OffsetDateTimeProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/model.mustache b/src/main/resources/handlebars/JavaJaxRS/model.mustache index 833c4a9c04..36b27798e7 100644 --- a/src/main/resources/handlebars/JavaJaxRS/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/model.mustache @@ -15,8 +15,14 @@ import org.apache.commons.lang3.ObjectUtils; import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; import javax.validation.Valid; +{{/jakarta}} {{/useBeanValidation}} {{/x-is-composed-model}} diff --git a/src/main/resources/handlebars/JavaJaxRS/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/pom.mustache index d7865064d3..c16743bf36 100644 --- a/src/main/resources/handlebars/JavaJaxRS/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/pom.mustache @@ -54,8 +54,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} @@ -205,8 +205,8 @@ {{#useBeanValidation}} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${beanvalidation-version} provided @@ -243,7 +243,7 @@ 1.2.9 2.5 {{#useBeanValidation}} - 1.1.0.Final + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} {{/useBeanValidation}} UTF-8 diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiOriginFilter.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiOriginFilter.mustache index 090fd8cb55..f9ef60c3ee 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiOriginFilter.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiOriginFilter.mustache @@ -2,11 +2,17 @@ package {{apiPackage}}; import java.io.IOException; +{{#jakarta}} +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletResponse; +{{/jakarta}} +{{^jakarta}} import javax.servlet.*; import javax.servlet.http.HttpServletResponse; +{{/jakarta}} {{>generatedAnnotation}} -public class ApiOriginFilter implements javax.servlet.Filter { +public class ApiOriginFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse res = (HttpServletResponse) response; diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiResponseMessage.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiResponseMessage.mustache index f47a535094..5851bdd03f 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiResponseMessage.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/ApiResponseMessage.mustache @@ -1,8 +1,15 @@ package {{apiPackage}}; +{{#jakarta}} +import jakarta.xml.bind.annotation.XmlTransient; + +@jakarta.xml.bind.annotation.XmlRootElement +{{/jakarta}} +{{^jakarta}} import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement +{{/jakarta}} {{>generatedAnnotation}} public class ApiResponseMessage { public static final int ERROR = 1; diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/JacksonConfig.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/JacksonConfig.mustache index 1be7abd835..abcbaac4e3 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/JacksonConfig.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/JacksonConfig.mustache @@ -15,8 +15,14 @@ import org.joda.time.LocalDate; import org.joda.time.format.ISODateTimeFormat; {{/joda}} +{{#jakarta}} +import jakarta.ws.rs.ext.ContextResolver; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.io.IOException; @Provider diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaDateTimeProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaDateTimeProvider.mustache index 74c24c8777..b0a115a41f 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaDateTimeProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaDateTimeProvider.mustache @@ -1,13 +1,22 @@ package {{apiPackage}}; import org.joda.time.DateTime; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +import jakarta.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; +{{/jakarta}} +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; @Provider @@ -36,4 +45,4 @@ public class JodaDateTimeProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaLocalDateProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaLocalDateProvider.mustache index 0b28c915dd..6d51e070a6 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaLocalDateProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/JodaLocalDateProvider.mustache @@ -1,13 +1,22 @@ package {{apiPackage}}; import org.joda.time.LocalDate; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +import jakarta.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; +{{/jakarta}} +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; @Provider @@ -36,4 +45,4 @@ public class JodaLocalDateProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/LocalDateProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/LocalDateProvider.mustache index a57e3e7475..86350d230e 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/LocalDateProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/LocalDateProvider.mustache @@ -1,9 +1,16 @@ package {{apiPackage}}; import java.time.LocalDate; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.lang.annotation.Annotation; import java.lang.reflect.Type; @@ -28,4 +35,4 @@ public class LocalDateProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/OffsetDateTimeProvider.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/OffsetDateTimeProvider.mustache index a3974c3c53..d3093bae45 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/OffsetDateTimeProvider.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/OffsetDateTimeProvider.mustache @@ -1,9 +1,16 @@ package {{apiPackage}}; import java.time.OffsetDateTime; +{{#jakarta}} +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; +{{/jakarta}} import java.lang.annotation.Annotation; import java.lang.reflect.Type; @@ -28,4 +35,4 @@ public class OffsetDateTimeProvider implements ParamConverterProvider { } return null; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/RestApplication.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/RestApplication.mustache index df9a31434b..74127894d7 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/RestApplication.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/RestApplication.mustache @@ -1,9 +1,15 @@ package {{invokerPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +{{/jakarta}} @ApplicationPath("/") public class RestApplication extends Application { -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/api.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/api.mustache index 57ebfa65d6..2154dffa6d 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/api.mustache @@ -27,14 +27,28 @@ import {{package}}.NotFoundException; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.inject.Inject; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.inject.Inject; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{#operations}} {{#operation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/apiService.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/apiService.mustache index 83741b6ec0..9ccd249952 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/apiService.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/apiService.mustache @@ -13,8 +13,14 @@ import {{package}}.NotFoundException; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/apiServiceImpl.mustache index aa22aae714..040406a8db 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/apiServiceImpl.mustache @@ -13,9 +13,16 @@ import {{package}}.NotFoundException; import java.io.InputStream; +{{#jakarta}} +import jakarta.enterprise.context.RequestScoped; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.enterprise.context.RequestScoped; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} @RequestScoped {{>generatedAnnotation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/JacksonConfig.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/JacksonConfig.mustache index 923d26477d..e2eda9dc19 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/JacksonConfig.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/JacksonConfig.mustache @@ -1,9 +1,17 @@ package {{invokerPackage}}; +{{#jakarta}} +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.ext.ContextResolver; +import jakarta.ws.rs.ext.Provider; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; +{{/jakarta}} import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,4 +49,4 @@ public class JacksonConfig implements ContextResolver { public ObjectMapper getContext(Class objectType) { return objectMapper; } -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/RestApplication.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/RestApplication.mustache index f208b4e4da..1ddfaf8946 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/RestApplication.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/RestApplication.mustache @@ -1,7 +1,17 @@ package {{invokerPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +{{/jakarta}} import java.util.Set; import java.util.HashSet; @@ -10,7 +20,6 @@ import java.util.HashSet; import io.swagger.jaxrs.config.BeanConfig; {{/useOas2}} {{^useOas2}} -import javax.servlet.ServletConfig; import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; import io.swagger.v3.oas.integration.OpenApiConfigurationException; import io.swagger.v3.oas.integration.SwaggerConfiguration; @@ -18,7 +27,6 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; -import javax.ws.rs.core.Context; import java.util.stream.Collectors; import java.util.stream.Stream; {{/useOas2}} @@ -98,4 +106,4 @@ public class RestApplication extends Application { -} \ No newline at end of file +} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/api.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/api.mustache index 6785626684..0bb116e491 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/api.mustache @@ -25,12 +25,25 @@ import java.util.Map; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +{{/jakarta}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{#operations}} {{#operation}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/apiServiceImpl.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/apiServiceImpl.mustache index b37b1cf289..29558d2992 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/apiServiceImpl.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/apiServiceImpl.mustache @@ -12,8 +12,14 @@ import java.util.List; import java.io.InputStream; +{{#jakarta}} +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +{{/jakarta}} {{>generatedAnnotation}} {{#operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/generatedAnnotation.mustache index a47b6faa85..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/generatedAnnotation.mustache @@ -1 +1 @@ -{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/gradle.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/gradle.mustache index 7ffb519dbe..f0d8e3d9d8 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/gradle.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/gradle.mustache @@ -12,11 +12,11 @@ dependencies { providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final' - providedCompile 'javax.annotation:javax.annotation-api:1.2' + providedCompile 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}' providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final' compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final' {{#useBeanValidation}} - providedCompile 'javax.validation:validation-api:1.1.0.Final' + providedCompile 'jakarta.validation:jakarta.validation-api:{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}' {{/useBeanValidation}} {{^java8}} compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.10.1' diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/model.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/model.mustache index 41abb664d0..5efaee7d00 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/model.mustache @@ -9,7 +9,12 @@ import java.util.ArrayList; import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{/x-is-composed-model}} {{#models}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/pom.mustache index 2b3e981440..134cdd7d4e 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/eap/pom.mustache @@ -98,8 +98,8 @@ ${slf4j-version} - javax.servlet - servlet-api + jakarta.servlet + jakarta-api ${servlet-api-version} @@ -134,9 +134,9 @@ ${resteasy-version} - javax.annotation - javax.annotation-api - 1.2 + jakarta.annotation + jakarta.annotation-api + {{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}} {{#useOas2}} @@ -181,9 +181,9 @@ {{#useBeanValidation}} - javax.validation - validation-api - 1.1.0.Final + jakarta.validation + jakarta.validation-api + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} {{/useBeanValidation}} {{^java8}} @@ -248,6 +248,6 @@ 3.0.11.Final 1.6.3 4.13.1 - 2.5 + {{#jakarta}}6.0.0{{/jakarta}}{{^jakarta}}3.1.0{{/jakarta}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/generatedAnnotation.mustache index a47b6faa85..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/generatedAnnotation.mustache @@ -1 +1 @@ -{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/gradle.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/gradle.mustache index 2bb67d8638..a2f37b6e42 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/gradle.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/gradle.mustache @@ -12,7 +12,7 @@ dependencies { providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final' - providedCompile 'javax.annotation:javax.annotation-api:1.2' + providedCompile 'jakarta.annotation:jakarta.annotation-api:{{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}}' providedCompile 'javax:javaee-api:7.0' providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final' {{#useOas2}} @@ -24,7 +24,7 @@ dependencies { compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final' compile 'org.apache.httpcomponents:httpclient:4.5.10' {{#useBeanValidation}} - providedCompile 'javax.validation:validation-api:1.1.0.Final' + providedCompile 'jakarta.validation:jakarta.validation-api:{{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}}' {{/useBeanValidation}} {{^java8}} compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.10.1' diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/model.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/model.mustache index 41abb664d0..5efaee7d00 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/model.mustache @@ -9,7 +9,12 @@ import java.util.ArrayList; import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; +{{/jakarta}} {{/useBeanValidation}} {{/x-is-composed-model}} {{#models}} diff --git a/src/main/resources/handlebars/JavaJaxRS/resteasy/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/resteasy/pom.mustache index 70a6016cfe..b7cc782eb1 100644 --- a/src/main/resources/handlebars/JavaJaxRS/resteasy/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/resteasy/pom.mustache @@ -84,12 +84,22 @@ slf4j-log4j12 ${slf4j-version} + {{#jakarta}} + + jakarta.servlet + jakarta-api + ${servlet-api-version} + provided + + {{/jakarta}} + {{^jakarta}} javax.servlet servlet-api ${servlet-api-version} provided + {{/jakarta}} org.jboss.resteasy @@ -121,9 +131,9 @@ provided - javax.annotation - javax.annotation-api - 1.2 + jakarta.annotation + jakarta.annotation-api + {{#jakarta}}2.1.1{{/jakarta}}{{^jakarta}}1.3.5{{/jakarta}} provided {{#java8}} @@ -194,9 +204,9 @@ {{#useBeanValidation}} - javax.validation - validation-api - 1.1.0.Final + jakarta.validation + jakarta.validation-api + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} provided {{/useBeanValidation}} @@ -222,7 +232,7 @@ 3.0.11.Final 1.6.3 4.13.1 - 2.5 + {{#jakarta}}6.0.0{{/jakarta}}{{^jakarta}}3.1.0{{/jakarta}} {{#java8}}2.10.1{{/java8}} diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/RestApplication.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/RestApplication.mustache index 82b8d9533e..74127894d7 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/RestApplication.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/RestApplication.mustache @@ -1,7 +1,13 @@ package {{invokerPackage}}; +{{#jakarta}} +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +{{/jakarta}} @ApplicationPath("/") public class RestApplication extends Application { diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/api.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/api.mustache index 305d2ac928..e942aa61e7 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/api.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/api.mustache @@ -3,8 +3,14 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} +{{#jakarta}} +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; +{{/jakarta}} +{{^jakarta}} import javax.ws.rs.*; import javax.ws.rs.core.Response; +{{/jakarta}} {{#useOas2}} import io.swagger.annotations.*; @@ -22,8 +28,16 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import java.util.Map; import java.util.List; -{{#useBeanValidation}}import javax.validation.constraints.*; -import javax.validation.Valid;{{/useBeanValidation}} +{{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/jakarta}} +{{^jakarta}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/jakarta}} +{{/useBeanValidation}} @Path("/{{{baseName}}}") {{#useOas2}} @@ -40,4 +54,4 @@ import javax.validation.Valid;{{/useBeanValidation}} {{/contents}} {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/generatedAnnotation.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/generatedAnnotation.mustache index ad17a426e9..c6c0883bcb 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/generatedAnnotation.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/generatedAnnotation.mustache @@ -1,3 +1 @@ -{{^hideGenerationTimestamp}} -@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") -{{/hideGenerationTimestamp}} \ No newline at end of file +{{^hideGenerationTimestamp}}@{{#jakarta}}jakarta{{/jakarta}}{{^jakarta}}javax{{/jakarta}}.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/model.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/model.mustache index 12a22e18ee..67a3c2dd73 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/model.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/model.mustache @@ -7,8 +7,14 @@ package {{package}}; import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} +{{#jakarta}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/jakarta}} +{{^jakarta}} import javax.validation.constraints.*; import javax.validation.Valid; +{{/jakarta}} {{/useBeanValidation}} {{/x-is-composed-model}} diff --git a/src/main/resources/handlebars/JavaJaxRS/spec/pom.mustache b/src/main/resources/handlebars/JavaJaxRS/spec/pom.mustache index 4a8e89beb4..2a3d8cdfc0 100644 --- a/src/main/resources/handlebars/JavaJaxRS/spec/pom.mustache +++ b/src/main/resources/handlebars/JavaJaxRS/spec/pom.mustache @@ -55,9 +55,9 @@ {{/java11}} - javax.ws.rs - javax.ws.rs-api - 2.0 + jakarta.ws.rs + jakarta.ws.rs-api + {{#jakarta}}3.1.0{{/jakarta}}{{^jakarta}}2.1.6{{/jakarta}} provided {{#useOas2}} @@ -105,9 +105,9 @@ {{#useBeanValidation}} - javax.validation - validation-api - 1.1.0.Final + jakarta.validation + jakarta.validation-api + {{#jakarta}}3.0.2{{/jakarta}}{{^jakarta}}2.0.2{{/jakarta}} provided {{/useBeanValidation}}