You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2021/04/29 06:07:30 UTC

[tomee-jakarta] 01/02: TOMEE-3163 jaxrs.ee.rs.get optionSubTest

This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-jakarta.git

commit 364fea60771c8b09e59258174c11dabafecf0ae2
Author: David Blevins <da...@gmail.com>
AuthorDate: Wed Apr 28 21:05:58 2021 -0700

    TOMEE-3163 jaxrs.ee.rs.get optionSubTest
    
    While carefully not breaking
     CXF-8486   jaxrs.ee.rs.pathparam.locator pathParamEntityWithConstructorTest                                        Open
     CXF-8487   jaxrs.ee.rs.pathparam.locator pathParamEntityWithFromStringTest                                         Open
     CXF-8488   jaxrs.ee.rs.pathparam.locator pathParamEntityWithValueOfTest                                            Open
     CXF-8489   jaxrs.ee.rs.pathparam.locator pathParamListEntityWithFromStringTest                                     Open
     CXF-8490   jaxrs.ee.rs.pathparam.locator pathParamSetEntityWithFromStringTest                                      Open
     CXF-8491   jaxrs.ee.rs.pathparam.locator pathParamThrowingIllegalArgumentExceptionTest                             Open
     CXF-8492   jaxrs.ee.rs.pathparam.locator pathParamThrowingWebApplicationExceptionTest                              Open
     CXF-8493   jaxrs.ee.rs.pathparam.locator test1                                                                     Open
     CXF-8494   jaxrs.ee.rs.pathparam.locator test2                                                                     Open
     CXF-8495   jaxrs.ee.rs.pathparam.locator test3                                                                     Open
     CXF-8496   jaxrs.ee.rs.pathparam.locator test4                                                                     Open
     CXF-8497   jaxrs.ee.rs.pathparam.locator test5                                                                     Open
---
 .../src/patch/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/transform/src/patch/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/transform/src/patch/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 97c4a91..0254368 100644
--- a/transform/src/patch/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/transform/src/patch/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -394,6 +394,8 @@ public final class JAXRSUtils {
         int methodMatched = 0;
         int consumeMatched = 0;
 
+        boolean resourceMethodsAdded = false;
+        boolean generateOptionsResponse = false;
         List<OperationResourceInfo> finalPathSubresources = null;
         for (Map.Entry<ClassResourceInfo, MultivaluedMap<String, String>> rEntry : matchedResources.entrySet()) {
             ClassResourceInfo resource = rEntry.getKey();
@@ -433,18 +435,21 @@ public final class JAXRSUtils {
                                     if (matchProduceTypes(acceptType, ori)) {
                                         candidateList.put(ori, map);
                                         added = true;
+                                        resourceMethodsAdded = true;
                                         break;
                                     }
                                 }
                             }
                             //CHECKSTYLE:ON
+                        } else if ("OPTIONS".equalsIgnoreCase(httpMethod)) {
+                            generateOptionsResponse = true;
                         }
                     }
                 }
                 LOG.fine(matchMessageLogSupplier(ori, path, httpMethod, requestType, acceptContentTypes, added));
             }
         }
-        if (finalPathSubresources != null && pathMatched > 0
+        if (finalPathSubresources != null && (resourceMethodsAdded || generateOptionsResponse)
             && !MessageUtils.getContextualBoolean(message, KEEP_SUBRESOURCE_CANDIDATES, false)) {
             for (OperationResourceInfo key : finalPathSubresources) {
                 candidateList.remove(key);
@@ -631,9 +636,6 @@ public final class JAXRSUtils {
     }
 
     private static boolean matchHttpMethod(String expectedMethod, String httpMethod) {
-        if ("*".equals(httpMethod)) {
-            return true;
-        }
         return expectedMethod.equalsIgnoreCase(httpMethod)
             || headMethodPossible(expectedMethod, httpMethod)
             || expectedMethod.equals(DefaultMethod.class.getSimpleName());