You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2024/03/19 00:44:22 UTC

(cxf) 01/07: Only explicitly return the stylesheet in WadlGenerator and not other URLs (#1749)

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

reta pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit bafb0cadf723fc3962031c34f1f20dc0e8b7a36b
Author: Colm O hEigeartaigh <co...@users.noreply.github.com>
AuthorDate: Fri Mar 15 15:23:43 2024 +0000

    Only explicitly return the stylesheet in WadlGenerator and not other URLs (#1749)
    
    (cherry picked from commit df2241c59481a57aebb1c0693b778a35baaf5570)
    (cherry picked from commit 378afe1acb7503315bc63555c8743db0f55d8312)
---
 .../java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index 7d8ea7096d..7dd8bf90ae 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -242,9 +242,17 @@ public class WadlGenerator implements ContainerRequestFilter {
                 if (path.startsWith("/") && !path.isEmpty()) {
                     path = path.substring(1);
                 }
-                if (stylesheetReference != null && path.endsWith(".xsl")
-                    || docLocationMap.containsKey(path)) {
+
+                if (docLocationMap.containsKey(path)) {
                     context.abortWith(getExistingResource(m, ui, path));
+                } else if (stylesheetReference != null) {
+                    String theStylesheetReference = stylesheetReference;
+                    if (theStylesheetReference.startsWith("/")) {
+                        theStylesheetReference = theStylesheetReference.substring(1);
+                    }
+                    if (path.endsWith(theStylesheetReference)) {
+                        context.abortWith(getExistingResource(m, ui, stylesheetReference));
+                    }
                 }
             }
             return;