Repository: quarkusio/quarkus
Issue: List<PathSegment> exception on RESTEasy Reactive

## Describe the bug
As I asked in [Zulip](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/PathSegment.20exception.20on.20RESTEasy.20Reactive), I wanted to use `List<PathSegment>` with RESTEasy Reactive extension to use @PathParam and Regular Expressions. i.e. @Path("{keyword:.*}")
https://docs.jboss.org/resteasy/docs/4.6.0.Final/userguide/html_single/index.html#_PathParam_and_PathSegment

But I'm getting exceptions as below:
https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/README.adoc

It is working properly with `@PathParam("id") PathSegment id`:
https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/src/main/java/org/acme/getting/started/ReactiveGreetingResource.java#L51-L55

However, getting errors `java.lang.RuntimeException: Failed to find converter for javax.ws.rs.core.PathSegment` with `@PathParam("keyword") List<PathSegment> keywords` while startup Quarkus.
https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/src/main/java/org/acme/getting/started/ReactiveGreetingResource.java#L57-L61

Note that it is working properly for the same code with List<PathSegment> on my other Quarkus app with quarkus-resteasy extension.

### Expected behavior
No exception for the usage of List<PathSegment> with quarkus-resteasy extension

### Actual behavior
~~~
2021-05-02 02:16:02,416 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method org.acme.getting.started.ReactiveGreetingResource#java.lang.String searchByKeywords(java.util.List<javax.ws.rs.core.PathSegment> keywords)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:238)
	at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.setupEndpoints(ResteasyReactiveProcessor.java:402)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.RuntimeException: Failed to process method org.acme.getting.started.ReactiveGreetingResource#java.lang.String searchByKeywords(java.util.List<javax.ws.rs.core.PathSegment> keywords)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:524)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:285)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:209)
	... 11 more
Caused by: java.lang.RuntimeException: Failed to find converter for javax.ws.rs.core.PathSegment
	at io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer.extractConverter(QuarkusServerEndpointIndexer.java:198)
	at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleListParam(ServerEndpointIndexer.java:277)
	at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleListParam(ServerEndpointIndexer.java:57)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.extractParameterInfo(EndpointIndexer.java:909)
	at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:407)
	... 13 more
~~~

## To Reproduce
Please run this reproducer project:
https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment

~~~
./mvnw quarkus:dev
~~~

### Quarkus version or git rev
QUARKUS 1.13.3




Changed files:
extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java
independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java
independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java
extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java
extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java

diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java
index 802da5d0339..a5e08aefd1d 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java
@@ -151,8 +151,8 @@ public static void generate(Map<DotName, MethodInfo> resourcesThatNeedCustomProd
                 ResultHandle quarkusRestContextHandle = m.invokeVirtualMethod(getContextMethodCreator.getMethodDescriptor(),
                         m.getThis());
                 ResultHandle extractorHandle = m.newInstance(
-                        MethodDescriptor.ofConstructor(PathParamExtractor.class, int.class, boolean.class),
-                        m.getMethodParam(0), m.load(false));
+                        MethodDescriptor.ofConstructor(PathParamExtractor.class, int.class, boolean.class, boolean.class),
+                        m.getMethodParam(0), m.load(false), m.load(true));
                 ResultHandle resultHandle = m.invokeVirtualMethod(MethodDescriptor.ofMethod(PathParamExtractor.class,
                         "extractParameter", Object.class, ResteasyReactiveRequestContext.class), extractorHandle,
                         quarkusRestContextHandle);
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
index 4271339ce3c..43b6427f271 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
@@ -10,6 +10,7 @@
 import java.util.function.Predicate;
 
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.PathSegment;
 
 import org.jboss.jandex.AnnotationInstance;
 import org.jboss.jandex.ClassInfo;
@@ -26,6 +27,7 @@
 import org.jboss.resteasy.reactive.server.core.parameters.converters.NoopParameterConverter;
 import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverter;
 import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverterSupplier;
+import org.jboss.resteasy.reactive.server.core.parameters.converters.PathSegmentParamConverter;
 import org.jboss.resteasy.reactive.server.core.parameters.converters.RuntimeResolvedConverter;
 import org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer;
 import org.jboss.resteasy.reactive.server.processor.ServerIndexedParameter;
@@ -133,6 +135,8 @@ protected ParameterConverterSupplier extractConverter(String elementType, IndexV
             if (delegate == null)
                 throw new RuntimeException("Failed to find converter for " + elementType);
             return delegate;
+        } else if (elementType.equals(PathSegment.class.getName())) {
+            return new PathSegmentParamConverter.Supplier();
         }
 
         MethodDescriptor fromString = null;
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java
index c172e743f13..900fd9752b1 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java
@@ -1,7 +1,11 @@
 package io.quarkus.resteasy.reactive.server.test.path;
 
+import java.util.List;
+
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.PathSegment;
 
 /**
  * Per spec:
@@ -25,4 +29,10 @@ public String hello() {
     public String nested() {
         return "world hello";
     }
+
+    @GET
+    @Path("other/{keyword:.*}")
+    public String searchByKeywords(@PathParam("keyword") List<PathSegment> keywords) {
+        return keywords.toString();
+    }
 }
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java
index 96acfeb0d4f..66579e73e7c 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java
@@ -25,4 +25,11 @@ public void testRestPath() {
         RestAssured.when().get("/app/foo/hello").then().statusCode(200).body(Matchers.is("hello"));
         RestAssured.when().get("/app/foo/hello/nested").then().statusCode(200).body(Matchers.is("world hello"));
     }
+
+    @Test
+    public void testListOfPathParams() {
+        RestAssured.basePath = "/";
+        RestAssured.when().get("/app/foo/hello/other/bar/baz/boo/bob").then().statusCode(200)
+                .body(Matchers.is("[bar, baz, boo, bob]"));
+    }
 }
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java
index 3a018f4651c..60d592571db 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java
@@ -1,5 +1,6 @@
 package org.jboss.resteasy.reactive.server.core.parameters;
 
+import java.util.List;
 import org.jboss.resteasy.reactive.common.util.Encode;
 import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext;
 
@@ -7,18 +8,24 @@ public class PathParamExtractor implements ParameterExtractor {
 
     private final int index;
     private final boolean encoded;
+    private final boolean single;
 
-    public PathParamExtractor(int index, boolean encoded) {
+    public PathParamExtractor(int index, boolean encoded, boolean single) {
         this.index = index;
         this.encoded = encoded;
+        this.single = single;
     }
 
     @Override
     public Object extractParameter(ResteasyReactiveRequestContext context) {
         String pathParam = context.getPathParam(index);
         if (encoded) {
-            return Encode.encodeQueryParam(pathParam);
+            pathParam = Encode.encodeQueryParam(pathParam);
+        }
+        if (single) {
+            return pathParam;
+        } else {
+            return List.of(pathParam.split("/"));
         }
-        return pathParam;
     }
 }
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java
index 14d865cbc55..e2c1cbe2dfe 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java
@@ -536,7 +536,7 @@ public ParameterExtractor parameterExtractor(Map<String, Integer> pathParameterI
                         extractor = new NullParamExtractor();
                     }
                 } else {
-                    extractor = new PathParamExtractor(index, encoded);
+                    extractor = new PathParamExtractor(index, encoded, single);
                 }
                 return extractor;
             case CONTEXT: