Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
The JBoss Tool's freemarker plugin is good, but i stil miss these features :
- ability to list the ftl-s that make use of a specific function / macro
- ability to refactor function / macro's name, parameter name
- detect function / macro usages error after changing the function / macro
definition
- can operate based on the configuration passed, like showing the imported
libraries in the template editor, or optionally show the settings
- can link current active template to another, and then it see what
variables are available (those assigned from the container template)
- link a model to a concrete class to help support with autocompletion on
methods, data type validations, etc
- etc
You aren't supposed to close the StringReader inside the
TemplateLoader.
Yeah, i returned a closed stringReader. What an omg-mistake !
Now i have changed it to close the 'wrapped' reader instead.
Thanks so much for the guides.
[snip]
I tried closing the reader and catching and logging the exception
instead of just using IOTools.closeQuietly(),
and notices that there's no exception happening, and still gave me the
empty page.
Commenting the close reader section gave me back the output.
Are you returning a StringReader before calling
IOTools.closeQuietly()on *another* reader? Because then this
phenomenon it doesn't make any sense.
[snip]
Aha, maybe that's the reason it gave me the empty output.
According to
http://docs.oracle.com/javase/7/docs/api/java/io/StringReader.html#close()
"Closes the stream and releases any system resources associated with it.
Once the stream has been closed, further read(), ready(), mark(),
or reset() invocations will throw an IOException. Closing a
previously closed stream has no effect."
Maybe the caller of the closed-reader got an IOException somewhere and
hence, the empty output ?
You aren't supposed to close the StringReader inside the
TemplateLoader. You should close the *other* reader, the one that you
don't return. Also, if FreeMarker gives empty output when an
IOException occurs, that's a bug. But I hope it doesn't do that, it's
rather the framework that calls it that suppresses that exception
instead of giving a HTTP 500.
[snip]
I actually have switched back to the normal FileTemplateLoader
- I actually make use of functions for URLs generation.
And it's ugly to see the noescape tags wrapping every link calls,
<#noescape>${url.home("Return to main page")}</#noescape>
I prefer using ?html as needed
It's a strange coincidence that you say this just after 2 weeks or so
after I have proposed #p. It addresses exactly this annoyance, but I
don't remember anybody but myself ever brought this up, till now.
Anyway, it will be in 2.3.20 most probably.
- Because i am using JBoss Tools for the freemarker editor (which
does help me in parsing error detection, highlighting, etc), it
errors the line of every noescape because it's not inside an escape
directive, which gives me the tension i dont need.
This will also be solved by #p, since then you won't need #noescpe
anymore. Indeed, I might as well deprecate #noescape then.
And thank you for the wrapReader sharing, i will add it to my
library in case i find a use of it in the future.
Regards from Jakarta,
Albert Kam
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
FreeMarker-user mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-user
--
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)

--14dae9340e5b82a55404d7d99e34
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir="ltr"><div style>Sorry almost forgot.</div><div style><br></div>I think the #p solution would be a good addition to the arsenal of freemarker, <div>if paired with the automatic escaping feature.</div><div><br></div>
<div style>Will be excited for 2.3.20 updates, but for now, </div><div style>i&#39;m content with manual escaping the expressions on user-generated-content.</div><div style><br></div><div style>(OOT) Wishful thinking :</div>
<div style>
Loading...