Albert Kam
2013-03-12 07:20:18 UTC
I took a peek at FileTemplateLoader.java and notices that
the closeTemplateSource() is empty method.
Is it okay not to close the Reader returned from getReader() ?
I am asking this because i am trying to mimic the best practice when
creating a custom TemplateLoader.
In my case, when following the instruction to auto-escape in here :
http://watchitlater.com/blog/2011/10/default-html-escape-using-freemarker/ :
- I found out that closing the reader returns an empty page after the
process. Commenting the IOUtils.closeQuietly() solves the empty page
problem.
- So i thought maybe i should close the reader (maybe through a ThreadLocal
storing the reader) in the closeTemplateSource()
- So i peeked the FileTemplateLoader for an example, and thus this post to
clarify.
Please share your thoughts.
Thank you,
Albert Kam
the closeTemplateSource() is empty method.
Is it okay not to close the Reader returned from getReader() ?
I am asking this because i am trying to mimic the best practice when
creating a custom TemplateLoader.
In my case, when following the instruction to auto-escape in here :
http://watchitlater.com/blog/2011/10/default-html-escape-using-freemarker/ :
- I found out that closing the reader returns an empty page after the
process. Commenting the IOUtils.closeQuietly() solves the empty page
problem.
- So i thought maybe i should close the reader (maybe through a ThreadLocal
storing the reader) in the closeTemplateSource()
- So i peeked the FileTemplateLoader for an example, and thus this post to
clarify.
Please share your thoughts.
Thank you,
Albert Kam
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)