本文整理汇总了Java中org.thymeleaf.TemplateProcessingParameters类的典型用法代码示例。如果您正苦于以下问题:Java TemplateProcessingParameters类的具体用法?Java TemplateProcessingParameters怎么用?Java TemplateProcessingParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TemplateProcessingParameters类属于org.thymeleaf包,在下文中一共展示了TemplateProcessingParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveTemplate
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public TemplateResolution resolveTemplate(TemplateProcessingParameters templateProcessingParameters) {
String unresolvedTemplateName = templateProcessingParameters.getTemplateName();
ResourceResolver supportingResolver = resolver.getSupportingResolver(unresolvedTemplateName);
ITemplateResolver templateResolver;
try {
templateResolver = resolverAdapter.adapt(supportingResolver);
if (forceInitialize) {
// we must initialize the new templateResolver
templateResolver.initialize();
}
String resolvedPath = supportingResolver.getResourcePath(unresolvedTemplateName).getResolvedPath();
TemplateProcessingParameters resolvedTemplateProcessingParameters = new TemplateProcessingParameters(templateProcessingParameters.getConfiguration(), resolvedPath,
templateProcessingParameters.getContext());
return templateResolver.resolveTemplate(resolvedTemplateProcessingParameters);
} catch (NoResolverAdapterException e) {
throw new ResolverAdapterNotFoundException("Unable to resolver template cause no adapter supporting template name '" + unresolvedTemplateName + "' was found. ", e);
}
}
示例2: resolveTemplate
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public TemplateResolution resolveTemplate(final TemplateProcessingParameters tpp) {
String templateName = "CustomTemplate";
String resourceName = "CustomResource";
IResourceResolver resourceResolver = new FixedMemoryResourceResolver(templateContent);
ITemplateResolutionValidity validity = new NonCacheableTemplateResolutionValidity();
return new TemplateResolution(templateName, resourceName, resourceResolver, StandardCharsets.UTF_8.toString(),
templateMode, validity);
}
示例3: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* Expected a resource location accepted by Spring's ResourceLoader.
*
* @see org.springframework.core.io.ResourceLoader
*/
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters, String resourceName) {
Validate.notNull(resourceName, "Resource name cannot be null");
try {
return rl.getResource(resourceName).getInputStream();
} catch (Exception e) {
// resource not found results in returning null, see interface documentation
}
return null;
}
示例4: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters, String resourceName) {
Template template = templateDao.findByName(resourceName);
if(template != null){
return new ByteArrayInputStream(template.getBody().getBytes());
}
return null;
}
示例5: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters,
String resourceName) {
String str = Utils.readFileToString(vertx, resourceName);
try {
ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes("UTF-8"));
return new BufferedInputStream(bis);
} catch (UnsupportedEncodingException e) {
throw new VertxException(e);
}
}
示例6: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters, String resourceName) {
Template template = templateRepo.findOne(Long.valueOf(resourceName));
if (template != null) {
return new ByteArrayInputStream(template.getContent().getBytes());
}
return null;
}
示例7: computeResourceName
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
protected String computeResourceName(final TemplateProcessingParameters templateProcessingParameters) {
String themePath = null;
Theme theme = BroadleafRequestContext.getBroadleafRequestContext().getTheme();
if (theme != null && theme.getPath() != null) {
themePath = theme.getPath();
}
checkInitialized();
final String templateName = templateProcessingParameters.getTemplateName();
Validate.notNull(templateName, "Template name cannot be null");
String unaliasedName = this.getTemplateAliases().get(templateName);
if (unaliasedName == null) {
unaliasedName = templateName;
}
final StringBuilder resourceName = new StringBuilder();
String prefix = this.getPrefix();
if (prefix != null && ! prefix.trim().equals("")) {
if (themePath != null) {
resourceName.append(prefix).append(themePath).append('/').append(templateFolder);
}
}
resourceName.append(unaliasedName);
String suffix = this.getSuffix();
if (suffix != null && ! suffix.trim().equals("")) {
resourceName.append(suffix);
}
return resourceName.toString();
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:37,代码来源:BroadleafThymeleafServletContextTemplateResolver.java
示例8: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters params, String resourceName) {
ExtensionResultHolder erh = new ExtensionResultHolder();
ExtensionResultStatusType result = extensionManager.getProxy().resolveResource(erh, params, resourceName);
if (result == ExtensionResultStatusType.HANDLED) {
return (InputStream) erh.getContextMap().get(DatabaseResourceResolverExtensionHandler.IS_KEY);
}
return null;
}
示例9: computeResourceName
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
protected String computeResourceName(final TemplateProcessingParameters templateProcessingParameters) {
String themePath = null;
Theme theme = SparkRequestContext.getSparkRequestContext().getTheme();
if (theme != null && theme.getPath() != null) {
themePath = theme.getPath();
}
checkInitialized();
final String templateName = templateProcessingParameters.getTemplateName();
Validate.notNull(templateName, "Template name cannot be null");
String unaliasedName = this.getTemplateAliases().get(templateName);
if (unaliasedName == null) {
unaliasedName = templateName;
}
final StringBuilder resourceName = new StringBuilder();
String prefix = this.getPrefix();
if (prefix != null && ! prefix.trim().equals("")) {
if (themePath != null) {
resourceName.append(prefix).append(themePath).append('/').append(templateFolder);
}
}
resourceName.append(unaliasedName);
String suffix = this.getSuffix();
if (suffix != null && ! suffix.trim().equals("")) {
resourceName.append(suffix);
}
return resourceName.toString();
}
示例10: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(
TemplateProcessingParameters templateProcessingParameters,
String resourceName) {
try {
File file = new File(srcMainResourceFolder, resourceName);
if (!file.exists())
return null;
LOGGER.info("Reading: " + file.toURI());
return new FileInputStream(file);
} catch (FileNotFoundException e) {
return null;
}
}
示例11: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters theTemplateProcessingParameters, String theName) {
String template = myNameToNarrativeTemplate.get(theName);
if (template == null) {
ourLog.info("No narative template for resource profile: {}", theName);
return new ReaderInputStream(new StringReader(""));
}
return new ReaderInputStream(new StringReader(template));
}
示例12: resolveTemplate
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public TemplateResolution resolveTemplate(TemplateProcessingParameters theTemplateProcessingParameters) {
String templateName = theTemplateProcessingParameters.getTemplateName();
ourLog.info("Resolving template: {}", templateName);
return null;
}
示例13: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters,String resourceName) {
try {
return resourceLoader.getResource(resourceName).getInputStream();
} catch (IOException e) {
return null;
}
}
示例14: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream( TemplateProcessingParameters processingParams, String resourceName )
{
Validate.notNull( resourceName, "Resource name cannot be null" );
String templateContent = templates.get( resourceName );
if( templateContent == null )
{
return null;
}
return new ByteArrayInputStream( templateContent.getBytes( UTF_8 ) );
}
示例15: getResourceAsStream
import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public InputStream getResourceAsStream(TemplateProcessingParameters templateProcessingParameters, String resourceName) {
try {
return loader.openResource(resourceName);
} catch (IOException e) {
log.debug(
"[THYMELEAF][{}][{}] Resource \"{}\" 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: {}: {}",
TemplateEngine.threadIndex(), templateProcessingParameters.getTemplateName(),
resourceName, e.getClass().getName(), e.getMessage());
return null;
}
}