diff --git a/bom/application/pom.xml b/bom/application/pom.xml index dbebd9d7917e4..d54d8373af776 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -50,7 +50,7 @@ 1.2.2 1.0.13 2.7.0 - 2.19.0 + 2.21.0 3.15.0 1.1.0 1.2.1 @@ -107,20 +107,14 @@ 1.0.1.Final 1.19.0.Final 3.4.2.Final - 4.2.5 - - 4.2.5.1 + 4.2.7 4.5.13 4.4.15 4.1.5 9.1.6 2.3.2 1.4.197 - 42.3.3 + 42.3.4 3.0.4 8.0.28 7.2.2.jre8 @@ -157,7 +151,7 @@ 3.1.0 4.2.0 1.0.9 - 8.5.7 + 8.5.8 1.0.11 4.9.0 1.30 @@ -287,13 +281,6 @@ import pom - - - io.vertx - vertx-oracle-client - ${vertx.oracle-client.version} - diff --git a/docs/src/main/asciidoc/scripting.adoc b/docs/src/main/asciidoc/scripting.adoc index 61d8d73b4062a..b552a19e47cc6 100644 --- a/docs/src/main/asciidoc/scripting.adoc +++ b/docs/src/main/asciidoc/scripting.adoc @@ -28,7 +28,8 @@ Normally we would link to a Git repository to clone but in this case there is no [source,java,subs=attributes+] ---- //usr/bin/env jbang "$0" "$@" ; exit $? -//DEPS io.quarkus:quarkus-resteasy-reactive:{quarkus-version} +//DEPS io.quarkus.platform:quarkus-bom:{quarkus-version}@pom +//DEPS io.quarkus:quarkus-resteasy-reactive //JAVAC_OPTIONS -parameters //JAVA_OPTIONS -Djava.util.logging.manager=org.jboss.logmanager.LogManager @@ -105,20 +106,21 @@ You will find at the top a line looking like this: This line is what on Linux and macOS allows you to run it as a script. On Windows this line is ignored. -The next line +The next lines [source,java] ---- // //DEPS ---- -Is illustrating how you add dependencies to this script. This is a feature of JBang. +illustrate how you add dependencies to this script. This is a feature of JBang. -Go ahead and update this line to include the `quarkus-resteasy-reactive` dependency like so: +Go ahead and update this line to include the `quarkus-bom` and the `quarkus-resteasy-reactive` dependency like so: [source,java,subs=attributes+] ---- -//DEPS io.quarkus:quarkus-resteasy-reactive:{quarkus-version} +//DEPS io.quarkus.platform:quarkus-bom:{quarkus-version}@pom +//DEPS io.quarkus:quarkus-resteasy-reactive ---- Now, run `jbang quarkusapp.java` and you will see JBang resolving this dependency and building the jar with help from Quarkus' JBang integration. diff --git a/extensions/amazon-lambda-http/deployment/pom.xml b/extensions/amazon-lambda-http/deployment/pom.xml index f3b04e2293f73..6785c8ce70636 100644 --- a/extensions/amazon-lambda-http/deployment/pom.xml +++ b/extensions/amazon-lambda-http/deployment/pom.xml @@ -45,6 +45,15 @@ + + + src/main/resources + + + src/main/resources/http + false + + maven-compiler-plugin diff --git a/extensions/amazon-lambda-rest/deployment/pom.xml b/extensions/amazon-lambda-rest/deployment/pom.xml index ee947d1bc5adb..893a1316b2ca5 100644 --- a/extensions/amazon-lambda-rest/deployment/pom.xml +++ b/extensions/amazon-lambda-rest/deployment/pom.xml @@ -41,6 +41,15 @@ + + + src/main/resources + + + src/main/resources/http + false + + maven-compiler-plugin diff --git a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java index 8596e113253c2..c7d56a98c7bea 100644 --- a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java +++ b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java @@ -14,6 +14,7 @@ import java.nio.file.attribute.FileTime; import java.time.Duration; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -24,6 +25,7 @@ import java.util.Set; import java.util.function.Predicate; import java.util.function.Supplier; +import java.util.stream.Collectors; import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.logging.Logger; @@ -155,7 +157,14 @@ public DevServicesResultBuildItem startKeycloakContainer( } } if (!restartRequired) { - return devService.toBuildItem(); + DevServicesResultBuildItem result = devService.toBuildItem(); + String usersString = result.getConfig().get(OIDC_USERS); + Map users = (usersString == null || usersString.isBlank()) ? Map.of() + : Arrays.stream(usersString.split(",")) + .map(s -> s.split("=")).collect(Collectors.toMap(s -> s[0], s -> s[1])); + keycloakBuildItemBuildProducer + .produce(new KeycloakDevServicesConfigBuildItem(result.getConfig(), Map.of(OIDC_USERS, users))); + return result; } try { devService.close(); @@ -257,6 +266,8 @@ private Map prepareConfiguration( configProperties.put(APPLICATION_TYPE_CONFIG_KEY, oidcApplicationType); configProperties.put(CLIENT_ID_CONFIG_KEY, oidcClientId); configProperties.put(CLIENT_SECRET_CONFIG_KEY, oidcClientSecret); + configProperties.put(OIDC_USERS, users.entrySet().stream() + .map(e -> e.toString()).collect(Collectors.joining(","))); keycloakBuildItemBuildProducer .produce(new KeycloakDevServicesConfigBuildItem(configProperties, Map.of(OIDC_USERS, users))); diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java index bbba0cd17f0eb..64c87794043ec 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java @@ -510,11 +510,14 @@ public Integer get() { public ThreadFactory createThreadFactory(LaunchMode launchMode) { Optional nonDevModeTccl = setupThreadFactoryTccl(launchMode); AtomicInteger threadCount = new AtomicInteger(0); - return runnable -> { - VertxThread thread = createVertxThread(runnable, - "executor-thread-" + threadCount.getAndIncrement(), true, 0, null, launchMode, nonDevModeTccl); - thread.setDaemon(true); - return thread; + return new ThreadFactory() { + @Override + public Thread newThread(Runnable runnable) { + VertxThread thread = createVertxThread(runnable, + "executor-thread-" + threadCount.getAndIncrement(), true, 0, null, launchMode, nonDevModeTccl); + thread.setDaemon(true); + return thread; + } }; } diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java index 6205605a852cd..4866f341dd1cb 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java @@ -20,6 +20,7 @@ import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.FORM_PARAM; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.HEADER_PARAM; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.HTTP_HEADERS; +import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.INSTANT; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.INTEGER; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.LIST; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.LOCAL_DATE; @@ -143,7 +144,8 @@ public abstract class EndpointIndexer SUPPORT_TEMPORAL_PARAMS = Set.of(LOCAL_DATE, LOCAL_TIME, LOCAL_DATE_TIME, OFFSET_TIME, + private static final Set SUPPORT_TEMPORAL_PARAMS = Set.of(INSTANT, LOCAL_DATE, LOCAL_TIME, LOCAL_DATE_TIME, + OFFSET_TIME, OFFSET_DATE_TIME, ZONED_DATE_TIME); protected static final Logger log = Logger.getLogger(EndpointIndexer.class); diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/ResteasyReactiveDotNames.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/ResteasyReactiveDotNames.java index 2d37bddb44ead..9896a9f67c222 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/ResteasyReactiveDotNames.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/ResteasyReactiveDotNames.java @@ -8,6 +8,7 @@ import java.io.OutputStream; import java.math.BigDecimal; import java.math.BigInteger; +import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -182,6 +183,7 @@ public final class ResteasyReactiveDotNames { public static final DotName DUMMY_ELEMENT_TYPE = DotName.createSimple(DummyElementType.class.getName()); public static final DotName MULTI_VALUED_MAP = DotName.createSimple(MultivaluedMap.class.getName()); public static final DotName PATH_SEGMENT = DotName.createSimple(PathSegment.class.getName()); + public static final DotName INSTANT = DotName.createSimple(Instant.class.getName()); public static final DotName LOCAL_DATE = DotName.createSimple(LocalDate.class.getName()); public static final DotName LOCAL_DATE_TIME = DotName.createSimple(LocalDateTime.class.getName()); public static final DotName LOCAL_TIME = DotName.createSimple(LocalTime.class.getName()); diff --git a/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java b/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java index 906cb11956b64..7ec7a11e268c1 100644 --- a/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java +++ b/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java @@ -3,6 +3,7 @@ import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.DATE_FORMAT; +import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.INSTANT; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.JAX_RS_ANNOTATIONS_FOR_FIELDS; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.JSONP_JSON_ARRAY; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.JSONP_JSON_NUMBER; @@ -57,6 +58,7 @@ import org.jboss.resteasy.reactive.server.core.parameters.converters.ArrayConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.CharParamConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.CharacterParamConverter; +import org.jboss.resteasy.reactive.server.core.parameters.converters.InstantParamConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.ListConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.LoadedParameterConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.LocalDateParamConverter; @@ -403,6 +405,16 @@ protected void handleTemporalParam(ServerIndexedParameter builder, DotName param } } + if (INSTANT.equals(paramType)) { + if (dateFormatInstance != null) { + throw new RuntimeException(contextualizeErrorMessage( + "'java.time.Instant' types must not be annotated with '@DateFormat'", + currentMethodInfo)); + } + builder.setConverter(new InstantParamConverter.Supplier()); + return; + } + if ((format != null) && (dateTimeFormatterProviderClassName != null)) { throw new RuntimeException(contextualizeErrorMessage( "Using both 'format' and 'dateTimeFormatterProvider' is not allowed when using '@DateFormat'", diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/converters/InstantParamConverter.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/converters/InstantParamConverter.java new file mode 100644 index 0000000000000..9349a53feec1b --- /dev/null +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/converters/InstantParamConverter.java @@ -0,0 +1,27 @@ +package org.jboss.resteasy.reactive.server.core.parameters.converters; + +import java.time.Instant; + +public class InstantParamConverter implements ParameterConverter { + + @Override + public Object convert(Object value) { + return Instant.parse(value.toString()); + } + + public static class Supplier implements ParameterConverterSupplier { + + public Supplier() { + } + + @Override + public ParameterConverter get() { + return new InstantParamConverter(); + } + + @Override + public String getClassName() { + return InstantParamConverter.class.getName(); + } + } +} diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/simple/InstantParamTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/simple/InstantParamTest.java new file mode 100644 index 0000000000000..d5452293af97d --- /dev/null +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/simple/InstantParamTest.java @@ -0,0 +1,38 @@ +package org.jboss.resteasy.reactive.server.vertx.test.simple; + +import io.restassured.RestAssured; +import java.time.Duration; +import java.time.Instant; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import org.hamcrest.Matchers; +import org.jboss.resteasy.reactive.RestQuery; +import org.jboss.resteasy.reactive.server.vertx.test.framework.ResteasyReactiveUnitTest; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class InstantParamTest { + + @RegisterExtension + static ResteasyReactiveUnitTest test = new ResteasyReactiveUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addClasses(HelloResource.class)); + + @Test + public void test() { + RestAssured.get("/hello?instant=1984-08-08T01:02:03Z") + .then().statusCode(200).body(Matchers.equalTo("hello#1984-08-09T01:02:03Z")); + } + + @Path("hello") + public static class HelloResource { + + @GET + public String helloQuery(@RestQuery Instant instant) { + return "hello#" + instant.plus(Duration.ofDays(1)).toString(); + } + } + +}