org.mockserver.url.URLParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockserver-core Show documentation
Show all versions of mockserver-core Show documentation
Functionality used by all MockServer modules for matching and expectations
package org.mockserver.url;
/**
* @author jamesdbloom
*/
public class URLParser {
private static final String schemeRegex = "(https?:)?//.*";
private static final String schemeHostAndPortRegex = "(https?:)?//([A-z0-9-_.:]*@)?[A-z0-9-_.]*(:[0-9]*)?";
public static boolean isFullUrl(String uri) {
return uri != null && uri.matches(schemeRegex);
}
public static String returnPath(String path) {
if (URLParser.isFullUrl(path)) {
return path.replaceAll(schemeHostAndPortRegex, "");
} else {
return path;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy