You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/02/15 12:48:19 UTC
[tomee] 02/08: Corrected JAXRS assertStatusCode check and fixed
CXFJAXRSFilter enhancement request matching
This is an automated email from the ASF dual-hosted git repository.
radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 5c53f5652909ace68af6b4b944237ea3cdf965c5
Author: James Meen <ja...@my-managed.net>
AuthorDate: Mon Feb 11 14:40:12 2019 +0000
Corrected JAXRS assertStatusCode check and fixed CXFJAXRSFilter enhancement request matching
---
.../java/org/apache/openejb/arquillian/tests/jaxrs/JaxrsTest.java | 4 ++--
.../java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java | 8 ++++++--
.../org/apache/tomee/microprofile/config/TomEEConfigSource.java | 2 ++
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/JaxrsTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/JaxrsTest.java
index 9a6c15c..ebe5acd 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/JaxrsTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/JaxrsTest.java
@@ -78,8 +78,8 @@ public class JaxrsTest {
return URI.create(String.format("%s%s", url.toExternalForm(), path));
}
- public static void assertStatusCode(int actual, HttpResponse response) {
- Assert.assertEquals(response.getStatusLine().getStatusCode(), actual);
+ public static void assertStatusCode(int expected, HttpResponse response) {
+ Assert.assertEquals(expected, response.getStatusLine().getStatusCode());
}
public static String asString(HttpResponse execute) throws IOException {
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
index b77b5b0..d05d213 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
@@ -39,6 +39,7 @@ import org.apache.cxf.jaxrs.model.URITemplate;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor;
import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationOutInterceptor;
import org.apache.cxf.jaxrs.validation.ValidationExceptionMapper;
@@ -339,14 +340,17 @@ public class CxfRsHttpListener implements RsHttpListener {
if( service == null ) {
return false;
}
+
+ String pathToMatch = HttpUtils.getPathToMatch(request.getServletPath(), pattern, true);
+
final List<ClassResourceInfo> resources = service.getClassResourceInfos();
for (final ClassResourceInfo info : resources) {
if (info.getResourceClass() == null || info.getURITemplate() == null) { // possible?
continue;
}
-
+
final MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
- if (info.getURITemplate().match(request.getServletPath(), parameters)) {
+ if (info.getURITemplate().match(pathToMatch, parameters)) {
return true;
}
}
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/config/TomEEConfigSource.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/config/TomEEConfigSource.java
index 036b42b..6085de4 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/config/TomEEConfigSource.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/config/TomEEConfigSource.java
@@ -43,12 +43,14 @@ public class TomEEConfigSource implements ConfigSource {
if (mpIgnoredApps.stream().anyMatch(s -> s.equalsIgnoreCase(appContextOrWeb.getId()))) {
openTracingFilterActive(false);
+ metricsJaxRsActive(false);
}
}
final String mpScan = SystemInstance.get().getOptions().get("tomee.mp.scan", "none");
if (mpScan.equals("none")) {
openTracingFilterActive(false);
+ metricsJaxRsActive(false);
}
}