Hi Dustin, I've fixed the NPE in SVN trunk. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com
-----Message d'origine----- De : Dustin N. Jenkins [mailto:[email protected]] Envoyé : jeudi 16 avril 2009 22:26 À : [email protected] Objet : Re: FreeMarker Template Loading Jerome, Thanks, this works as expected with one exception. The getLastModified(Object templateSource) returns a NullPointerException all the time for me as the getModificationDate() from the Representation (templateSource) is always null. I overrode the class and that method and it works as expected. Should I make a ticket for this too or is this e-mail sufficient? Thanks, Dustin Jerome Louvel wrote: > Hi Dustin, > > Thanks for reporting this issue. > > I have just added a ContextTemplateLoader class to FreeMarker > extension that will allow you to achieve the same result as the > Configuration#setServletContextForTemplateLoading() method. > > It is checked in SVN trunk and will be available in the next snapshot. > Please test and let me know if it works as expected. > > Best regards, > Jerome Louvel > -- > Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios > Technologies ~ Co-founder ~ http://www.noelios.com > > > -----Message d'origine----- > De : Dustin N. Jenkins [mailto:[email protected]] > Envoyé : jeudi 9 avril 2009 23:10 > À : [email protected] > Objet : FreeMarker Template Loading > > Hello all, > > I'm running JDK 1.6 with Restlet 1.2 and the included FreeMarker all > being served from a Tomcat 6 container. My FreeMarker templates are > in the web content root under the directory freemarker-templates. > > I used to cast the context to a ServletContextAdapter before 1.2, and > was able to tell my FreeMarker Configuration to obtain my Templates > from the ServletContext, but that's not true anymore. Is there a way > to get the ServletContext now? > > I am able to use this: > getContext().getClientDispatcher().get("war:///freemarker-templates/" > + templateName).getEntity(); > > and wrap it in a TemplateRepresentation, but my <#include > "myHeader.ftl"> files within my templates no longer work as they're relative URLs. > > So which way is better? Is there a better third option? > > Thank you! > Dustin > -- Dustin N. Jenkins | Tel/Tél: 250.363.3101 | [email protected] facsimile/télécopieur: (250) 363-0045 National Research Council Canada | 5071 West Saanich Rd, Victoria BC. V9E 2E7 Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria (C.-B) V9E 2E7 Government of Canada | Gouvernement du Canada ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=17542 77 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1768388

