/** * Construct. * * @param id * the component id * @param model * the input value */ public UrlTextField(String id, IModel<String> model) { this(id, model, new UrlValidator()); }
int slash2Count = countToken("//", path); if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) int slashCount = countToken("/", path); int dot2Count = countToken("/..", path); if (dot2Count > 0)
/** * Constructs a <code>UrlValidator</code> with the given scheme and validation options (see * class description). * * @param schemes * Pass in one or more <code>URL</code> schemes to consider valid. Passing in a * <code>null</code> will default to "<code>http,https,ftp</code>" being used. If a * non-<code>null</code> scheme is specified, then all valid schemes must be * specified. Setting the <code>ALLOW_ALL_SCHEMES</code> option will ignore the * contents of <code>schemes</code>. * @param options * The options should be set using the public constants declared in this class. To * set multiple options you simply add them together. For example, * <code>ALLOW_2_SLASHES</code> + <code>NO_FRAGMENTS</code> enables both of those * options. * */ public UrlValidator(String[] schemes, int options) { this.options = options; if (isOn(ALLOW_ALL_SCHEMES)) { return; } if (schemes == null) { schemes = defaultSchemes; } allowedSchemes.addAll(Arrays.asList(schemes)); }
if (!isValidScheme(matchUrlPat.group(PARSE_URL_SCHEME))) if (!isValidAuthority(matchUrlPat.group(PARSE_URL_AUTHORITY))) if (!isValidPath(matchUrlPat.group(PARSE_URL_PATH))) if (!isValidQuery(matchUrlPat.group(PARSE_URL_QUERY))) if (!isValidFragment(matchUrlPat.group(PARSE_URL_FRAGMENT)))
/** * Returns <code>true</code> if the given fragment is <code>null</code> or fragments are * allowed. * * @param fragment * a fragment value to validate * @return <code>true</code> if the fragment is valid */ protected boolean isValidFragment(String fragment) { if (fragment == null) { return true; } return isOff(NO_FRAGMENTS); }
if (!isValidScheme(matchUrlPat.group(PARSE_URL_SCHEME))) if (!isValidAuthority(matchUrlPat.group(PARSE_URL_AUTHORITY))) if (!isValidPath(matchUrlPat.group(PARSE_URL_PATH))) if (!isValidQuery(matchUrlPat.group(PARSE_URL_QUERY))) if (!isValidFragment(matchUrlPat.group(PARSE_URL_FRAGMENT)))
/** * Returns <code>true</code> if the given fragment is <code>null</code> or fragments are * allowed. * * @param fragment * a fragment value to validate * @return <code>true</code> if the fragment is valid */ protected boolean isValidFragment(String fragment) { if (fragment == null) { return true; } return isOff(NO_FRAGMENTS); }
if (!isBlankOrNull(extra))
/** * Construct. * * @param id * the component id * @param model * the input value */ public UrlTextField(String id, IModel<String> model) { this(id, model, new UrlValidator()); }
if (!isValidScheme(matchUrlPat.group(PARSE_URL_SCHEME))) if (!isValidAuthority(matchUrlPat.group(PARSE_URL_AUTHORITY))) if (!isValidPath(matchUrlPat.group(PARSE_URL_PATH))) if (!isValidQuery(matchUrlPat.group(PARSE_URL_QUERY))) if (!isValidFragment(matchUrlPat.group(PARSE_URL_FRAGMENT)))
int slash2Count = countToken("//", path); if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) int slashCount = countToken("/", path); int dot2Count = countToken("/..", path); if (dot2Count > 0)
/** * Returns <code>true</code> if the given fragment is <code>null</code> or fragments are * allowed. * * @param fragment * a fragment value to validate * @return <code>true</code> if the fragment is valid */ protected boolean isValidFragment(String fragment) { if (fragment == null) { return true; } return isOff(NO_FRAGMENTS); }
/** * Constructs a <code>UrlValidator</code> with the given scheme and validation options (see * class description). * * @param schemes * Pass in one or more <code>URL</code> schemes to consider valid. Passing in a * <code>null</code> will default to "<code>http,https,ftp</code>" being used. If a * non-<code>null</code> scheme is specified, then all valid schemes must be * specified. Setting the <code>ALLOW_ALL_SCHEMES</code> option will ignore the * contents of <code>schemes</code>. * @param options * The options should be set using the public constants declared in this class. To * set multiple options you simply add them together. For example, * <code>ALLOW_2_SLASHES</code> + <code>NO_FRAGMENTS</code> enables both of those * options. * */ public UrlValidator(String[] schemes, int options) { this.options = options; if (isOn(ALLOW_ALL_SCHEMES)) { return; } if (schemes == null) { schemes = defaultSchemes; } allowedSchemes.addAll(Arrays.asList(schemes)); }
if (!isBlankOrNull(extra))
/** * If <code>allowRemoveUrl</code> is true this validator allows the file to be either local (no * URI scheme, or file URI scheme) or a remote * * @param allowRemoteUrl */ public FileExistsValidator(boolean allowRemoteUrl) { if (allowRemoteUrl) { this.delegate = new UrlValidator(); } }