coheigea commented on code in PR #3794:
URL: https://github.com/apache/cxf/pull/3794#discussion_r4720494054
##########
core/src/main/java/org/apache/cxf/resource/URIResolver.java:
##########
@@ -508,6 +509,51 @@ public static boolean isLocalReference(String href, String
base) {
}
}
+ /**
+ * Returns whether a reference may be fetched under the allowed schemes
(see {@link #getAllowedSchemes()}).
+ * A relative reference is checked against the base URI, or is allowed if
there is no base URI. For an
+ * archive URL such as jar:http://host/a.jar!/a.xsd, the archive
location's scheme must also be allowed.
+ * Unlike {@link #checkAllowedScheme(URL)}, this does not need the
reference to parse as a URL or URI.
+ */
+ public static boolean isAllowedReference(String href, String base) {
+ return href != null && getDisallowedScheme(href, base) == null;
+ }
+
+ /**
+ * Returns the first scheme of a reference that is not allowed, as for
+ * {@link #isAllowedReference(String, String)}, or null if all of its
schemes are allowed.
+ */
+ public static String getDisallowedScheme(String href, String base) {
Review Comment:
@reta Actually I'm going to use it in a follow-on patch, so I'll leave it
public for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]