org.hibernate.validator.constraints.URL Java Examples

The following examples show how to use org.hibernate.validator.constraints.URL. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidationUtils.java    From para with Apache License 2.0 6 votes vote down vote up
private static boolean isValidSimpleConstraint(String cName, String field, Object actual, LinkedList<String> err) {
	if ("required".equals(cName) && !required().isValid(actual)) {
		err.add(Utils.formatMessage("{0} is required.", field));
		return false;
	} else if (matches(AssertFalse.class, cName) && !falsy().isValid(actual)) {
		err.add(Utils.formatMessage("{0} must be false.", field));
		return false;
	} else if (matches(AssertTrue.class, cName) && !truthy().isValid(actual)) {
		err.add(Utils.formatMessage("{0} must be true.", field));
		return false;
	} else if (matches(Future.class, cName) && !future().isValid(actual)) {
		err.add(Utils.formatMessage("{0} must be in the future.", field));
		return false;
	} else if (matches(Past.class, cName) && !past().isValid(actual)) {
		err.add(Utils.formatMessage("{0} must be in the past.", field));
		return false;
	} else if (matches(URL.class, cName) && !url().isValid(actual)) {
		err.add(Utils.formatMessage("{0} is not a valid URL.", field));
		return false;
	} else if (matches(Email.class, cName) && !email().isValid(actual)) {
		err.add(Utils.formatMessage("{0} is not a valid email.", field));
		return false;
	}
	return true;
}
 
Example #2
Source File: AllianceController.java    From retro-game with GNU Affero General Public License v3.0 5 votes vote down vote up
@PostMapping("/alliance/manage/logo/save")
@PreAuthorize("hasPermission(#bodyId, 'ACCESS')")
@Activity(bodies = "#bodyId")
public String manageLogoSave(@RequestParam(name = "body") long bodyId,
                             @RequestParam(name = "alliance") long allianceId,
                             @RequestParam @URL @Size(max = 128) String url) {
  allianceService.saveLogo(bodyId, allianceId, url);
  return "redirect:/alliance/manage?body=" + bodyId + "&alliance=" + allianceId;
}
 
Example #3
Source File: IHealthClientSettings.java    From shimmer with Apache License 2.0 5 votes vote down vote up
@URL
public String getApiBaseUrl() {

    return sandboxed
            ? "http://sandboxapi.ihealthlabs.com/OpenApiV2"
            : "https://api.ihealthlabs.com:8443/OpenApiV2";
}
 
Example #4
Source File: DefaultDirectoryWriter.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.apache.catalina.servlets.DefaultServlet
 */
@Override
public String toHtml(
    @NotNull final File directory,
    @URL final String requestURL,
    final boolean includeParent
) throws IOException {
    final Directory dir = this.getDirectory(directory, requestURL, includeParent);
    return directoryToHTML(directory.getName(), dir);
}
 
Example #5
Source File: DefaultDirectoryWriter.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String toJson(
    @NotNull final File directory,
    @URL final String requestURL,
    final boolean includeParent
) throws Exception {
    final Directory dir = this.getDirectory(directory, requestURL, includeParent);
    return GenieObjectMapper.getMapper().writeValueAsString(dir);
}
 
Example #6
Source File: AwsPropsApi.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@URL
String getEndpoint();
 
Example #7
Source File: AwsPropsApi.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@URL
String getStsEndpoint();
 
Example #8
Source File: Project.java    From celerio-angular-quickstart with Apache License 2.0 4 votes vote down vote up
@Size(max = 100)
@URL
@Column(name = "URL", length = 100)
public String getUrl() {
    return url;
}
 
Example #9
Source File: ParcelDescriptor.java    From cm_ext with Apache License 2.0 2 votes vote down vote up
/**
 * THe user can add a parcel repo URL. If one is specified,
 * it will be added to the remote repository urls so that the
 * associated parcel can show up in CM.
 */
@URL
String getRepoUrl();
 
Example #10
Source File: DirectoryWriter.java    From genie with Apache License 2.0 2 votes vote down vote up
/**
 * Convert a given directory to an String containing a full valid HTML page.
 *
 * @param directory     The directory to convert. Not null. Is directory.
 * @param requestURL    The URL of the request that kicked off this process
 * @param includeParent Whether the conversion should include reference to the parent directory.
 * @return String HTML representation of the directory
 * @throws Exception for any conversion problem
 */
String toHtml(
    @NotNull File directory,
    @URL String requestURL,
    boolean includeParent
) throws Exception;
 
Example #11
Source File: DirectoryWriter.java    From genie with Apache License 2.0 2 votes vote down vote up
/**
 * Convert a given directory to an String of JSON.
 *
 * @param directory     The directory to convert. Not null. Is directory.
 * @param requestURL    The URL of the request that kicked off this process
 * @param includeParent Whether the conversion should include reference to the parent directory.
 * @return String HTML representation of the directory
 * @throws Exception for any conversion problem
 */
String toJson(
    @NotNull File directory,
    @URL String requestURL,
    boolean includeParent
) throws Exception;