Of course, you must set up a Servlet for uri-patterns in WEB-INF/web.xml for this, otherwise the client will get the raw templates as is! To avoid a such accident, many prefers storing the templates somewhere inside the WEB-INF directory, which is never visitable directly. This is very likely be the preferred means of loading templates for production code, as it allows you to keep everything inside the deployment jar files. void setClassForTemplateLoading(Class cl, String basePackagePath) and void setClassLoaderForTemplateLoading(ClassLoader classLoader, String basePackagePath): These are for when you want to load templates via the same mechanism with which Java loads classes (from the class-path, as they used to say vaguely). It won't let you load files outside this directory. Template names (template paths) will be interpreted relatively to this physical directory. void setDirectoryForTemplateLoading(File dir): Sets a directory on the file system from which to load templates. Built-in template loaders You can set up the three most common template loading mechanism in the Configuration using the following convenience methods. It doesn't care or even know if the template is a real file or not, and where it is physically those details are only known by the template loader.
0 Comments
Leave a Reply. |