Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added inputStream method to ITemplateResource #722

Open
wants to merge 1 commit into
base: 3.0-master
Choose a base branch
from

Conversation

ebolwidt-atlassian
Copy link

The main reason for adding this is our usecase of using thymeleaf for e-mail templates.

To refer to images and other binary resources, I created an extension tag processor that reads the resource, adds it to a special container in a context, and outputs a "cid:unique-code" url to refer to the image. However I need to be able to load the resource as binary data, and ITemplateResource only has a reader method. I added an inputStream method to ITemplateResource and all its implementations in the thymeleaf and thymeleaf-spring repositories. I added a unit test so that this method has the same amount of testing as the reader method.

(Since the reader methods were all changes to use the inputStream method to avoid code duplication, the ability to load a resource at all also means that theinputStream() method worked, so it's implicitly tested in many more cases, just as the reader method is)

This pull request has accompanying pull requests in thymeleaf-tests and thymeleaf-spring repositories.

…nary resources (images, etc) from templates folder by extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant