org.thymeleaf.util.Validate Java Examples
The following examples show how to use
org.thymeleaf.util.Validate.
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: TdsExtensibleTemplateResolver.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected String computeResourceName(final IEngineConfiguration configuration, final String ownerTemplate, final String template, final String prefix, final String suffix, final Map<String, String> templateAliases, final Map<String, Object> templateResolutionAttributes) { Validate.notNull(template, "Template name cannot be null"); // Don't bother computing resource name if template is not extensible if (!template.startsWith(EXT_FRAG_PREFIX)) return template; String resourceName = template.substring(PREFIX_LENGTH); if (!StringUtils.isEmptyOrWhitespace(prefix)) resourceName = prefix + resourceName; if (!StringUtils.isEmptyOrWhitespace(suffix)) resourceName = resourceName + suffix; TdsContext tdsContext = (TdsContext) applicationContext.getBean("TdsContext"); resourceName = tdsContext.getThreddsDirectory() + resourceName; return resourceName; }
Example #2
Source File: FhirServerConfigCommon.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 6 votes |
@Bean() public IEmailSender emailSender() { if (this.emailEnabled) { JavaMailEmailSender retVal = new JavaMailEmailSender(); retVal.setSmtpServerHostname(this.emailHost); retVal.setSmtpServerPort(this.emailPort); retVal.setSmtpServerUsername(this.emailUsername); retVal.setSmtpServerPassword(this.emailPassword); // TODO KHS add these when HAPI 4.2.0 is released // retVal.setAuth(this.emailAuth); // retVal.setStartTlsEnable(this.emailStartTlsEnable); // retVal.setStartTlsRequired(this.emailStartTlsRequired); // retVal.setQuitWait(this.emailQuitWait); SubscriptionDeliveryHandlerFactory subscriptionDeliveryHandlerFactory = myAppCtx.getBean(SubscriptionDeliveryHandlerFactory.class); Validate.notNull(subscriptionDeliveryHandlerFactory, "No subscription delivery handler"); subscriptionDeliveryHandlerFactory.setEmailSender(retVal); return retVal; } return null; }
Example #3
Source File: WallRideResourceTemplateResource.java From wallride with Apache License 2.0 | 5 votes |
public WallRideResourceTemplateResource(final ApplicationContext applicationContext, final String location, final String characterEncoding) { super(); Validate.notNull(applicationContext, "Application Context cannot be null"); Validate.notEmpty(location, "Resource Location cannot be null or empty"); // Character encoding CAN be null (system default will be used) this.resource = applicationContext.getResource(location); this.characterEncoding = characterEncoding; }
Example #4
Source File: WallRideResourceTemplateResource.java From wallride with Apache License 2.0 | 5 votes |
public WallRideResourceTemplateResource(final Resource resource, final String characterEncoding) { super(); Validate.notNull(resource, "Resource cannot be null"); // Character encoding CAN be null (system default will be used) this.resource = resource; this.characterEncoding = characterEncoding; }
Example #5
Source File: MyFileResourceResolver.java From wisdom with Apache License 2.0 | 5 votes |
public InputStream getResourceAsStream(final TemplateProcessingParameters templateProcessingParameters, String resourceName) { Validate.notNull(resourceName, "Resource name cannot be null"); System.out.println(resourceName); if (resourceName.startsWith("file:")) { resourceName = resourceName.substring(5); } final File resourceFile = new File(resourceName); try { return new FileInputStream(resourceFile); } catch (final Exception e) { if (logger.isDebugEnabled()) { if (logger.isTraceEnabled()) { logger.trace( String.format( "[THYMELEAF][%s][%s] Resource \"%s\" could not be resolved. This can be normal as " + "maybe this resource is not intended to be resolved by this resolver. " + "Exception is provided for tracing purposes: ", TemplateEngine.threadIndex(), templateProcessingParameters.getTemplateName(), resourceName), e); } else { logger.debug( String.format( "[THYMELEAF][%s][%s] Resource \"%s\" could not be resolved. This can be normal as " + "maybe this resource is not intended to be resolved by this resolver. " + "Exception message is provided: %s: %s", TemplateEngine.threadIndex(), templateProcessingParameters.getTemplateName(), resourceName, e.getClass().getName(), e.getMessage())); } } return null; } }