Package org.thymeleaf.resourceresolver

Examples of org.thymeleaf.resourceresolver.IResourceResolver


    @Override
    public void setVertx(Vertx vertx) {
        final FileSystem fs = vertx.fileSystem();

        templateResolver.setResourceResolver(new IResourceResolver() {

            @Override
            public String getName() {
                return "Yoke/Thymeleaf";
            }
View Full Code Here


        Validate.notNull(baseName, "Base name cannot be null");
        Validate.notNull(locale, "Locale cannot be null");
       
        final List<String> messageResourceNames = getMessageFileNamesFromBase(baseName, locale);

        final IResourceResolver usedResourceResolver =
            (resourceResolver != null? resourceResolver : new ClassLoaderResourceResolver());
       
        final List<Properties> messages = new ArrayList<Properties>(10);
        for (final String messageResourceName : messageResourceNames) {
            final InputStream messageFileInputStream =
                usedResourceResolver.getResourceAsStream((arguments == null? null : arguments.getTemplateProcessingParameters()), messageResourceName);
            if (messageFileInputStream != null) {
                messages.add(loadMessages(messageFileInputStream));
                if (logger.isDebugEnabled()) {
                    logger.debug("[THYMELEAF][{}] Loading messages for locale \"{}\" from processed file: {}", new Object[] {TemplateEngine.threadIndex(), locale, messageResourceName});
                }
View Full Code Here

        Validate.notNull(arguments, "Arguments cannot be null");
        Validate.notNull(arguments.getContext().getLocale(), "Locale in context cannot be null");
       
        final String resourceName = arguments.getTemplateResolution().getResourceName();
        final IResourceResolver resourceResolver = arguments.getTemplateResolution().getResourceResolver();
        final Locale locale = arguments.getContext().getLocale();
       
        final String templateBaseName = getTemplateFileNameBase(resourceName);
       
        return MessageResolutionUtils.loadCombinedMessagesFilesFromBaseName(
View Full Code Here

               
                if (templateResolution != null) {
                   
                    final String resourceName = templateResolution.getResourceName();

                    final IResourceResolver resourceResolver = templateResolution.getResourceResolver();
                   
                    if (logger.isTraceEnabled()) {
                        logger.trace("[THYMELEAF][{}] Trying to resolve template \"{}\" as resource \"{}\" with resource resolver \"{}\"", new Object[] {TemplateEngine.threadIndex(), templateName, resourceName, resourceResolver.getName()});
                    }
                   
                    templateInputStream =
                        resourceResolver.getResourceAsStream(templateProcessingParameters, resourceName);
                   
                    if (templateInputStream == null) {
                        if (logger.isTraceEnabled()) {
                            logger.trace("[THYMELEAF][{}] Template \"{}\" could not be resolved as resource \"{}\" with resource resolver \"{}\"", new Object[] {TemplateEngine.threadIndex(), templateName, resourceName, resourceResolver.getName()});
                        }
                    } else {
                        if (logger.isDebugEnabled()) {
                            logger.debug("[THYMELEAF][{}] Template \"{}\" was correctly resolved as resource \"{}\" in mode {} with resource resolver \"{}\"", new Object[] {TemplateEngine.threadIndex(), templateName, resourceName, templateResolution.getTemplateMode(), resourceResolver.getName()});
                        }
                        break;
                    }
                   
                } else {
View Full Code Here

   
    @Override
    public TemplateResolution resolveTemplate(final TemplateProcessingParameters tpp) {
        String templateName = "CustomTemplate";
        String resourceName = "CustomResource";
        IResourceResolver resourceResolver = new FixedMemoryResourceResolver(templateContent);
        String characterEncoding = "utf-8";
        ITemplateResolutionValidity validity = new NonCacheableTemplateResolutionValidity();
        return new TemplateResolution(templateName, resourceName, resourceResolver, characterEncoding, templateMode, validity);
    }
View Full Code Here

  @SuppressWarnings("UnusedDeclaration")
  @Provides
  @Singleton
  ITemplateResolver provideTemplateResolver(LaunchConfig launchConfig) {
    IResourceResolver resourceResolver = new FileSystemBindingThymeleafResourceResolver(launchConfig.getBaseDir());
    TemplateResolver templateResolver = new TemplateResolver();
    templateResolver.setResourceResolver(resourceResolver);


    String mode = templatesMode == null ? launchConfig.getOther("thymeleaf.templatesMode", DEFAULT_TEMPLATE_MODE) : templatesMode;
View Full Code Here

TOP

Related Classes of org.thymeleaf.resourceresolver.IResourceResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.