Sorry again, should have used preview. Ok, well this works.
Ok, the state of the union. I'm trying to set up Spring 3.0 RESTful style URLs. This requires me to eliminate the *.html url-pattern on the dispatcher and use /*. However, this has as a consequence that when the Freemarker Sitemesh Decorator that I'm using calls a decorator, say /WEB-INF/decorators/main.ftd, that Spring tries to find a handler for this resulting in a handler not found error. I've tried to use / as a dispatcher url-pattern. That makes the page process properly. I can load page.json, use RESTful URLs, all the cool stuff. Only it also prevents images, css ets from passing through. Resolvable with Apache, I guess, but not great in a debugging environment. Where I am now: web.xml <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>sitemesh-freemarker</servlet-name> <servlet-class> nl.project.webapp.utils.SpringFreemarkerDecoratorServlet</servlet-class> <init-param> <param-name>TemplatePath</param-name> <param-value>/WEB-INF/decorators/</param-value> </init-param> <init-param> <param-name>default_encoding</param-name> <param-value>ISO-8859-1</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>sitemesh-freemarker</servlet-name> <url-pattern>*.ftd</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> dispatcher-servlet.xml <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="configuration" ref="freemarkerConfiguration" /> </bean> <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> <map> <entry key="html" value="text/html"/> <entry key="ftl" value="text/html"/> <entry key="xml" value="application/xml"/> <entry key="json" value="application/json"/> </map> </property> <property name="favorPathExtension" value="true"/> <property name="defaultViews"> <list> <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"/> </list> </property> <property name="viewResolvers"> <list> <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="cache" value="true" /> <property name="order" value="1"/> <property name="prefix" value="/" /> <property name="suffix" value=".ftl" /> <property name="contentType" value="text/html;charset=UTF-8"/> <property name="exposeSpringMacroHelpers" value="true" /> <property name="requestContextAttribute" value="rc" /> <property name="exposeSessionAttributes" value="true" /> </bean> </list> </property> </bean> **Custom freemarker servlet to support using freemarker both in core and in web** public class SpringFreemarkerDecoratorServlet extends FreemarkerDecoratorServlet { @Override public void init() throws ServletException { super.init(); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); Configuration springConfiguration = (Configuration) ctx.getBean("freemarkerConfiguration"); TemplateLoader templateLoader = springConfiguration.getTemplateLoader(); getConfiguration().setTemplateLoader(templateLoader); } } Sorry again about posting all that crud. Cheers, Marc -- View this message in context: http://n4.nabble.com/REST-implementation-web-xml-configuration-tp1017692p1018032.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net