}
public static boolean isUriValid(String resURI) {
- if (null == resURI || resURI.length() < 2 || !resURI.startsWith("/")
- || resURI.contains("//") || resURI.contains("?")
+ if (null == resURI || resURI.length() < 2 || resURI.length() > 63
+ || !resURI.startsWith("/") || resURI.endsWith("/")
+ || resURI.contains("/..") || resURI.contains("//")
+ || resURI.contains("/./") || resURI.contains("?")
|| resURI.contains("#") || resURI.contains("%")) {
return false;
}
return true;
}
+ public static boolean isResourceTypeValid(String resType) {
+ if (null == resType || resType.isEmpty()) {
+ return false;
+ }
+
+ char[] ch = resType.toCharArray();
+ for (char c : ch) {
+ if (c != '.' && c != '-' && (c < 'a' || c > 'z')
+ && (c < '0' || c > '9')) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public static Map<String, String> getResourceInterfaces(
Class<? extends Resource> resourceClass) {
Map<String, String> ifTypes = null;
}
return ifTypes;
}
-
}
\ No newline at end of file