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

(cxf) branch 3.6.x-fixes updated: Only explicitly return the stylesheet in WadlGenerator and not other URLs (#1749)

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

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


The following commit(s) were added to refs/heads/3.6.x-fixes by this push:
     new 378afe1acb Only explicitly return the stylesheet in WadlGenerator and not other URLs (#1749)
378afe1acb is described below

commit 378afe1acb7503315bc63555c8743db0f55d8312
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)
---
 .../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 c3194847e8..23c0e297d6 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;