@RequestMapping(value = "/cron", method = RequestMethod.POST)
	@ResponseBody
	public CronValidation validateCronExpression(@RequestBody CronValidation cronValidation) {

		final CronValidation cronValidationDtoToReturn = new CronValidation();
		cronValidationDtoToReturn.setCronExpression(cronValidation.getCronExpression());

		if (!StringUtils.hasText(cronValidation.getCronExpression())) {
			cronValidationDtoToReturn.setErrorMessage("The cron expression must not be empty.");
			return cronValidationDtoToReturn;
		}

		final CronTrigger cronTrigger;

		try {
			cronTrigger = new CronTrigger(cronValidation.getCronExpression(), TimeZone.getDefault());
			final Date nextExecutionTime = cronTrigger.nextExecutionTime(new SimpleTriggerContext());
			cronValidationDtoToReturn.setNextExecutionTime(nextExecutionTime);
		}
		catch (IllegalArgumentException e) {
			cronValidationDtoToReturn.setErrorMessage(e.getMessage());
			return cronValidationDtoToReturn;
		}
		cronValidationDtoToReturn.setValid(true);
		return cronValidationDtoToReturn;
	}
Provides server-validation services.

@author Gunnar Hillert
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/rest/validation/ValidationController.java