Re: loading plain files
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
There's no way to do it, and I don't think it'd be FreeMarker's
responsibility to provide such capabilities.
Except there IS of course a way to do it, which would be to write a
custom TemplateLoader that wraps another loader, and makes sure that
it edits the text stream of the resource so that anything that
FreeMarker would recognize as its own markup (which would be "<#",
"<@", (or "[#", "[@") and "${") gets escaped.
OTOH, if you can be certain that the static files you have don't have
anything in them that FreeMarker would recognize as its own markup,
you can just put them in there -- FM will treat each of them as a
template with single chunk of static text and render them very
efficiently :-)
Attila.
On 2008.11.08., at 16:32, Luther Baker wrote:
> For simplicity's sake, I would like to use freemarker to load both
> *.ftl files and plain html/js/css files.
>
> IE: I am distributing a library (JAR) and include a few text files
> in the classpath (src/main/resources per maven). When a request
> comes into my framework, I modify the URL path and look for a *.ftl
> file. If I find it, great, if I don't - I would like to look up the
> RAW file and simply return it via freemarker unprocessed.
>
> a) Is that safe to do?
> b) Is there a way I can tell freemarker 'load these .css and .js
> files from the special FTL paths" but do not waste your time trying
> to interpolate them. Just render them as is?
>
> Thanks,
>
> -Luther
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/