当前位置: 首页>>代码示例>>Java>>正文


Java TemplateProcessingParameters类代码示例

本文整理汇总了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);

	}

}
 
开发者ID:groupe-sii,项目名称:ogham,代码行数:22,代码来源:ThymeLeafFirstSupportingTemplateResolver.java

示例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);
}
 
开发者ID:PestaKit,项目名称:microservice-email,代码行数:10,代码来源:StaticTemplateService.java

示例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;
}
 
开发者ID:openwms,项目名称:webworms,代码行数:18,代码来源:NestedClasspathResourceResolver.java

示例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;
}
 
开发者ID:mattpwest,项目名称:entelect-spring-webapp-template,代码行数:9,代码来源:DbTemplateResolver.java

示例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);
	}
}
 
开发者ID:quebic-source,项目名称:puppy-io,代码行数:12,代码来源:CustomThymeleafTemplateEngineImpl.java

示例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;
}
 
开发者ID:tkaczmarzyk,项目名称:th-db-view,代码行数:11,代码来源:DbTemplateResolver.java

示例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;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:10,代码来源:DatabaseResourceResolver.java

示例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();
}
 
开发者ID:akdasari,项目名称:SparkCommerce,代码行数:37,代码来源:SparkThymeleafServletContextTemplateResolver.java

示例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;
	}
}
 
开发者ID:javabuild,项目名称:builder-parent,代码行数:15,代码来源:ThymeleafPagesGenerator.java

示例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));
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:10,代码来源:BaseThymeleafNarrativeGenerator.java

示例12: resolveTemplate

import org.thymeleaf.TemplateProcessingParameters; //导入依赖的package包/类
@Override
public TemplateResolution resolveTemplate(TemplateProcessingParameters theTemplateProcessingParameters) {

	String templateName = theTemplateProcessingParameters.getTemplateName();
	ourLog.info("Resolving template: {}", templateName);

	return null;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:9,代码来源:ThymeleafResolver.java

示例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;
	}
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:9,代码来源:ResourceBasedTemplateResolver.java

示例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 ) );
}
 
开发者ID:werval,项目名称:werval,代码行数:12,代码来源:StringResourceResolver.java

示例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;
   }
}
 
开发者ID:shopping24,项目名称:solr-thymeleaf,代码行数:15,代码来源:SolrResourceResolver.java


注:本文中的org.thymeleaf.TemplateProcessingParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。