|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManagerAllow for wiring global macro Freemarker library's within FreemarkerManager
--------------------------------------------------------------------------- Key: WW-3079 URL: https://issues.apache.org/struts/browse/WW-3079 Project: Struts 2 Issue Type: Improvement Components: Integration Affects Versions: 2.1.8 Reporter: Matthew Payne Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. Such a setting is currently not available in the current FreemarkerManager example of setting this up in another project(not struts based). reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml ---> notice macro lib property <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> <description> FreeMarker configuration. </description> <property name="defaultEncoding" value="UTF-8" /> <property name="templateLoaderPaths"> <list> <value>/WEB-INF/view</value> </list> </property> <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> <property name="macroLibraries"> <props> <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> </props> </property> <property name="whitespaceStripping" value="true" /> </bean> http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm protected void importMacroLibraries(Configuration config) { 192: if (macroLibraries != null) { 193: Enumeration names = macroLibraries.propertyNames(); 194: while (names.hasMoreElements()) { 195: String namespace = (String) names.nextElement(); 196: String lib = macroLibraries.getProperty(namespace); 197: log 198: .info(lib + " imported under namespace " 199: + namespace); 200: config.addAutoImport(namespace, lib); 201: } 202: } 203: } /** 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. 075: */ 076: public void setMacroLibraries(Properties macroLibraries) { 077: this .macroLibraries = macroLibraries; 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Wes Wannemacher updated WW-3079: -------------------------------- Fix Version/s: 2.1.8 I'm setting fix version to 2.1.8 b/c I don't think this can be done by 2.1.7. Matthew, a patch would move this along quite a bit quicker. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46456#action_46456 ] zhouyanming commented on WW-3079: --------------------------------- package test; import javax.servlet.ServletContext; import freemarker.template.TemplateException; public class MyFreemarkerManager extends org.apache.struts2.views.freemarker.FreemarkerManager { protected freemarker.template.Configuration createConfiguration( ServletContext servletContext) throws TemplateException { freemarker.template.Configuration configuration = super .createConfiguration(servletContext); // add auto import and include return configuration; } } <bean type="org.apache.struts2.views.freemarker.FreemarkerManagery" class="test.MyFreemarkerManager" /> > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Issue Comment Edited: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46456#action_46456 ] zhouyanming edited comment on WW-3079 at 7/2/09 4:10 AM: --------------------------------------------------------- package test; import javax.servlet.ServletContext; import freemarker.template.TemplateException; public class MyFreemarkerManager extends org.apache.struts2.views.freemarker.FreemarkerManager { protected freemarker.template.Configuration createConfiguration( ServletContext servletContext) throws TemplateException { freemarker.template.Configuration configuration = super .createConfiguration(servletContext); // add auto import and include return configuration; } } <bean type="org.apache.struts2.views.freemarker.FreemarkerManager" class="test.MyFreemarkerManager" /> was (Author: quaff): package test; import javax.servlet.ServletContext; import freemarker.template.TemplateException; public class MyFreemarkerManager extends org.apache.struts2.views.freemarker.FreemarkerManager { protected freemarker.template.Configuration createConfiguration( ServletContext servletContext) throws TemplateException { freemarker.template.Configuration configuration = super .createConfiguration(servletContext); // add auto import and include return configuration; } } <bean type="org.apache.struts2.views.freemarker.FreemarkerManagery" class="test.MyFreemarkerManager" /> > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46457#action_46457 ] Matthew Payne commented on WW-3079: ----------------------------------- to Wes: I gave you the code. How hard is that? While you are at it please add the option for AutoIncludes as well as macros. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matthew Payne updated WW-3079: ------------------------------ Attachment: PMLFreeMarkerConfigurationFactoryBean.java relavant code. @Override public void afterPropertiesSet() throws IOException, TemplateException { this.configuration = createConfiguration(); configuration.setTemplateUpdateDelay(5); configuration.setURLEscapingCharset(urlEscapingCharset); if (useComputerNumberFormat) { configuration.setNumberFormat("#0.#"); } configuration.setEncoding(Locale.US, urlEscapingCharset); importMacroLibraries(configuration); configuration.setTemplateExceptionHandler(exceptionHandler); } protected void importAutoIncludes(Configuration config) { if (autoIncludedTemplates != null) { for (String templateName : autoIncludedTemplates) { config.addAutoInclude(templateName); } } } protected void importMacroLibraries(Configuration config) { if (macroLibraries != null) { Enumeration<?> names = macroLibraries.propertyNames(); while (names.hasMoreElements()) { String namespace = (String) names.nextElement(); String lib = macroLibraries.getProperty(namespace); config.addAutoImport(namespace, lib); } } } > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46459#action_46459 ] Matthew Payne commented on WW-3079: ----------------------------------- example of wiring with both autoIncludes and macroLibs <bean id="freemarkerConfiguration" class="com.pennmutual.common.freemarker.PMLFreeMarkerConfigurationFactoryBean"> <description>Using the Config directly so we can use it outside the web tier</description> <property name="templateLoaderPaths"> <list> <value>/WEB-INF/freemarker</value> <!-- <value>classpath:com/pennmutual/common/gsitemap</value>--> <value>/</value> </list> </property> <property name="macroLibraries"> <props> <prop key="l">/WEB-INF/macros/layout.ftl</prop> </props> </property> <property name="autoIncludedTemplates"> <list> <value>/WEB-INF/macros/globals.ftl</value> </list> </property> <property name="freemarkerSettings"> <props> <prop key="datetime_format">MM/dd/yyyy</prop> <prop key="number_format">#</prop> <prop key="whitespace_stripping">true</prop> <prop key="template_update_delay">10</prop> </props> </property> </bean> > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46461#action_46461 ] Dave Newton commented on WW-3079: --------------------------------- I think Matthew means "Here's the code--hope it helps! If you have a chance, adding options for AutoIncludes and macros would be great! TIA." > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46462#action_46462 ] Musachy Barroso commented on WW-3079: ------------------------------------- your code depends on spring btw. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: 2.1.8 > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso updated WW-3079: -------------------------------- Affects Version/s: (was: 2.1.8) Future moving to future..I am not sure where to place this. Depending on Spring is a no-go for core, it could be added to the spring plugin, but a freemarker class in a spring plugin smells. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: Future > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Resolved: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso resolved WW-3079. --------------------------------- Resolution: Won't Fix cant be fixed as proposed. a new manager can be plugged in to support this tho. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: Future > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46626#action_46626 ] Matthew Payne commented on WW-3079: ----------------------------------- You are missing out on a lot of flexibility and taking away freemarker functionality from default end users. Yeah, one could wire in an alternate freemarker manager, but that still leaves the default one very much lacking. Why not fix they current one in a way that does not require spring? > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: Future > Reporter: Matthew Payne > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Reopened: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso reopened WW-3079: --------------------------------- Assignee: Musachy Barroso I will give it some thought. The simple properties (just key/value) can be set as constants, no problem. The other ones are the problem, although, we could could pass an OGNL expression(a map) as a constant value and use OGNL to parse it into a map, that just hit me. > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: Future > Reporter: Matthew Payne > Assignee: Musachy Barroso > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Resolved: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager[ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Musachy Barroso resolved WW-3079. --------------------------------- Resolution: Not A Problem in fact this is implemented already, if you add a file with the name "freemarker.properties" to the classpath, the configuration will be built with it. In this properties file you can use the keys "auto_import" and "auto_include". See here: http://freemarker.svn.sourceforge.net/viewvc/freemarker/trunk/freemarker/src/freemarker/template/Configuration.java?revision=868&view=markup > Allow for wiring global macro Freemarker library's within FreemarkerManager > --------------------------------------------------------------------------- > > Key: WW-3079 > URL: https://issues.apache.org/struts/browse/WW-3079 > Project: Struts 2 > Issue Type: Improvement > Components: Integration > Affects Versions: Future > Reporter: Matthew Payne > Assignee: Musachy Barroso > Fix For: 2.1.8 > > Attachments: PMLFreeMarkerConfigurationFactoryBean.java > > > Something similar can can be setup via for velocity Macro's . We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. > Such a setting is currently not available in the current FreemarkerManager > example of setting this up in another project(not struts based). > reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml > ---> notice macro lib property > <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer"> > <description> > FreeMarker configuration. > </description> > <property name="defaultEncoding" value="UTF-8" /> > <property name="templateLoaderPaths"> > <list> > <value>/WEB-INF/view</value> > </list> > </property> > <property name="freemarkerSettings" value="${website-servlet.freemarker.*}" /> > <property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" /> > <property name="macroLibraries"> > <props> > <prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop> > <prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop> > <prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop> > <prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop> > </props> > </property> > <property name="whitespaceStripping" value="true" /> > </bean> > http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm > protected void importMacroLibraries(Configuration config) { > 192: if (macroLibraries != null) { > 193: Enumeration names = macroLibraries.propertyNames(); > 194: while (names.hasMoreElements()) { > 195: String namespace = (String) names.nextElement(); > 196: String lib = macroLibraries.getProperty(namespace); > 197: log > 198: .info(lib + " imported under namespace " > 199: + namespace); > 200: config.addAutoImport(namespace, lib); > 201: } > 202: } > 203: } > /** > 074: * Sets the macro libraries to be auto-imported, keyed by their namespace. > 075: */ > 076: public void setMacroLibraries(Properties macroLibraries) { > 077: this .macroLibraries = macroLibraries; > 078: } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
| Free embeddable forum powered by Nabble | Forum Help |