svn commit: r1815088 - in /velocity/site/production/engine: 2.0/build.html devel/build.html
Author: cbrisson Date: Mon Nov 13 11:49:13 2017 New Revision: 1815088 URL: http://svn.apache.org/viewvc?rev=1815088=rev Log: [site] Review build instructions - production Modified: velocity/site/production/engine/2.0/build.html velocity/site/production/engine/devel/build.html Modified: velocity/site/production/engine/2.0/build.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/build.html?rev=1815088=1815087=1815088=diff == --- velocity/site/production/engine/2.0/build.html (original) +++ velocity/site/production/engine/2.0/build.html Mon Nov 13 11:49:13 2017 @@ -230,13 +230,14 @@ h2:hover > .headerlink, h3:hover > .head Required Tools To build Velocity we require http://maven.apache.org/;>Maven version 3.0.5 or higher to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. Building -In each case below, it is assumed that you were successful in getting the distribution from Subversion, and were successful in unpacking. Also, it is assumed that you are starting in the 'velocity' directory, the root of the distribution tree. All directory references will be relative to 'velocity'. -Change to the build directory (cd build). Then, to build the jar file, simply type: -mvn install +In each case below, it is assumed that you were successful in downloading and unpacking the distribution source or checking out the sources from Subversion: +svn checkout https://svn.apache.org/repos/asf/velocity/engine/tags/2.0 velocity-2.0 +cd velocity-2.0 +mvn install -Executing this script will create a target directory within the Velocity distribution directory. Each subdirectory containing a module of Velocity will contain a "target" directory too, containing all built jars. In the "velocity-assembly" module you will find built distributions. +Executing this script will create a target directory within the velocity-2.0 directory. Each subdirectory containing a module of Velocity will contain a "target" directory too, containing all built jars. Refer to Maven documentation for all phases you can invoke. If you find a problem, do not hesitate to ask the Velocity community via our mail lists. Modified: velocity/site/production/engine/devel/build.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/build.html?rev=1815088=1815087=1815088=diff == --- velocity/site/production/engine/devel/build.html (original) +++ velocity/site/production/engine/devel/build.html Mon Nov 13 11:49:13 2017 @@ -229,14 +229,15 @@ h2:hover > .headerlink, h3:hover > .head http://maven.apache.org/;>Maven is also an Apache project. To build Apache Velocity, you need at least Version 3.0.5 of Apache Maven. Required Tools To build Velocity we require http://maven.apache.org/;>Maven version 3.0.5 or higher to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. -Building -In each case below, it is assumed that you were successful in getting the distribution from Subversion, and were successful in unpacking. Also, it is assumed that you are starting in the 'velocity' directory, the root of the distribution tree. All directory references will be relative to 'velocity'. -Change to the build directory (cd build). Then, to build the jar file, simply type: -mvn install +Building from Sources +In each case below, it is assumed that you were successful in checking out the sources from Subversion: +svn checkout https://svn.apache.org/repos/asf/velocity/engine/trunk velocity +cd velocity +mvn install -Executing this script will create a target directory within the Velocity distribution directory. Each subdirectory containing a module of Velocity will contain a "target" directory too, containing all built jars. In the "velocity-assembly" module you will find built distributions. +Executing this script will create a target directory within the velocity directory. Each subdirectory containing a module of Velocity will contain a "target" directory too, containing all built jars. Refer to Maven documentation for all phases you can invoke. If you find a problem, do not hesitate to ask the Velocity community via our mail lists.
svn commit: r1833880 - /velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java
Author: cbrisson Date: Wed Jun 20 00:40:59 2018 New Revision: 1833880 URL: http://svn.apache.org/viewvc?rev=1833880=rev Log: [tools] Fix BrowserTool Accept-Language header parsing Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java?rev=1833880=1833879=1833880=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Wed Jun 20 00:40:59 2018 @@ -117,7 +117,7 @@ public class BrowserTool extends Browser private List languagesFilter = null; private String preferredLanguage = null; -private static Pattern quality = Pattern.compile("^q\\s*=\\s*(\\d(?:0(?:.\\d{0,3})?|1(?:.0{0,3}))?)$"); +private static Pattern quality = Pattern.compile("^q\\s*=\\s*((?:0|1)(?:.\\d{0,3})?)$"); /** * Retrieves the User-Agent header from the request (if any). @@ -538,7 +538,7 @@ public class BrowserTool extends Browser // fallback if(preferredLanguage == null) { -preferredLanguage = filterLanguageTag(languagesFilter == null ? getLocale().getDisplayName() : languagesFilter.get(0)); +preferredLanguage = filterLanguageTag(languagesFilter == null ? getLocale().getLanguage() : languagesFilter.get(0)); } // preferredLanguage should now never be null assert(preferredLanguage != null);
svn commit: r1833881 - in /velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src: main/webapp/WEB-INF/tools.xml test/java/org/apache/velocity/examples/showcase/ViewToolsIT.
Author: cbrisson Date: Wed Jun 20 00:43:23 2018 New Revision: 1833881 URL: http://svn.apache.org/viewvc?rev=1833881=rev Log: [tools] Fix BrowserTool tests Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/tools.xml velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/test/java/org/apache/velocity/examples/showcase/ViewToolsIT.java Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/tools.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/tools.xml?rev=1833881=1833880=1833881=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/tools.xml (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/tools.xml Wed Jun 20 00:43:23 2018 @@ -30,7 +30,7 @@ - + Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/test/java/org/apache/velocity/examples/showcase/ViewToolsIT.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/test/java/org/apache/velocity/examples/showcase/ViewToolsIT.java?rev=1833881=1833880=1833881=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/test/java/org/apache/velocity/examples/showcase/ViewToolsIT.java (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/test/java/org/apache/velocity/examples/showcase/ViewToolsIT.java Wed Jun 20 00:43:23 2018 @@ -178,12 +178,17 @@ public class ViewToolsIT { checkText(resp,"httpunit","true"); /* check language */ +conv = new WebConversation(); +req = new GetMethodWebRequest(ROOT_URL+"browser.vm"); req.setHeaderField("Accept-Language","en"); resp = conv.getResponse(req); checkText(resp,"preferredLanguage","en"); -req.setHeaderField("Accept-Language","en-US,en;q=0.8"); + +conv = new WebConversation(); +req = new GetMethodWebRequest(ROOT_URL+"browser.vm"); + req.setHeaderField("Accept-Language","fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"); resp = conv.getResponse(req); -checkText(resp,"preferredLanguage","en"); +checkText(resp,"preferredLanguage","fr"); } public @Test void testContextTool() throws Exception {
svn commit: r1833882 - in /velocity/tools/trunk: ./ velocity-tools-generic/ velocity-tools-generic/src/main/java/org/apache/velocity/tools/ velocity-tools-generic/src/main/java/org/apache/velocity/too
Author: cbrisson Date: Wed Jun 20 00:47:45 2018 New Revision: 1833882 URL: http://svn.apache.org/viewvc?rev=1833882=rev Log: [tools] Review webapp config files access, increment dependencies versions, introduce some privileged actions Modified: velocity/tools/trunk/pom.xml velocity/tools/trunk/velocity-tools-generic/pom.xml velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java velocity/tools/trunk/velocity-tools-view/pom.xml velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/WebappResourceLoader.java velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java Modified: velocity/tools/trunk/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/pom.xml?rev=1833882=1833881=1833882=diff == --- velocity/tools/trunk/pom.xml (original) +++ velocity/tools/trunk/pom.xml Wed Jun 20 00:47:45 2018 @@ -46,9 +46,10 @@ UTF-8 4.12 - 1.7.23 - 2.19.1 - 3.0.1 + 1.7.25 + 2.22.0 + 3.1.0 + 2.0 @@ -119,7 +120,7 @@ org.apache.maven.plugins maven-javadoc-plugin -2.10.4 +3.0.1 true org.apache.velocity.tools.examples Modified: velocity/tools/trunk/velocity-tools-generic/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/pom.xml?rev=1833882=1833881=1833882=diff == --- velocity/tools/trunk/velocity-tools-generic/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-generic/pom.xml Wed Jun 20 00:47:45 2018 @@ -35,7 +35,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.4.3 + 3.1.1 shade @@ -70,7 +70,7 @@ org.apache.velocity velocity-engine-core - 2.0 + ${velocity.engine.version} commons-beanutils Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java?rev=1833882=1833881=1833882=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java Wed Jun 20 00:47:45 2018 @@ -27,6 +27,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -212,6 +214,52 @@ public class ClassUtils return foundSome; } +private static URL getResourceImpl(final String name, final Object caller) +{ +URL url = getThreadContextLoader().getResource(name); +if (url == null) +{ +url = getClassLoader().getResource(name); +if (url == null) +{ +url = ClassUtils.class.getResource(name); +if (url == null && caller != null) +{ +Class callingClass = caller.getClass(); +if (callingClass == Class.class) +{ +callingClass = (Class)caller; +} +url = callingClass.getResource(name); +} +} +} +return url; +} + +private static InputStream getResourceAsStreamImpl(final String name, final Object caller) +{ +InputStream inputStream = getThreadContextLoader().getResourceAsStream(name); +if (inputStream == null) +{ +inputStream = getClassLoader().getResourceAsStream(name); +if (inputStream == null) +{ +inputStream = ClassUtils.class.getResourceAsStream(name); +if (inputStream == null && caller != null) +{ +Class callingClass = caller.getClass(); +
svn commit: r1833883 - /velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java
Author: cbrisson Date: Wed Jun 20 00:48:22 2018 New Revision: 1833883 URL: http://svn.apache.org/viewvc?rev=1833883=rev Log: [tools] Fix ViewImportSupport for servlets 3.0 API Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java?rev=1833883=1833882=1833883=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewImportSupport.java Wed Jun 20 00:48:22 2018 @@ -38,6 +38,7 @@ import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; +import javax.servlet.WriteListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; @@ -413,10 +414,23 @@ public class ViewImportSupport extends I } ServletOutputStream sos = new ServletOutputStream() { +@Override public void write(int b) throws IOException { bos.write(b); } + +@Override +public boolean isReady() +{ +return true; +} + +@Override +public void setWriteListener(WriteListener writeListener) +{ +// nop +} }; return sos; }
svn commit: r1833884 - in /velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase: pom.xml src/main/policy/ src/main/policy/showcase.policy src/main/webapp/WEB-INF/web.xml
Author: cbrisson Date: Wed Jun 20 00:58:00 2018 New Revision: 1833884 URL: http://svn.apache.org/viewvc?rev=1833884=rev Log: [tools] Put the showcase webapp tests under a security manager Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/showcase.policy Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml?rev=1833884=1833883=1833884=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml Wed Jun 20 00:58:00 2018 @@ -27,6 +27,9 @@ org.apache.velocity 3.0-SNAPSHOT + + 1.3 + org.apache.velocity velocity-tools-examples-showcase war @@ -37,7 +40,7 @@ org.apache.maven.plugins maven-failsafe-plugin -2.19.1 +2.22.0 integration-test @@ -56,21 +59,43 @@ org.codehaus.cargo cargo-maven2-plugin -1.6.0 - + + + + +-Djava.security.manager + -Djava.security.policy=${project.build.directory}/cargo/configurations/jetty9x/showcase.policy ---> @@ -122,7 +147,7 @@ rhino js - 1.6R5 + 1.7R2 org.apache.velocity @@ -146,7 +171,7 @@ com.republicate webapp-slf4j-logger -1.1 +${webapp-slf4j-logger.version} runtime Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/showcase.policy URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/showcase.policy?rev=1833884=auto == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/showcase.policy (added) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/policy/showcase.policy Wed Jun 20 00:58:00 2018 @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/// +// +// Give Maven repository libs all permissions +// +/// + +grant codeBase "file:@cargo.repository@/-" +{ +permission java.security.AllPermission "", ""; +}; + +/// +// +// Give Jetty libs all permissions +// +/// + +grant codeBase "file:@cargo.container@/-" +{ +permission java.security.AllPermission "", ""; +}; + +/// +// +// Give anyone basic and reflection runtime rights +// +/// + +grant +{ +permission java.lang.RuntimePermission "accessDeclaredMembers"; +permission java.lang.RuntimePermission "getProtectionDomain"; +permission java.lang.RuntimePermission "ge
svn commit: r1834438 - in /velocity/site/cms/trunk: content/css/site.css lib/path.pm lib/view.pm
Author: cbrisson Date: Tue Jun 26 15:21:38 2018 New Revision: 1834438 URL: http://svn.apache.org/viewvc?rev=1834438=rev Log: [site] Preprocessing filter to load source files in code blocks Modified: velocity/site/cms/trunk/content/css/site.css velocity/site/cms/trunk/lib/path.pm velocity/site/cms/trunk/lib/view.pm Modified: velocity/site/cms/trunk/content/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/css/site.css?rev=1834438=1834437=1834438=diff == --- velocity/site/cms/trunk/content/css/site.css (original) +++ velocity/site/cms/trunk/content/css/site.css Tue Jun 26 15:21:38 2018 @@ -282,7 +282,6 @@ pre, code { color: darkgray; font-style: italic; -text-decoration: strike-though; } /* tables */ Modified: velocity/site/cms/trunk/lib/path.pm URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/lib/path.pm?rev=1834438=1834437=1834438=diff == --- velocity/site/cms/trunk/lib/path.pm (original) +++ velocity/site/cms/trunk/lib/path.pm Tue Jun 26 15:21:38 2018 @@ -6,11 +6,14 @@ package path; # invoked to generate the page, and a hashref of named parameters which will # be passed to the view subroutine. +# CB TODO - pre/post processing should be triggered by the {{tags}} present in the file + our @patterns = ( [qr"^/(?:index|news|who-we-are)\.mdtext$", standard => { template => "single_narrative.html", postprocessing => 1 }], [qr"^/(?:engine/.*/changes)\.mdtext$", standard => { template => "single_narrative.html", postprocessing => 1, extralogo => '/engine/devel/images/velocity-logo.png' }], [qr"^/engine/.*\.mdtext", standard => { template => "single_narrative.html", extralogo => '/engine/devel/images/velocity-logo.png' }], [qr"^/(?:tools/.*/changes)\.mdtext$", standard => { template => "single_narrative.html", postprocessing => 1, extralogo => '/tools/devel/images/velocitytools.png' }], + [qr"FeedTool\.mdtext$", standard => { template => "single_narrative.html", preprocessing => 1, extralogo => '/tools/devel/images/velocitytools.png' }], [qr"^/tools/.*\.mdtext", standard => { template => "single_narrative.html", extralogo => '/tools/devel/images/velocitytools.png' }], [qr"^/rss/news.rss", rss => {} ], [qr"\.mdtext$", standard => { template => "single_narrative.html" }], Modified: velocity/site/cms/trunk/lib/view.pm URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/lib/view.pm?rev=1834438=1834437=1834438=diff == --- velocity/site/cms/trunk/lib/view.pm (original) +++ velocity/site/cms/trunk/lib/view.pm Tue Jun 26 15:21:38 2018 @@ -46,6 +46,40 @@ sub changes_report unlink $filename; return $summary . $changes; } +sub source_file +{ +my $url = "http://svn.apache.org/repos/asf/velocity/; . shift; +my $content = get $url; + +$content = "" if not $content; + +# hack to fix non-utf8 chars +utf8::encode($content); + +# extension gives lexer used for code highlighting +if ($url =~ /\.([a-z]+)$/i) +{ +my $accepted = "java properties xml vm vtl vhtml"; +my $ext = lc $1; +if (index($accepted, $ext) != -1) +{ +$ext =~ s/vm|vtl|vhtml/velocity/; +$content = ":::$ext\n$content"; +} +} + +# indent as block of code +$content =~ s/^//smg; + +# filename gives block title +if ($url =~ /(\w+\.[a-z]+)$/) +{ +my $filename = $1; +$content = "\n\n### [$filename]($url)\n\n$content"; +} + +return $content; +} sub team() { my $xml = get "http://svn.apache.org/repos/asf/velocity/maven/trunk/pom/pom.xml;; @@ -63,6 +97,22 @@ sub team() return $pmc . $commiters . $emeriti; } +# pre-processing sub +sub preprocess { +my $text = shift; +my @params = shift; +while($text =~ /\{\{\w+(?:\([^(){}]*\))?\}\}/) +{ +my ($before, $tag, $after) = ($`, $&, $'); +$tag =~ s/^\{\{|\}\}$//g; +$tag =~ m/(\w+)(?:\(([^()]*)\))?/; +my ($method, $args) = ($1, $2); +my $replacement = &{\&{$method}}($args) or debug "could not find tag sub $tag"; +$text = $before . $replacement . $after; +} +return $text; +} + # post-processing sub sub postprocess { my $text = shift; @@ -121,7 +171,7 @@ sub standard { ? Template($args{content})->render(\%args) : $args{content}); - +$args{content} = preprocess($args{content}) if $args{preprocessing}; my $processed = Template($template)->render(\%args); $processed = postprocess($processed, 0) if $args{postprocessing}; return $processed, html => \%args;
svn commit: r1834442 - /velocity/site/cms/trunk/lib/view.pm
Author: cbrisson Date: Tue Jun 26 16:12:23 2018 New Revision: 1834442 URL: http://svn.apache.org/viewvc?rev=1834442=rev Log: [site/tools] Little tweak to preprocessing {{source_file}} tag Modified: velocity/site/cms/trunk/lib/view.pm Modified: velocity/site/cms/trunk/lib/view.pm URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/lib/view.pm?rev=1834442=1834441=1834442=diff == --- velocity/site/cms/trunk/lib/view.pm (original) +++ velocity/site/cms/trunk/lib/view.pm Tue Jun 26 16:12:23 2018 @@ -75,7 +75,7 @@ sub source_file if ($url =~ /(\w+\.[a-z]+)$/) { my $filename = $1; -$content = "\n\n### [$filename]($url)\n\n$content"; +$content = "\n\n [$filename]($url)\n\n$content"; } return $content;
svn commit: r1834441 - in /velocity/site/cms/trunk/content: css/site.css tools/devel/contributions.mdtext tools/devel/contributions/ tools/devel/contributions/FeedTool.mdtext tools/devel/left.nav
Author: cbrisson Date: Tue Jun 26 16:11:38 2018 New Revision: 1834441 URL: http://svn.apache.org/viewvc?rev=1834441=rev Log: [site/tools] Add a contributions section ; add FeedTool as a contribution Added: velocity/site/cms/trunk/content/tools/devel/contributions/ velocity/site/cms/trunk/content/tools/devel/contributions.mdtext velocity/site/cms/trunk/content/tools/devel/contributions/FeedTool.mdtext Modified: velocity/site/cms/trunk/content/css/site.css velocity/site/cms/trunk/content/tools/devel/left.nav Modified: velocity/site/cms/trunk/content/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/css/site.css?rev=1834441=1834440=1834441=diff == --- velocity/site/cms/trunk/content/css/site.css (original) +++ velocity/site/cms/trunk/content/css/site.css Tue Jun 26 16:11:38 2018 @@ -269,6 +269,7 @@ a[href]:visited pre, code { font-size: 0.8em; +line-height: 1.2em; } .note Added: velocity/site/cms/trunk/content/tools/devel/contributions.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/contributions.mdtext?rev=1834441=auto == --- velocity/site/cms/trunk/content/tools/devel/contributions.mdtext (added) +++ velocity/site/cms/trunk/content/tools/devel/contributions.mdtext Tue Jun 26 16:11:38 2018 @@ -0,0 +1,19 @@ +Title: Apache Velocity Tools - Contributions + +## Contributions + +This page lists reusable users contributed code. Please note that this code has been barely compiled and rarely tested by Velocity commiters. + +[TOC] + +### Tools + +* [FeedTool](contributions/FeedTool.html) by **C. Townson** is a tool providing the ability to retrieve and manipulate RSS and Atom feeds from within Velocity templates. It is built upon the [Rome API](https://rometools.github.io/rome/). + +### Contributing code + +If you can and wish to share your code, you're most welcome! + +Tools which are sufficiently generics will be considered for inclusion in the releases. Others will be listed on that page if considered productive. + +In either case, you will have to open an issue on [Velocity Tools' JIRA](https://issues.apache.org/jira/projects/VELTOOLS), describe your contribution, attach your code, and also the apropriate [Contributor License Agreement or Software Grant](https://www.apache.org/licenses/#grants). Added: velocity/site/cms/trunk/content/tools/devel/contributions/FeedTool.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/contributions/FeedTool.mdtext?rev=1834441=auto == --- velocity/site/cms/trunk/content/tools/devel/contributions/FeedTool.mdtext (added) +++ velocity/site/cms/trunk/content/tools/devel/contributions/FeedTool.mdtext Tue Jun 26 16:11:38 2018 @@ -0,0 +1,45 @@ +Title: Apache Velocity Tools - FeedTool + +## FeedTool + +[FeedTool](FeedTool.mdtext) is a tool providing the ability to retrieve and manipulate RSS and Atom feeds from within Velocity templates. It is built upon the [Rome API](https://rometools.github.io/rome/). + +The tool works by retrieving a feed from a specified URI and returning it in a ContextFeedWrapper class. The idea with the wrapper class is to have a convenient location for the provision of convenience methods for feed and feed entry manipulation ... although it could easily be incorporated into a single class. + +[TOC] + +### Dependencies + +* [Rome API](https://rometools.github.io/rome/) + +:::xml + +com.rometools +rome +1.10.0 + + +* [Rome Fetcher](https://rometools.github.io/rome/Fetcher/index.html) + +:::xml + +com.rometools +rome-fetcher +1.10.0 + + +* [JDom2](http://www.jdom.org/) + +::xml + +org.jdom +jdom2 +2.0.6 + + +### Code + +{{source_file(contribs/tools/FeedTool/FeedTool.java)}} + +{{source_file(contribs/tools/FeedTool/ContextFeedWrapper.java)}} + Modified: velocity/site/cms/trunk/content/tools/devel/left.nav URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/left.nav?rev=1834441=1834440=1834441=diff == --- velocity/site/cms/trunk/content/tools/devel/left.nav (original) +++ velocity/site/cms/trunk/content/tools/devel/left.nav Tue Jun 26 16:11:38 2018 @@ -5,13 +5,14 @@ * [GenericTools](generic.html) * [VelocityView](view.html) ## Docs -* [Tools Summary](tools-summary.html) +* [Standard Tools](tools-summary.html) * [Javadoc](apidocs/index.html) * [Upgrading](upgrading.html) * [Configuration](configuration.html) * [Standalone Use](standalone.html) * [Web Integration](frameworks.html) * [Creating Tools
svn commit: r1834440 - in /velocity/contribs/tools/FeedTool: ./ ContextFeedWrapper.java FeedTool.java
Author: cbrisson Date: Tue Jun 26 15:57:54 2018 New Revision: 1834440 URL: http://svn.apache.org/viewvc?rev=1834440=rev Log: [tools/contribs] Add FeedTool to the versionned contribs repository Added: velocity/contribs/tools/FeedTool/ velocity/contribs/tools/FeedTool/ContextFeedWrapper.java velocity/contribs/tools/FeedTool/FeedTool.java Added: velocity/contribs/tools/FeedTool/ContextFeedWrapper.java URL: http://svn.apache.org/viewvc/velocity/contribs/tools/FeedTool/ContextFeedWrapper.java?rev=1834440=auto == --- velocity/contribs/tools/FeedTool/ContextFeedWrapper.java (added) +++ velocity/contribs/tools/FeedTool/ContextFeedWrapper.java Tue Jun 26 15:57:54 2018 @@ -0,0 +1,89 @@ +package org.apache.velocity.tools.view.tools; + +import com.rometools.rome.feed.synd.SyndFeed; +import com.rometools.rome.feed.synd.SyndEntry; + +/** + * Feed wrapper for Velocity context providing + * utility methods for accessing feed object properties + * + * @author Christopher Townson + * + */ +public class ContextFeedWrapper { + +/** + * The feed + */ +private SyndFeed feed; + +/** + * An interger containing the total number of items in the retrieved feed + */ +private int numberOfEntries; + +/** + * A SyndEntry object for holding the most recent feed entry + */ +private SyndEntry latest; + +/** + * + * @param feed + */ +public ContextFeedWrapper(SyndFeed feed) { +// assign feed object +this.setFeed(feed); + +// grab number of entries +this.numberOfEntries = this.getFeed().getEntries().size(); + +// grab most recent entry (presently: just first entry) +// TODO make this loop through entries and compare dates +this.latest = (SyndEntry) this.getFeed().getEntries().get(0); +} + +/** + * @return Returns the feed. + */ +public SyndFeed getFeed() { +return this.feed; +} + +/** + * @param feed The feed to set. + */ +public void setFeed(SyndFeed feed) { +this.feed = feed; +} + +/** + * @return Returns the numberOfEntries. + */ +public int getNumberOfEntries() { +return numberOfEntries; +} + +/** + * @param numberOfEntries The numberOfEntries to set. + */ +public void setNumberOfEntries(int numberOfEntries) { +this.numberOfEntries = numberOfEntries; +} + +/** + * @return Returns the latest feed entry. + */ +public SyndEntry getLatest() { +return latest; +} + +/** + * @param latest The entry to set as the latest + */ +public void setLatest(SyndEntry latest) { +this.latest = latest; +} + +} + Added: velocity/contribs/tools/FeedTool/FeedTool.java URL: http://svn.apache.org/viewvc/velocity/contribs/tools/FeedTool/FeedTool.java?rev=1834440=auto == --- velocity/contribs/tools/FeedTool/FeedTool.java (added) +++ velocity/contribs/tools/FeedTool/FeedTool.java Tue Jun 26 15:57:54 2018 @@ -0,0 +1,185 @@ +package org.apache.velocity.tools.view.tools; + +import java.net.URL; +import java.net.HttpURLConnection; +import java.io.IOException; +import java.net.MalformedURLException; + +import sun.misc.BASE64Encoder; + +import com.rometools.rome.feed.synd.SyndFeed; +import com.rometools.rome.io.SyndFeedInput; +import com.rometools.rome.io.FeedException; +import com.rometools.rome.io.XmlReader; +import com.rometools.fetcher.FeedFetcher; +import com.rometools.fetcher.FetcherException; +import com.rometools.fetcher.impl.FeedFetcherCache; +import com.rometools.fetcher.impl.HashMapFeedInfoCache; +import com.rometools.fetcher.impl.HttpURLFeedFetcher; + +/** + * FeedTool + * + * A Velocity View Tool for working with RSS and Atom APIs using Rome + * + * @author C.Townson + */ +public class FeedTool +{ +/** + * The URL of the feed to be fetched by RomeFetcher + */ +private URL feedURL; + +/** + * The FeedObject returned from fetch by RomeFetcher + */ +private ContextFeedWrapper feed; + +/** + * Default view tool no-arg constructor + */ +public FeedTool() { +// do nothing - View Tools must have public no-arg constructor +} + +/** + * Returns the feed located at the specified URL + * + * This is the core method provided with this tool - use this + * from template
svn commit: r1834443 [2/2] - in /velocity/site/production: css/ tools/devel/ tools/devel/contributions/
Modified: velocity/site/production/tools/devel/dependencies.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/dependencies.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/dependencies.html (original) +++ velocity/site/production/tools/devel/dependencies.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/frameworks.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/frameworks.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/frameworks.html (original) +++ velocity/site/production/tools/devel/frameworks.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/generic.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/generic.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/generic.html (original) +++ velocity/site/production/tools/devel/generic.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/index.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/index.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/index.html (original) +++ velocity/site/production/tools/devel/index.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/left.nav URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/left.nav?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/left.nav (original) +++ velocity/site/production/tools/devel/left.nav Tue Jun 26 16:14:10 2018 @@ -5,13 +5,14 @@ * [GenericTools](generic.html) * [VelocityView](view.html) ## Docs -* [Tools Summary](tools-summary.html) +* [Standard Tools](tools-summary.html) * [Javadoc](apidocs/index.html) * [Upgrading](upgrading.html) * [Configuration](configuration.html) * [Standalone Use](standalone.html) * [Web Integration](frameworks.html) * [Creating Tools](creating-tools.html) +* [Contributions](contributions.html) * [Glossary](/engine/devel/glossary.html) * [FAQ](http://wiki.apache.org/velocity/VelocityFAQ) * [Wiki](http://wiki.apache.org/velocity/) Modified: velocity/site/production/tools/devel/standalone.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/standalone.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/standalone.html (original) +++ velocity/site/production/tools/devel/standalone.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/tools-summary.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/tools-summary.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/tools-summary.html (original) +++ velocity/site/production/tools/devel/tools-summary.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover >
svn commit: r1834443 [1/2] - in /velocity/site/production: css/ tools/devel/ tools/devel/contributions/
Author: cbrisson Date: Tue Jun 26 16:14:10 2018 New Revision: 1834443 URL: http://svn.apache.org/viewvc?rev=1834443=rev Log: [site/tools] Add a contributions section ; add FeedTool as a contribution => prod Added: velocity/site/production/tools/devel/contributions/ velocity/site/production/tools/devel/contributions.html velocity/site/production/tools/devel/contributions/FeedTool.html Modified: velocity/site/production/css/site.css velocity/site/production/tools/devel/changes.html velocity/site/production/tools/devel/config-java.html velocity/site/production/tools/devel/config-properties.html velocity/site/production/tools/devel/config-xml.html velocity/site/production/tools/devel/configuration.html velocity/site/production/tools/devel/creating-tools.html velocity/site/production/tools/devel/dependencies.html velocity/site/production/tools/devel/frameworks.html velocity/site/production/tools/devel/generic.html velocity/site/production/tools/devel/index.html velocity/site/production/tools/devel/left.nav velocity/site/production/tools/devel/standalone.html velocity/site/production/tools/devel/tools-summary.html velocity/site/production/tools/devel/upgrading.html velocity/site/production/tools/devel/view-layoutservlet.html velocity/site/production/tools/devel/view-servlet.html velocity/site/production/tools/devel/view-tag.html velocity/site/production/tools/devel/view.html Modified: velocity/site/production/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/production/css/site.css?rev=1834443=1834442=1834443=diff == --- velocity/site/production/css/site.css (original) +++ velocity/site/production/css/site.css Tue Jun 26 16:14:10 2018 @@ -269,6 +269,7 @@ a[href]:visited pre, code { font-size: 0.8em; +line-height: 1.2em; } .note @@ -282,7 +283,6 @@ pre, code { color: darkgray; font-style: italic; -text-decoration: strike-though; } /* tables */ Modified: velocity/site/production/tools/devel/changes.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/changes.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/changes.html (original) +++ velocity/site/production/tools/devel/changes.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/config-java.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/config-java.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/config-java.html (original) +++ velocity/site/production/tools/devel/config-java.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/config-properties.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/config-properties.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/config-properties.html (original) +++ velocity/site/production/tools/devel/config-properties.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apache.org/velocity/;>Wiki Modified: velocity/site/production/tools/devel/config-xml.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/config-xml.html?rev=1834443=1834442=1834443=diff == --- velocity/site/production/tools/devel/config-xml.html (original) +++ velocity/site/production/tools/devel/config-xml.html Tue Jun 26 16:14:10 2018 @@ -168,13 +168,14 @@ h2:hover > .headerlink, h3:hover > .head Docs -Tools Summary +Standard Tools Javadoc Upgrading Configuration Standalone Use Web Integration Creating Tools +Contributions Glossary http://wiki.apache.org/velocity/VelocityFAQ;>FAQ http://wiki.apa
svn commit: r1834554 - /velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml
Author: cbrisson Date: Wed Jun 27 22:38:45 2018 New Revision: 1834554 URL: http://svn.apache.org/viewvc?rev=1834554=rev Log: [tools/showcase] Disable security manager in showcase test Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml?rev=1834554=1834553=1834554=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/pom.xml Wed Jun 27 22:38:45 2018 @@ -73,6 +73,8 @@ + + - +
svn commit: r1834363 - /velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext
Author: cbrisson Date: Mon Jun 25 18:30:53 2018 New Revision: 1834363 URL: http://svn.apache.org/viewvc?rev=1834363=rev Log: [site/tools] Review dependencies page Modified: velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext Modified: velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext?rev=1834363=1834362=1834363=diff == --- velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/dependencies.mdtext Mon Jun 25 18:30:53 2018 @@ -13,19 +13,20 @@ Note: Java version 1.7+ is required for Jar Name | Version | Compile | Tests | Runtime | Notes -|-|-|---|-|-- -commons-beanutils | 1.7.0 | Yes | Yes | Yes | Required for core infrastructure, [MathTool](apidocs/org/apache/velocity/tools/generic/MathTool.html) and [DisplayTool](apidocs/org/apache/velocity/tools/generic/DisplayTool.html) -commons-digester | 3.2 | Yes | Yes | Yes | Required for [xml configuration](config-xml.html) and [UIDependencyTool](apidocs/org/apache/velocity/tools/view/UiDependencyTool.html) +velocity | 2.0+ | Yes | Yes | Yes | Required for core infrastructure and several tools +commons-beanutils | 1.9.3 | Yes | Yes | Yes | Required for core infrastructure and several tools +commons-digester3 | 3.2 | Yes | Yes | Yes | Required for [xml configuration](config-xml.html) (and [UIDependencyTool](apidocs/org/apache/velocity/tools/view/UiDependencyTool.html) view tool) +com.googlecode.json-simple | 1.1.1 | Yes | No | No | Required only at compilation time for [JsonTool](apidocs/org/apache/velocity/tools/generic/JsonTool.html) junit | 4.12 | No | Yes | No | Only required for tests. -velocity | 2.0+ | Yes | Yes | Yes | Required for core infrastructure, [ClassTool](apidocs/org/apache/velocity/tools/generic/ClassTool.html), [LinkTool](apidocs/org/apache/velocity/tools/generic/LinkTool.html), [LoopTool](apidocs/org/apache/velocity/tools/generic/LoopTool.html), [RenderTool](apidocs/org/apache/velocity/tools/generic/RenderTool.html) and [XmlTool](apidocs/org/apache/velocity/tools/generic/XmlTool.html) ### VelocityView Jar Name | Version | Compile | Tests | Runtime | Notes -|-|-|---|-|-- -junit | 4.12 | No | Yes | No | Only required for tests. -easymock | 3.4 | No | Yes | No | Only required for tests. -servletapi | 3.0.1+ | Yes | Yes | No | Required for all [VelocityView](apidocs/org/apache/velocity/tools/view/package-summary.html) tools except for [RenderTool](apidocs/org/apache/velocity/tools/generic/RenderTool.html). Provided by the J2EE container at runtime. velocity-tools-generic | 3.0 | Yes | Yes | Yes | +servletapi | 3.0.1+ | Yes | Yes | No | Required for most view tools (provided by the J2EE container) +junit | 4.12 | No | Yes | No | Only required for tests +easymock | 3.6 | No | Yes | No | Only required for tests ## SLF4J Binding
svn commit: r1834364 - /velocity/site/cms/trunk/content/css/site.css
Author: cbrisson Date: Mon Jun 25 18:31:15 2018 New Revision: 1834364 URL: http://svn.apache.org/viewvc?rev=1834364=rev Log: [site] Add codehilite css styles Modified: velocity/site/cms/trunk/content/css/site.css Modified: velocity/site/cms/trunk/content/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/css/site.css?rev=1834364=1834363=1834364=diff == --- velocity/site/cms/trunk/content/css/site.css (original) +++ velocity/site/cms/trunk/content/css/site.css Mon Jun 25 18:31:15 2018 @@ -465,3 +465,76 @@ table.conversions th margin-bottom: 1.2em; } } + +/* markdown code hilite */ +/* generated with command: pygmentize -S default -f html -a .codehilite */ + +.codehilite .hll { background-color: #cc } +.codehilite { background: #f8f8f8; } +.codehilite .c { color: #408080; font-style: italic } /* Comment */ +.codehilite .err { border: 1px solid #FF } /* Error */ +.codehilite .k { color: #008000; font-weight: bold } /* Keyword */ +.codehilite .o { color: #66 } /* Operator */ +.codehilite .ch { color: #408080; font-style: italic } /* Comment.Hashbang */ +.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */ +.codehilite .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ +.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */ +.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */ +.codehilite .gd { color: #A0 } /* Generic.Deleted */ +.codehilite .ge { font-style: italic } /* Generic.Emph */ +.codehilite .gr { color: #FF } /* Generic.Error */ +.codehilite .gh { color: #80; font-weight: bold } /* Generic.Heading */ +.codehilite .gi { color: #00A000 } /* Generic.Inserted */ +.codehilite .go { color: #88 } /* Generic.Output */ +.codehilite .gp { color: #80; font-weight: bold } /* Generic.Prompt */ +.codehilite .gs { font-weight: bold } /* Generic.Strong */ +.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.codehilite .gt { color: #0044DD } /* Generic.Traceback */ +.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.codehilite .kp { color: #008000 } /* Keyword.Pseudo */ +.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.codehilite .kt { color: #B00040 } /* Keyword.Type */ +.codehilite .m { color: #66 } /* Literal.Number */ +.codehilite .s { color: #BA2121 } /* Literal.String */ +.codehilite .na { color: #7D9029 } /* Name.Attribute */ +.codehilite .nb { color: #008000 } /* Name.Builtin */ +.codehilite .nc { color: #FF; font-weight: bold } /* Name.Class */ +.codehilite .no { color: #88 } /* Name.Constant */ +.codehilite .nd { color: #AA22FF } /* Name.Decorator */ +.codehilite .ni { color: #99; font-weight: bold } /* Name.Entity */ +.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.codehilite .nf { color: #FF } /* Name.Function */ +.codehilite .nl { color: #A0A000 } /* Name.Label */ +.codehilite .nn { color: #FF; font-weight: bold } /* Name.Namespace */ +.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.codehilite .nv { color: #19177C } /* Name.Variable */ +.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.codehilite .w { color: #bb } /* Text.Whitespace */ +.codehilite .mb { color: #66 } /* Literal.Number.Bin */ +.codehilite .mf { color: #66 } /* Literal.Number.Float */ +.codehilite .mh { color: #66 } /* Literal.Number.Hex */ +.codehilite .mi { color: #66 } /* Literal.Number.Integer */ +.codehilite .mo { color: #66 } /* Literal.Number.Oct */ +.codehilite .sa { color: #BA2121 } /* Literal.String.Affix */ +.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */ +.codehilite .sc { color: #BA2121 } /* Literal.String.Char */ +.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */ +.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */ +.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.codehilite .sx { color: #008000 } /* Literal.String.Other */ +.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */ +.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */ +.codehilite .ss { color: #19177C } /* Literal.String.Symbol */ +.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.codehilite .fm { color: #FF } /* Name.Function.Magic */ +.codehilite .vc
svn commit: r1834387 - /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java
Author: cbrisson Date: Tue Jun 26 00:47:22 2018 New Revision: 1834387 URL: http://svn.apache.org/viewvc?rev=1834387=rev Log: [tools] fix VELTOOLS-168 - LinkTool internal query should only contain scalars or Lists, never arrays Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java?rev=1834387=1834386=1834387=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java Tue Jun 26 00:47:22 2018 @@ -20,6 +20,7 @@ package org.apache.velocity.tools.generi */ import java.io.UnsupportedEncodingException; +import java.lang.reflect.Array; import java.net.URI; import java.net.URLDecoder; import java.net.URLEncoder; @@ -27,6 +28,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.velocity.tools.Scope; import org.apache.velocity.tools.ToolContext; @@ -439,7 +441,35 @@ public class LinkTool extends SafeConfig } else if (obj instanceof Map) { -this.query = new LinkedHashMap((Map)obj); +this.query = new LinkedHashMap(); +for (Map.Entry keyValues : (Set)((Map)obj).entrySet()) +{ +String key = String.valueOf(keyValues.getKey()); +Object values = keyValues.getValue(); +if (values.getClass().isArray()) +{ +int size = Array.getLength(values); +switch (size) +{ +case 0: +break; +case 1: +this.query.put(key, Array.get(values, 0)); +break; +default: +List lst = new ArrayList(); +for (int i = 0; i < Array.getLength(values); ++i) +{ +lst.add(Array.get(values, i)); +} +this.query.put(key, lst); +} +} +else +{ +this.query.put(key, values); +} +} } else {
svn commit: r1834385 - in /velocity/tools/trunk/velocity-tools-generic/src: main/java/org/apache/velocity/tools/generic/CollectionTool.java test/java/org/apache/velocity/tools/generic/CollectionToolTe
Author: cbrisson Date: Mon Jun 25 23:58:00 2018 New Revision: 1834385 URL: http://svn.apache.org/viewvc?rev=1834385=rev Log: [tools] Have CollectionTool.sort() methods filter out null elements Added: velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/CollectionToolTests.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java?rev=1834385=1834384=1834385=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java Mon Jun 25 23:58:00 2018 @@ -216,7 +216,7 @@ public class CollectionTool extends Safe /** * Sorts a Collection using a Comparator. A defensive copy is made * of the Collection beforehand, so the original Collection is left - * untouched. + * untouched and null elements filtered out. * * @param c The Collection to sort. * @param comparator The comparator to use for sorting. @@ -227,7 +227,18 @@ public class CollectionTool extends Safe public Collection sort(final Collection c, final Comparator comparator) { -final ArrayList list = new ArrayList<>(c); +ArrayList list = new ArrayList<>(); +for (T elem : c) +{ +if (elem != null) +{ +list.add(elem); +} +} +if (list.size() < c.size()) +{ +getLog().warn("[collection] sort: null items have been filtered"); +} Collections.sort(list, comparator); return list; } @@ -235,7 +246,7 @@ public class CollectionTool extends Safe /** * Sorts an array using a Comparator. A defensive copy is made * of the array beforehand, so the original array is left - * untouched. + * untouched and null elements filtered out. * * @param a The array to sort. * @param comparator The comparator to use for sorting. @@ -245,7 +256,20 @@ public class CollectionTool extends Safe */ public T[] sort(final T[] a, final Comparator comparator) { -final T[] copy = a.clone(); +int nulls = 0; +for (T t : a) +{ +if (t == null) +{ +++nulls; +} +} +if (nulls > 0) +{ +getLog().warn("[collection] sort: null items have been filtered out"); +} +final T[] copy = Arrays.copyOf(a,a.length - nulls); +for (int from = 0, to = 0; from < a.length; ++from) if (a[from] != null) copy[to++] = a[from]; Arrays.sort(copy, comparator); return copy; } @@ -366,7 +390,18 @@ public class CollectionTool extends Safe public Collection sort(Collection collection, List properties) { -List list = new ArrayList<>(collection); +List list = new ArrayList<>(); +for (Object o : collection) +{ +if (o != null) +{ +list.add(o); +} +} +if (list.size() < collection.size()) +{ +getLog().warn("[collection] sort: null items have been filtered out"); +} return internalSort(list, properties); } @@ -377,7 +412,7 @@ public class CollectionTool extends Safe public Collection sort(Object[] array, List properties) { -return internalSort(Arrays.asList(array), properties); +return sort(Arrays.asList(array), properties); } protected Collection internalSort(List list, List properties) @@ -387,7 +422,9 @@ public class CollectionTool extends Safe if (properties == null) { Collections.sort(list); -} else { +} +else +{ Collections.sort(list, new PropertiesComparator(properties)); } return list; Added: velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/CollectionToolTests.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/CollectionToolTests.java?rev=1834385=auto == --- velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/g
svn commit: r1834388 - in /velocity/tools/trunk: velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ velocity-tools-view/src/main/java/org/apache/velocity/tools/view/
Author: cbrisson Date: Tue Jun 26 01:47:59 2018 New Revision: 1834388 URL: http://svn.apache.org/viewvc?rev=1834388=rev Log: [tools] Have some more tools be serializable Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/DisplayTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LogTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LoopTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/MarkupTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/MathTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/RenderTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/XmlTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java?rev=1834388=1834387=1834388=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java Tue Jun 26 01:47:59 2018 @@ -19,8 +19,8 @@ package org.apache.velocity.tools.generi * under the License. */ +import java.io.Serializable; import java.util.Collection; - import org.apache.velocity.tools.Scope; import org.apache.velocity.tools.config.DefaultKey; import org.apache.velocity.tools.config.ValidScope; @@ -63,7 +63,7 @@ import org.apache.velocity.tools.config. @ValidScope(Scope.APPLICATION) @DefaultKey("alternator") @Deprecated -public class AlternatorTool extends SafeConfig +public class AlternatorTool extends SafeConfig implements Serializable { public static final String AUTO_ALTERNATE_DEFAULT_KEY = "autoAlternate"; Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java?rev=1834388=1834387=1834388=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java Tue Jun 26 01:47:59 2018 @@ -115,7 +115,7 @@ import java.util.Map; * @version $Id$ */ @DefaultKey("collection") -public class CollectionTool extends SafeConfig +public class CollectionTool extends SafeConfig implements Serializable { public static final String STRINGS_DELIMITER_FORMAT_KEY = "stringsDelimiter"; public static final String STRINGS_TRIM_KEY = "trimStrings"; Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java?rev=1834388=1834387=1834388=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java Tue Jun 26 01:47:59 2018 @@ -19,6 +19,7 @@ package org.apache.velocity.tools.generi * under the License. */ +import java.io.Serializable; import ja
svn commit: r1834362 - /velocity/tools/trunk/test/
Author: cbrisson Date: Mon Jun 25 18:28:33 2018 New Revision: 1834362 URL: http://svn.apache.org/viewvc?rev=1834362=rev Log: [tools] remove deprecated test resources Removed: velocity/tools/trunk/test/
svn commit: r1834361 - in /velocity/tools/trunk: README.md README.txt
Author: cbrisson Date: Mon Jun 25 18:25:06 2018 New Revision: 1834361 URL: http://svn.apache.org/viewvc?rev=1834361=rev Log: [tools] old README.txt becomes brand new README.md Added: velocity/tools/trunk/README.md Removed: velocity/tools/trunk/README.txt Added: velocity/tools/trunk/README.md URL: http://svn.apache.org/viewvc/velocity/tools/trunk/README.md?rev=1834361=auto == --- velocity/tools/trunk/README.md (added) +++ velocity/tools/trunk/README.md Mon Jun 25 18:25:06 2018 @@ -0,0 +1,98 @@ +Title: Apache Velocity Tools + +# Apache Velocity Tools + +Welcome to the VelocityTools projects. This is a subproject of the +Apache Velocity project hosted at http://velocity.apache.org/ + +The VelocityTools project contains several subprojects: + +velocity-tools-generic/ A collection of general purpose tools +velocity-tools-view/Tools servlets and filters for use in a webapp +velocity-tools-jsp/ Tools for a J2EE JSP context +velocity-tools-examples/ + velocity-tools-examples-simple/ Simple examples + velocity-tools-examples-showcase/ A full webapp demonstrating tools + +## REQUIREMENTS + +Apache Velocity Tools will run with any Java runtime engine v1.7 or greater. + +Building from source requires Java development kit v1.7 or greater and Maven 3 (3.0.5+). + +Maven should fetch all needed dependencies for compile ant run time, which are: + +* velocity-engine-core v2.0 and its dependencies +* commons-beanutils v1.9.3 +* commons-digester3 v3.2 +* JSON.simple v1.1.1 (only at compile time) + +Plus the following ones, needed for the integrated tests: + +* slf4j-simple v1.7.25 +* junit v4.12 +* easymock v3.6 + +## UPGRADING FROM EARLIER RELEASES + +Release with the same major number are intended to be drop-in +replacements. However, in most cases the versions of dependency jars +must be adjusted because newer versions of Velocity might require +updates. + +### Upgrading from Velocity Tools 2.0 to Velocity Tools 3.0 + + Dependency changes + +* Velocity Tools now relies on the use of Velocity Engine 2.0, and also switched +to the slf4j logging system. +* commons-beanutils:commons-beanutils has been updated to 1.9.3 +* org.apache.commons:commons-digester3 has been updated to 3.2 +* com.googlecode.json-simple 1.1.1 is now needed (only at compile time) +* for tests, junit:junit has been updated to 4.12 and org.easymock:easymock to 3.6 + + Behavor / API changes + +* tools autoloading turned off by default +With velocity-tools-view in a webapp context, if you want the default +tools loaded without explicitely loading them yourslef, you will have to enable autoloading in your `web.xml` file: + + + org.apache.velocity.tools.loadDefaults + true + + +(or the same with `` for a single servlet). +* the WebappResourceLoader, as other Engine loaders, now returns a Reader rather than an InputStream +* the unmaintained Struts tools have been dropped +* there are several new tools: LogTool, JsonTool, CollectionTool +* several tools became deprecated: AlternateTool, SortTool, ConversionTool (conversion methods are now located in DateTool and NumberTool) + +You can consult [the full list of changes](http://velocity.apache.org/tools/3.0/changes.html) + +## Upgrading from earlier versions + +Please refer to [Tools 2.0 upgrading instructions](http://velocity.apache.org/tools/2.0/upgrading.html). + +## Building Apache Velocity Tools + +In order to use the latest version of Apache Velocity Tools, you may want to build it. + +Building is easy. All components necessary to build are included or get +downloaded from the internet during the build, except for the Java SDK and the Maven build tool. + +**IMPORTANT** As the Apache Velocity Tools build process wants to download a number of jars +from the internet, you must be online when you are building for the first time. + +To build the Velocity Tools' jars, just run maven using the command: + +mvn + +This will create a `target/` directory containing the Velocity tools `.jar` +file in each sub-module directory. + +## Feedback + +We welcome your feedback to u...@velocity.apache.org. + +- The Apache Velocity Team
svn commit: r1834380 - in /velocity/tools/trunk: velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties velocity-tools-view/src/main/java/org/apache/veloc
Author: cbrisson Date: Mon Jun 25 21:59:25 2018 New Revision: 1834380 URL: http://svn.apache.org/viewvc?rev=1834380=rev Log: [tools/view] New tools.view.servlet.layout.dynamic boolean property (defaults to false) Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityLayoutServlet.java Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties?rev=1834380=1834379=1834380=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/velocity.properties Mon Jun 25 21:59:25 2018 @@ -31,3 +31,6 @@ tools.view.servlet.layout.directory = la # relative to the layout directory # NOT relative to the root directory of the webapp! tools.view.servlet.layout.default.template = Default.vm + +# Allow dynamic layout changes by 'layout=' query string parameter +tools.view.servlet.layout.dynamic = true Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityLayoutServlet.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityLayoutServlet.java?rev=1834380=1834379=1834380=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityLayoutServlet.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityLayoutServlet.java Mon Jun 25 21:59:25 2018 @@ -116,10 +116,17 @@ public class VelocityLayoutServlet exten */ public static final String KEY_ERROR_INVOCATION_EXCEPTION = "invocation_exception"; +/** + * The velocity.properties key for specifying + * whether dynamic layout change is allowed + */ +public static final String PROPERTY_DYNAMIC_LAYOUT = +"tools.view.servlet.layout.dynamic"; protected String errorTemplate; protected String layoutDir; protected String defaultLayout; +protected boolean allowDynamicLayout; /** * Initializes Velocity, the view servlet and checks for changes to @@ -153,6 +160,9 @@ public class VelocityLayoutServlet exten // for efficiency's sake, make defaultLayout a full path now defaultLayout = layoutDir + defaultLayout; + +// initialize dynamic layout availability +allowDynamicLayout = "true".equalsIgnoreCase(getVelocityProperty(PROPERTY_DYNAMIC_LAYOUT, "false")); } @@ -181,7 +191,7 @@ public class VelocityLayoutServlet exten { // check if an alternate layout has been specified // by way of the request parameters -String layout = request.getParameter(KEY_LAYOUT); +String layout = allowDynamicLayout ? request.getParameter(KEY_LAYOUT) : null; // also look in the request attributes if (layout == null) {
svn commit: r1834382 - /velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java
Author: cbrisson Date: Mon Jun 25 22:00:57 2018 New Revision: 1834382 URL: http://svn.apache.org/viewvc?rev=1834382=rev Log: [tools/view] Fix VelocityViewTest and add some debugging Modified: velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java Modified: velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java?rev=1834382=1834381=1834382=diff == --- velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/view/VelocityViewTest.java Mon Jun 25 22:00:57 2018 @@ -24,6 +24,7 @@ import static org.easymock.EasyMock.*; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.io.StringWriter; import javax.servlet.ServletContext; @@ -35,7 +36,10 @@ import org.apache.velocity.context.Conte import org.apache.velocity.exception.MethodInvocationException; import org.apache.velocity.exception.ParseErrorException; import org.apache.velocity.exception.ResourceNotFoundException; +import org.easymock.IAnswer; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Tests {@link VelocityView}. @@ -44,6 +48,43 @@ import org.junit.Test; public class VelocityViewTest { +static Logger logger = LoggerFactory.getLogger(VelocityViewTest.class); + +/** + * Unique point of passage for non-void calls + * @param value value to return + * @param type of returned value + * @return value + */ +static IAnswer eval(final T value) +{ +return new IAnswer() +{ +public T answer() throws Throwable +{ +String caller = null; +String callee = null; +StackTraceElement stackTrace[] = Thread.currentThread().getStackTrace(); +String previous = null; +for (StackTraceElement line : stackTrace) +{ +String at = line.toString(); +if (at.contains("org.apache") && !at.contains("VelocityViewTest")) +{ +caller = at; +break; +} +previous = at; +} +if (caller != null) callee = previous; +else caller = callee = "???"; +// good place for a breakpoint +logger.trace("[view] method {} called, expecting {}, at {}", value, caller); +return value; +} +}; +} + /** * Test method for {@link org.apache.velocity.tools.view.VelocityView#getTemplate(javax.servlet.http.HttpServletRequest)}. * Tests VELTOOLS-119 @@ -61,30 +102,21 @@ public class VelocityViewTest HttpServletResponse response = createMock(HttpServletResponse.class); Context context = createMock(Context.class); -expect(config.getServletContext()).andReturn(servletContext); - expect(config.findInitParameter(VelocityView.USER_OVERWRITE_KEY)).andReturn(null); - expect(config.findInitParameter(VelocityView.LOAD_DEFAULTS_KEY)).andReturn("false"); - expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY)).andReturn(null); +expect(config.getServletContext()).andAnswer(eval(servletContext)); + expect(config.findInitParameter(VelocityView.USER_OVERWRITE_KEY)).andAnswer(eval((String)null)); + expect(config.findInitParameter(VelocityView.LOAD_DEFAULTS_KEY)).andAnswer(eval("false")); + expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY)).andAnswer(eval((String)null)); expect(servletContext.getResourceAsStream(VelocityView.USER_PROPERTIES_PATH)) - .andReturn(getClass().getResourceAsStream("/WEB-INF/velocity.properties")); -expect(servletContext.getResourceAsStream("/VM_global_library.vm")) - .andReturn(getClass().getResourceAsStream("/VM_global_library.vm")); -expect(servletContext.getResourceAsStream("/VM_global_library.vm")) - .andReturn(getClass().getResourceAsStream("/VM_global_library.vm")); + .andAnswer(eval(getClass().getResourceAsStream("/WEB-INF/velocity.properties"))); String root = new File(getClass().getResource("/").getFile()).getAbsolutePath(); -expect(servletContext.getRealPath("/")).andReturn(root); - expect(config.getInitParameter(VelocityView.
svn commit: r1834381 - /velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Author: cbrisson Date: Mon Jun 25 21:59:55 2018 New Revision: 1834381 URL: http://svn.apache.org/viewvc?rev=1834381=rev Log: [tools/view] Fix another bug in config Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=1834381=1834380=1834381=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Mon Jun 25 21:59:55 2018 @@ -368,7 +368,7 @@ public class VelocityView extends ViewTo if (appProperties != null) { getLog().debug("Configuring Velocity with properties at: {}", appPropsPath); -velocity.setProperties(defaultProperties); +velocity.setProperties(appProperties); } }
svn commit: r1834366 [6/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/devel/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/user-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/devel/user-guide.html (original) +++ velocity/site/production/engine/devel/user-guide.html Mon Jun 25 18:46:53 2018 @@ -336,7 +336,7 @@ h2:hover > .headerlink, h3:hover > .head Velocity Template Language (VTL): An Introduction The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page. Even a web page developer with little or no programming experience should soon be capable of using VTL to incorporate dynamic content in a web site. VTL uses references to embed dynamic content in a web site, and a variable is one type of reference. Variables are one type of reference that can refer to something defined in the Java code, or it can get its value from a VTL statement in the web page itself. Here is an example of a VTL statement that could be embedded in an HTML document: -#set( $a = Velocity ) +#set( $a = Velocity ) @@ -411,76 +411,76 @@ visible. *# This text is outside the com underscore ("_") Here are some examples of valid variable references in the VTL: -$foo -$mudSlinger -$mud-slinger -$mud_slinger -$mudSlinger1 +$foo +$mudSlinger +$mud-slinger +$mud_slinger +$mudSlinger1 When VTL references a variable, such as $foo, the variable can get its value from either a set directive in the template, or from the Java code. For example, if the Java variable $foo has the value bar at the time the template is requested, bar replaces all instances of $foo on the web page. Alternatively, if I include the statement -#set( $foo = bar ) +#set( $foo = bar ) The output will be the same for all instances of $foo that follow this directive. Properties The second flavor of VTL references are properties, and properties have a distinctive format. The shorthand notation consists of a leading $ character followed a VTL Identifier, followed by a dot character (".") and another VTL Identifier. These are examples of valid property references in the VTL: -$customer.Address -$purchase.Total +$customer.Address +$purchase.Total Take the first example, $customer.Address. It can have two meanings. It can mean, Look in the hashtable identified as customer and return the value associated with the key Address. But $customer.Address can also be referring to a method (references that refer to methods will be discussed in the next section); $customer.Address could be an abbreviated way of writing $customer.getAddress(). When your page is requested, Velocity will determine which of these two possibilities makes sense, and then return the appropriate value. Methods A method is defined in the Java code and is capable of doing something useful, like running a calculation or arriving at a decision. Methods are references that consist of a leading "$" character followed a VTL Identifier, followed by a VTL Method Body. A VTL Method Body consists of a VTL Identifier followed by an left parenthesis character ("("), followed by an optional parameter list, followed by right parenthesis character (")"). These are examples of valid method references in the VTL: -$customer.getAddress() -$purchase.getTotal() -$page.setTitle( My Home Page ) -$person.setAttributes( [Strange, Weird, Excited] ) +$customer.getAddress() +$purchase.getTotal() +$page.setTitle( My Home Page ) +$person.setAttributes( [Strange, Weird, Excited] ) The first two examples -- $customer.getAddress() and $purchase.getTotal() -- may look similar to those used in the Properties section above, $customer.Address and $purchase.Total. If you guessed that these examples must be related some in some fashion, you are correct! VTL Properties can be used as a shorthand notation for VTL Methods. The Property $customer.Address has the exact same effect as using the Method $customer.getAddress(). It is generally preferable to use a Property when available. The main difference between Properties and Methods is that you can specify a parameter list to a Method. The shorthand notation can be used for the following Methods -$sun.getPlanets() -$annelid.getDirt() -$album.getPhoto() +$sun.getPlanets() +$annelid.getDirt() +$album.getPhoto() We might expect these methods to return the names of planets belonging to the sun, feed our earthworm, or get a photograph from an album. Only the long notation works for the following Methods. -$sun.getPlanet( [Earth, Mars, Neptune] ) -## Cant pass a parameter list with $sun.Planets +$sun.getPlanet( [Earth, Mars, Neptune] ) +## Cant pass a parameter list with $sun.Planets -$sisyphus.pushRock() -## Velocity assumes I mean $sisyphus.getRock() +$sisyphus.pushRock() +## Velocity assumes I mean
svn commit: r1834366 [3/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/1.7/webapps.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/1.7/webapps.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/1.7/webapps.html (original) +++ velocity/site/production/engine/1.7/webapps.html Mon Jun 25 18:46:53 2018 @@ -267,14 +267,14 @@ webapp.resource.loader.path=/WEB-INF/myt Changing Object State - Don't! Velocity provides the ability to call any method of an object acting as a reference. This can be useful when displaying information into the page but is dangerous when object or application state is modified. For example, the following code safely calls the size() method of a list and displays the result. -There are $users.size() currently logged in. +There are $users.size() currently logged in. An example of an unsafe operation concerns a financial web page with an object in the context that calculates data year by year. The method calculateNextYear() calculates data for the next year and advances an internal counter: -2005 data: $table.data -$table.calculateNextYear() -2006 data: $table.data +2005 data: $table.data +$table.calculateNextYear() +2006 data: $table.data Modified: velocity/site/production/engine/2.0/developer-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/developer-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/2.0/developer-guide.html (original) +++ velocity/site/production/engine/2.0/developer-guide.html Mon Jun 25 18:46:53 2018 @@ -524,15 +524,15 @@ template.merge( context2, writer ); Objects Created in the Template There are two common situations where the Java code must deal with objects created at runtime in the template: When a template author calls a method of an object placed into the context by Java code. -#set($myarr = [a,b,c] ) -$foo.bar( $myarr ) +#set($myarr = [a,b,c] ) +$foo.bar( $myarr ) When a template adds objects to the context, the Java code can access those objects after the merge process is complete. -#set($myarr = [a,b,c] ) -#set( $foo = 1 ) -#set( $bar = bar) +#set($myarr = [a,b,c] ) +#set( $foo = 1 ) +#set( $bar = bar) @@ -660,7 +660,7 @@ template.merge( context2, writer ); where the template we used, testtemplate.vm, is -Hi! This $name from the $project project. +Hi! This $name from the $project project. @@ -1698,18 +1698,18 @@ vc.put(root, root.getRootEle Velocity can be integrated into the Java Scripting Language Framework (as defined by the https://www.jcp.org/en/jsr/detail?id=223;>JSR-223 API). This section is a brief illustration of how to use Velocity Scripting framework through the JSR-223 API. Hello World example: -// get script manager, create a new Velocity script engine factory and get an engine from it -ScriptEngineManager manager = new ScriptEngineManager(); -manager.registerEngineName(velocity, new VelocityScriptEngineFactory()); -ScriptEngine engine = manager.getEngineByName(velocity); +// get script manager, create a new Velocity script engine factory and get an engine from it +ScriptEngineManager manager = new ScriptEngineManager(); +manager.registerEngineName(velocity, new VelocityScriptEngineFactory()); +ScriptEngine engine = manager.getEngineByName(velocity); -System.setProperty(VelocityScriptEngine.VELOCITY_PROPERTIES, path/to/velocity.properties); -String script = Hello $world; -Writer writer = new StringWriter(); -engine.getContext().setWriter(writer); -Object result = engine.eval(script); -System.out.println(writer); +System.setProperty(VelocityScriptEngine.VELOCITY_PROPERTIES, path/to/velocity.properties); +String script = Hello $world; +Writer writer = new StringWriter(); +engine.getContext().setWriter(writer); +Object result = engine.eval(script); +System.out.println(writer);
svn commit: r1834366 [5/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/2.0/webapps.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/webapps.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/2.0/webapps.html (original) +++ velocity/site/production/engine/2.0/webapps.html Mon Jun 25 18:46:53 2018 @@ -268,14 +268,14 @@ webapp.resource.loader.path=/WEB-INF/myt Changing Object State - Don't! Velocity provides the ability to call any method of an object acting as a reference. This can be useful when displaying information into the page but is dangerous when object or application state is modified. For example, the following code safely calls the size() method of a list and displays the result. -There are $users.size() currently logged in. +There are $users.size() currently logged in. An example of an unsafe operation concerns a financial web page with an object in the context that calculates data year by year. The method calculateNextYear() calculates data for the next year and advances an internal counter: -2005 data: $table.data -$table.calculateNextYear() -2006 data: $table.data +2005 data: $table.data +$table.calculateNextYear() +2006 data: $table.data Modified: velocity/site/production/engine/devel/developer-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/developer-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/devel/developer-guide.html (original) +++ velocity/site/production/engine/devel/developer-guide.html Mon Jun 25 18:46:53 2018 @@ -524,15 +524,15 @@ template.merge( context2, writer ); Objects Created in the Template There are two common situations where the Java code must deal with objects created at runtime in the template: When a template author calls a method of an object placed into the context by Java code. -#set($myarr = [a,b,c] ) -$foo.bar( $myarr ) +#set($myarr = [a,b,c] ) +$foo.bar( $myarr ) When a template adds objects to the context, the Java code can access those objects after the merge process is complete. -#set($myarr = [a,b,c] ) -#set( $foo = 1 ) -#set( $bar = bar) +#set($myarr = [a,b,c] ) +#set( $foo = 1 ) +#set( $bar = bar) @@ -660,7 +660,7 @@ template.merge( context2, writer ); where the template we used, testtemplate.vm, is -Hi! This $name from the $project project. +Hi! This $name from the $project project. @@ -1698,18 +1698,18 @@ vc.put(root, root.getRootEle Velocity can be integrated into the Java Scripting Language Framework (as defined by the https://www.jcp.org/en/jsr/detail?id=223;>JSR-223 API). This section is a brief illustration of how to use Velocity Scripting framework through the JSR-223 API. Hello World example: -// get script manager, create a new Velocity script engine factory and get an engine from it -ScriptEngineManager manager = new ScriptEngineManager(); -manager.registerEngineName(velocity, new VelocityScriptEngineFactory()); -ScriptEngine engine = manager.getEngineByName(velocity); +// get script manager, create a new Velocity script engine factory and get an engine from it +ScriptEngineManager manager = new ScriptEngineManager(); +manager.registerEngineName(velocity, new VelocityScriptEngineFactory()); +ScriptEngine engine = manager.getEngineByName(velocity); -System.setProperty(VelocityScriptEngine.VELOCITY_PROPERTIES, path/to/velocity.properties); -String script = Hello $world; -Writer writer = new StringWriter(); -engine.getContext().setWriter(writer); -Object result = engine.eval(script); -System.out.println(writer); +System.setProperty(VelocityScriptEngine.VELOCITY_PROPERTIES, path/to/velocity.properties); +String script = Hello $world; +Writer writer = new StringWriter(); +engine.getContext().setWriter(writer); +Object result = engine.eval(script); +System.out.println(writer);
svn commit: r1834365 - /velocity/site/cms/trunk/cgi-bin
Author: cbrisson Date: Mon Jun 25 18:46:26 2018 New Revision: 1834365 URL: http://svn.apache.org/viewvc?rev=1834365=rev Log: [site] remove deprecated dir Removed: velocity/site/cms/trunk/cgi-bin
svn commit: r1834360 - /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java
Author: cbrisson Date: Mon Jun 25 18:24:33 2018 New Revision: 1834360 URL: http://svn.apache.org/viewvc?rev=1834360=rev Log: [tools/generic] remove unused ClassUtils.getInstance() method Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java?rev=1834360=1834359=1834360=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java Mon Jun 25 18:24:33 2018 @@ -49,15 +49,8 @@ import org.apache.velocity.util.Enumerat */ public class ClassUtils { -public static final ClassUtils INSTANCE = new ClassUtils(); - private ClassUtils() {} -public ClassUtils getInstance() -{ -return INSTANCE; -} - // shortcuts for readability... private static final ClassLoader getThreadContextLoader() {
svn commit: r1834366 [7/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/devel/webapps.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/webapps.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/devel/webapps.html (original) +++ velocity/site/production/engine/devel/webapps.html Mon Jun 25 18:46:53 2018 @@ -268,14 +268,14 @@ webapp.resource.loader.path=/WEB-INF/myt Changing Object State - Don't! Velocity provides the ability to call any method of an object acting as a reference. This can be useful when displaying information into the page but is dangerous when object or application state is modified. For example, the following code safely calls the size() method of a list and displays the result. -There are $users.size() currently logged in. +There are $users.size() currently logged in. An example of an unsafe operation concerns a financial web page with an object in the context that calculates data year by year. The method calculateNextYear() calculates data for the next year and advances an internal counter: -2005 data: $table.data -$table.calculateNextYear() -2006 data: $table.data +2005 data: $table.data +$table.calculateNextYear() +2006 data: $table.data Modified: velocity/site/production/tools/2.0/creating-tools.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/2.0/creating-tools.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/tools/2.0/creating-tools.html (original) +++ velocity/site/production/tools/2.0/creating-tools.html Mon Jun 25 18:46:53 2018 @@ -324,7 +324,7 @@ public class PagerTool Be Robust Always return null on errors! No Exceptions! Ok, maybe there are some exceptions if you are sure that's what you want your tool to do. Just be aware that this will likely surprise the user because uncaught exceptions halt template processing at the point the exception is thrown. If the output of the template is not buffered, this will result in an awkward, partial rendering. So, if you are going to let an exception through, make sure it is worth halting everything for. Often it is sufficient to return null, thus allowing the failed reference to appear in the output like this: -$mytool.somemethod(bad input) +$mytool.somemethod(bad input) Modified: velocity/site/production/tools/2.0/standalone.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/2.0/standalone.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/tools/2.0/standalone.html (original) +++ velocity/site/production/tools/2.0/standalone.html Mon Jun 25 18:46:53 2018 @@ -218,10 +218,10 @@ h2:hover > .headerlink, h3:hover > .head There's nothing particularly special about the tools in VelocityTools 2. No special interfaces, most don't ''need'' any configuration or API access, and those that do are now relatively easy to handle (compared to VelocityTools 1.x). So, if you need a tool, just create an instance, do any configuration you want or need and go. Nothing else to it. ToolManager However, if you want to externalize your configuration or have your tools created and configured for you on demand and you are not working in a servlet environment, then we have created a simple ToolManager that you can use. It's relatively simple. Just create a ToolManager (can be created with or without default tools available), configure it (if you want to), ask it to create a context for you, and use the context as you would any other. Of course, there's more to it, but this should get you started: -ToolManager manager = new ToolManager(); -manager.configure(/path/to/my/configuration.xml); -Context context = manager.createContext(); -myVelocityEngine.evaluate(context, myOutputWriter, This is a $text.test, Test template); +ToolManager manager = new ToolManager(); +manager.configure(/path/to/my/configuration.xml); +Context context = manager.createContext(); +myVelocityEngine.evaluate(context, myOutputWriter, This is a $text.test, Test template); Modified: velocity/site/production/tools/2.0/struts-user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/2.0/struts-user-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/tools/2.0/struts-user-guide.html (original) +++ velocity/site/production/tools/2.0/struts-user-guide.html Mon Jun 25 18:46:53 2018 @@ -382,7 +382,7 @@ session.setAttribute(foo, then the request attribute will take priority, and using -$foo +$foo @@ -511,10 +511,10 @@ foo.bar=whatever Then, the following script... -$text.title -$text.get(test, [bear, dog, cat]) -$text.exists(tutle) -$text.foo.bar
svn commit: r1834366 [2/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/1.7/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/1.7/user-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/1.7/user-guide.html (original) +++ velocity/site/production/engine/1.7/user-guide.html Mon Jun 25 18:46:53 2018 @@ -335,7 +335,7 @@ h2:hover > .headerlink, h3:hover > .head Velocity Template Language (VTL): An Introduction The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page. Even a web page developer with little or no programming experience should soon be capable of using VTL to incorporate dynamic content in a web site. VTL uses references to embed dynamic content in a web site, and a variable is one type of reference. Variables are one type of reference that can refer to something defined in the Java code, or it can get its value from a VTL statement in the web page itself. Here is an example of a VTL statement that could be embedded in an HTML document: -#set( $a = Velocity ) +#set( $a = Velocity ) @@ -411,76 +411,76 @@ visible. *# This text is outside the com underscore ("_") Here are some examples of valid variable references in the VTL: -$foo -$mudSlinger -$mud-slinger -$mud_slinger -$mudSlinger1 +$foo +$mudSlinger +$mud-slinger +$mud_slinger +$mudSlinger1 When VTL references a variable, such as $foo, the variable can get its value from either a set directive in the template, or from the Java code. For example, if the Java variable $foo has the value bar at the time the template is requested, bar replaces all instances of $foo on the web page. Alternatively, if I include the statement -#set( $foo = bar ) +#set( $foo = bar ) The output will be the same for all instances of $foo that follow this directive. Properties The second flavor of VTL references are properties, and properties have a distinctive format. The shorthand notation consists of a leading $ character followed a VTL Identifier, followed by a dot character (".") and another VTL Identifier. These are examples of valid property references in the VTL: -$customer.Address -$purchase.Total +$customer.Address +$purchase.Total Take the first example, $customer.Address. It can have two meanings. It can mean, Look in the hashtable identified as customer and return the value associated with the key Address. But $customer.Address can also be referring to a method (references that refer to methods will be discussed in the next section); $customer.Address could be an abbreviated way of writing $customer.getAddress(). When your page is requested, Velocity will determine which of these two possibilities makes sense, and then return the appropriate value. Methods A method is defined in the Java code and is capable of doing something useful, like running a calculation or arriving at a decision. Methods are references that consist of a leading "$" character followed a VTL Identifier, followed by a VTL Method Body. A VTL Method Body consists of a VTL Identifier followed by an left parenthesis character ("("), followed by an optional parameter list, followed by right parenthesis character (")"). These are examples of valid method references in the VTL: -$customer.getAddress() -$purchase.getTotal() -$page.setTitle( My Home Page ) -$person.setAttributes( [Strange, Weird, Excited] ) +$customer.getAddress() +$purchase.getTotal() +$page.setTitle( My Home Page ) +$person.setAttributes( [Strange, Weird, Excited] ) The first two examples -- $customer.getAddress() and $purchase.getTotal() -- may look similar to those used in the Properties section above, $customer.Address and $purchase.Total. If you guessed that these examples must be related some in some fashion, you are correct! VTL Properties can be used as a shorthand notation for VTL Methods. The Property $customer.Address has the exact same effect as using the Method $customer.getAddress(). It is generally preferable to use a Property when available. The main difference between Properties and Methods is that you can specify a parameter list to a Method. The shorthand notation can be used for the following Methods -$sun.getPlanets() -$annelid.getDirt() -$album.getPhoto() +$sun.getPlanets() +$annelid.getDirt() +$album.getPhoto() We might expect these methods to return the names of planets belonging to the sun, feed our earthworm, or get a photograph from an album. Only the long notation works for the following Methods. -$sun.getPlanet( [Earth, Mars, Neptune] ) -## Cant pass a parameter list with $sun.Planets +$sun.getPlanet( [Earth, Mars, Neptune] ) +## Cant pass a parameter list with $sun.Planets -$sisyphus.pushRock() -## Velocity assumes I mean $sisyphus.getRock() +$sisyphus.pushRock() +## Velocity assumes I mean
svn commit: r1834366 [4/7] - in /velocity/site/production: ./ css/ engine/1.7/ engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/2.0/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/user-guide.html?rev=1834366=1834365=1834366=diff == --- velocity/site/production/engine/2.0/user-guide.html (original) +++ velocity/site/production/engine/2.0/user-guide.html Mon Jun 25 18:46:53 2018 @@ -336,7 +336,7 @@ h2:hover > .headerlink, h3:hover > .head Velocity Template Language (VTL): An Introduction The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page. Even a web page developer with little or no programming experience should soon be capable of using VTL to incorporate dynamic content in a web site. VTL uses references to embed dynamic content in a web site, and a variable is one type of reference. Variables are one type of reference that can refer to something defined in the Java code, or it can get its value from a VTL statement in the web page itself. Here is an example of a VTL statement that could be embedded in an HTML document: -#set( $a = Velocity ) +#set( $a = Velocity ) @@ -411,76 +411,76 @@ visible. *# This text is outside the com underscore ("_") Here are some examples of valid variable references in the VTL: -$foo -$mudSlinger -$mud-slinger -$mud_slinger -$mudSlinger1 +$foo +$mudSlinger +$mud-slinger +$mud_slinger +$mudSlinger1 When VTL references a variable, such as $foo, the variable can get its value from either a set directive in the template, or from the Java code. For example, if the Java variable $foo has the value bar at the time the template is requested, bar replaces all instances of $foo on the web page. Alternatively, if I include the statement -#set( $foo = bar ) +#set( $foo = bar ) The output will be the same for all instances of $foo that follow this directive. Properties The second flavor of VTL references are properties, and properties have a distinctive format. The shorthand notation consists of a leading $ character followed a VTL Identifier, followed by a dot character (".") and another VTL Identifier. These are examples of valid property references in the VTL: -$customer.Address -$purchase.Total +$customer.Address +$purchase.Total Take the first example, $customer.Address. It can have two meanings. It can mean, Look in the hashtable identified as customer and return the value associated with the key Address. But $customer.Address can also be referring to a method (references that refer to methods will be discussed in the next section); $customer.Address could be an abbreviated way of writing $customer.getAddress(). When your page is requested, Velocity will determine which of these two possibilities makes sense, and then return the appropriate value. Methods A method is defined in the Java code and is capable of doing something useful, like running a calculation or arriving at a decision. Methods are references that consist of a leading "$" character followed a VTL Identifier, followed by a VTL Method Body. A VTL Method Body consists of a VTL Identifier followed by an left parenthesis character ("("), followed by an optional parameter list, followed by right parenthesis character (")"). These are examples of valid method references in the VTL: -$customer.getAddress() -$purchase.getTotal() -$page.setTitle( My Home Page ) -$person.setAttributes( [Strange, Weird, Excited] ) +$customer.getAddress() +$purchase.getTotal() +$page.setTitle( My Home Page ) +$person.setAttributes( [Strange, Weird, Excited] ) The first two examples -- $customer.getAddress() and $purchase.getTotal() -- may look similar to those used in the Properties section above, $customer.Address and $purchase.Total. If you guessed that these examples must be related some in some fashion, you are correct! VTL Properties can be used as a shorthand notation for VTL Methods. The Property $customer.Address has the exact same effect as using the Method $customer.getAddress(). It is generally preferable to use a Property when available. The main difference between Properties and Methods is that you can specify a parameter list to a Method. The shorthand notation can be used for the following Methods -$sun.getPlanets() -$annelid.getDirt() -$album.getPhoto() +$sun.getPlanets() +$annelid.getDirt() +$album.getPhoto() We might expect these methods to return the names of planets belonging to the sun, feed our earthworm, or get a photograph from an album. Only the long notation works for the following Methods. -$sun.getPlanet( [Earth, Mars, Neptune] ) -## Cant pass a parameter list with $sun.Planets +$sun.getPlanet( [Earth, Mars, Neptune] ) +## Cant pass a parameter list with $sun.Planets -$sisyphus.pushRock() -## Velocity assumes I mean $sisyphus.getRock() +$sisyphus.pushRock() +## Velocity assumes I mean
svn commit: r1834392 - /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java
Author: cbrisson Date: Tue Jun 26 02:42:16 2018 New Revision: 1834392 URL: http://svn.apache.org/viewvc?rev=1834392=rev Log: [tools] Fix initialization race condition VELTOOLS-157 Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java?rev=1834392=1834391=1834392=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java Tue Jun 26 02:42:16 2018 @@ -102,14 +102,20 @@ public class Toolbox implements java.io. public Object get(String key, String path, Map context) { -Object tool = null; -if (cache != null) -{ -tool = getFromCache(key, path); -} +/* try the cache */ +Object tool = getFromCache(key, path); + if (tool == null) { -tool = getFromInfo(key, path, context); +/* synchronize and try again */ +synchronized (this) +{ +tool = getFromCache(key, path); +if (tool == null) +{ +tool = getFromInfo(key, path, context); +} +} } return tool; }
svn commit: r1834390 - in /velocity/site/cms/trunk/content/tools/2.0: generic.mdtext view.mdtext
Author: cbrisson Date: Tue Jun 26 02:29:05 2018 New Revision: 1834390 URL: http://svn.apache.org/viewvc?rev=1834390=rev Log: [site/tools] Fix broken link Modified: velocity/site/cms/trunk/content/tools/2.0/generic.mdtext velocity/site/cms/trunk/content/tools/2.0/view.mdtext Modified: velocity/site/cms/trunk/content/tools/2.0/generic.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/2.0/generic.mdtext?rev=1834390=1834389=1834390=diff == --- velocity/site/cms/trunk/content/tools/2.0/generic.mdtext (original) +++ velocity/site/cms/trunk/content/tools/2.0/generic.mdtext Tue Jun 26 02:29:05 2018 @@ -6,7 +6,7 @@ GenericTools is the set of classes that ## Default Configuration -The default configuration provided for GenericTools is [here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup. It includes all of the tools listed [below](#tools). +The default configuration provided for GenericTools is [here](http://svn.apache.org/viewvc/velocity/tools/tags/2.0/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup). It includes all of the tools listed [below](#tools). ## Dependencies Modified: velocity/site/cms/trunk/content/tools/2.0/view.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/2.0/view.mdtext?rev=1834390=1834389=1834390=diff == --- velocity/site/cms/trunk/content/tools/2.0/view.mdtext (original) +++ velocity/site/cms/trunk/content/tools/2.0/view.mdtext Tue Jun 26 02:29:05 2018 @@ -14,7 +14,7 @@ Key features: ## Default Configuration -The default configuration provided for VelocityView is [here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup;) and [here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools.xml). +The default configuration provided for VelocityView is [here](http://svn.apache.org/viewvc/velocity/tools/tags/2.0/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup;) and [here](http://svn.apache.org/viewvc/velocity/tools/tags/2.0/src/main/java/org/apache/velocity/tools/view/tools.xml). ## Dependencies
svn commit: r1834410 [5/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/devel/developer-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/developer-guide.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/devel/developer-guide.html (original) +++ velocity/site/production/engine/devel/developer-guide.html Tue Jun 26 10:03:18 2018 @@ -345,45 +345,45 @@ h2:hover > .headerlink, h3:hover > .head 'Merge' the template and your data to produce the ouput. In code, using the singleton pattern via the org.apache.velocity.app.Velocity class, this looks like -import java.io.StringWriter; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.Template; -import org.apache.velocity.app.Velocity; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.MethodInvocationException; +import java.io.StringWriter; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.MethodInvocationException; -Velocity.init(); +Velocity.init(); -VelocityContext context = new VelocityContext(); +VelocityContext context = new VelocityContext(); -context.put( name, new String(Velocity) ); +context.put( name, new String(Velocity) ); -Template template = null; +Template template = null; try -{ - template = Velocity.getTemplate(mytemplate.vm); -} -catch( ResourceNotFoundException rnfe ) -{ - // couldnt find the template -} -catch( ParseErrorException pee ) -{ - // syntax error: problem parsing the template -} -catch( MethodInvocationException mie ) -{ - // something invoked in the template - // threw an exception -} -catch( Exception e ) -{} +{ + template = Velocity.getTemplate(mytemplate.vm); +} +catch( ResourceNotFoundException rnfe ) +{ + // couldnt find the template +} +catch( ParseErrorException pee ) +{ + // syntax error: problem parsing the template +} +catch( MethodInvocationException mie ) +{ + // something invoked in the template + // threw an exception +} +catch( Exception e ) +{} -StringWriter sw = new StringWriter(); +StringWriter sw = new StringWriter(); -template.merge( context, sw ); +template.merge( context, sw ); @@ -392,60 +392,60 @@ h2:hover > .headerlink, h3:hover > .head Developers have two options for using the Velocity engine, the singleton model and the separate instance model. The same core Velocity code is used for both approaches, which are provided to make Velocity easier to integrate into your Java application. Singleton Model This is the legacy pattern, where there is only one instance of the Velocity engine in the JVM (or web application, depending) that is shared by all. This is very convenient as it allows localized configuration and sharing of resources. For example, this is a very appropriate model for use in a Servlet 2.2+ compliant web application as each web application can have its own instance of Velocity, allowing that web application's servlet to share resources like templates, a logger, etc. The singleton is accessable via the org.apache.velocity.app.Velocity class, and and example of use: -import org.apache.velocity.app.Velocity; -import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.Template; ... -/* - * Configure the engine - */ - -Velocity.setProperty( -Velocity.RUNTIME_LOG_NAME, mylog); - -/* - * now initialize the engine - */ +/* + * Configure the engine + */ + +Velocity.setProperty( +Velocity.RUNTIME_LOG_NAME, mylog); + +/* + * now initialize the engine + */ -Velocity.init(); +Velocity.init(); ... -Template t = Velocity.getTemplate(foo.vm); +Template t = Velocity.getTemplate(foo.vm); Separate Instance New in version 1.2, the separate instance allows you to create, configure and use as many instances of Velocity as you wish in the same JVM (or web application.) This is useful when you wish to support separate configurations, such as template directories, loggers, etc in the same application. To use separate instances, use the org.apache.velocity.app.VelocityEngine class. An example, which parallels the above singleton example, looks like: -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.Template; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.Template; ... -/* - * create a new instance of the engine - */ +/* + * create a new instance of the engine + */ -VelocityEngine ve = new VelocityEngine(); +VelocityEngine ve = new VelocityEngine(); -/* - * configure the engine. In this case, we are using - * a specific logger name - */ +/* + *
svn commit: r1834410 [3/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/2.0/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/user-guide.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/user-guide.html (original) +++ velocity/site/production/engine/2.0/user-guide.html Tue Jun 26 10:03:18 2018 @@ -312,22 +312,22 @@ h2:hover > .headerlink, h3:hover > .head Velocity makes it easy to customize web pages to your online visitors. As a web site designer at The Mud Room, you want to make the web page that the customer will see after logging into your site. You meet with software engineers at your company, and everyone has agreed that $customer will hold information pertaining to the customer currently logged in, that $mudsOnSpecial will be all the types mud on sale at present. The $flogger object contains methods that help with promotion. For the task at hand, let's concern ourselves only with these three references. Remember, you don't need to worry about how the software engineers extract the necessary information from the database, you just need to know that it works. This lets you get on with your job, and lets the software engineers get on with theirs. You could embed the following VTL statement in the web page: -html - body -Hello $customer.Name! -table -#foreach( $mud in $mudsOnSpecial ) - #if ( $customer.hasPurchased($mud) ) -tr - td -$flogger.getPromo( $mud ) - /td -/tr - #end -#end -/table - /body -/html +html + body +Hello $customer.Name! +table +#foreach( $mud in $mudsOnSpecial ) + #if ( $customer.hasPurchased($mud) ) +tr + td +$flogger.getPromo( $mud ) + /td +/tr + #end +#end +/table + /body +/html @@ -336,7 +336,7 @@ h2:hover > .headerlink, h3:hover > .head Velocity Template Language (VTL): An Introduction The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page. Even a web page developer with little or no programming experience should soon be capable of using VTL to incorporate dynamic content in a web site. VTL uses references to embed dynamic content in a web site, and a variable is one type of reference. Variables are one type of reference that can refer to something defined in the Java code, or it can get its value from a VTL statement in the web page itself. Here is an example of a VTL statement that could be embedded in an HTML document: -#set( $a = Velocity ) +#set( $a = Velocity ) @@ -347,12 +347,12 @@ h2:hover > .headerlink, h3:hover > .head In the example above, #set is used to assign a value to a variable. The variable, $a, can then be used in the template to output "Velocity". Hello Velocity World! Once a value has been assigned to a variable, you can reference the variable anywhere in your HTML document. In the following example, a value is assigned to $foo and later referenced. -html - body - #set( $foo = Velocity ) - Hello $foo World! - /body -/html +html + body + #set( $foo = Velocity ) + Hello $foo World! + /body +/html @@ -360,44 +360,44 @@ h2:hover > .headerlink, h3:hover > .head To make statements containing VTL directives more readable, we encourage you to start each VTL statement on a new line, although you are not required to do so. The set directive will be revisited in greater detail later on. Comments Comments allows descriptive text to be included that is not placed into the output of the template engine. Comments are a useful way of reminding yourself and explaining to others what your VTL statements are doing, or any other purpose you find useful. Below is an example of a comment in VTL. -## This is a single line comment. +## This is a single line comment. A single line comment begins with ## and finishes at the end of the line. If you're going to write a few lines of commentary, there's no need to have numerous single line comments. Multi-line comments, which begin with # and end with #, are available to handle this scenario. -This is text that is outside the multi-line comment. -Online visitors can see it. +This is text that is outside the multi-line comment. +Online visitors can see it. -#* - Thus begins a multi-line comment. Online visitors wont - see this text because the Velocity Templating Engine will - ignore it. -*# +#* + Thus begins a multi-line comment. Online visitors wont + see this text because the Velocity Templating Engine will + ignore it. +*# -Here is text outside the multi-line comment; it is visible. +Here is text outside the multi-line comment; it is visible. Here are a few examples to clarify how single line and multi-line comments work: -This text is visible. ## This text is not. -This text is
svn commit: r1834410 [7/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/devel/vtl-reference.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/vtl-reference.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/devel/vtl-reference.html (original) +++ velocity/site/production/engine/devel/vtl-reference.html Tue Jun 26 10:03:18 2018 @@ -400,17 +400,17 @@ h2:hover > .headerlink, h3:hover > .head Range operator: #foreach ( $item in [1..3] ) Velocity provides an easy way to get the loop counter so that you can do something like the following: -table -#foreach( $customer in $customerList ) -trtd$foreach.count/tdtd$customer.Name/td/tr -#end -/table +table +#foreach( $customer in $customerList ) +trtd$foreach.count/tdtd$customer.Name/td/tr +#end +/table -Additionally, the maximum allowed number of loop iterations can be controlled engine-wide (an ability introduced in Velocity 1.5). By default, there is no limit: -# The maximum allowed number of loops. -directive.foreach.maxloops = -1 +Additionally, the maximum allowed number of loop iterations can be controlled engine-wide with velocity.properties. By default, there is no limit: +# The maximum allowed number of loops. +directive.foreach.maxloops = -1 @@ -484,12 +484,12 @@ directive.foreach.maxloops = -1 [ VM VTL code... ] - Any valid VTL code, anything you can put into a template, can be put into a VM. Once defined, the VM is used like any other VTL directive in a template. -#vmname( $arg1 $arg2 ) +#vmname( $arg1 $arg2 ) Except, that when you wish to call a VM with a body, then you must prefix the name of the VM with @. The content of that body may be referenced in the macro definition via $!bodyContent as many or few times as you like. -#@vmname( $arg1 $arg2 ) here is the body#end +#@vmname( $arg1 $arg2 ) here is the body#end @@ -502,31 +502,31 @@ directive.foreach.maxloops = -1 Comments are not rendered at runtime. Single Line Comments Example: -## This is a comment.** +## This is a comment.** Multi Line Comments Example: -#** - This is a multiline comment. - This is the second line. -*# +#** + This is a multiline comment. + This is the second line. +*# Unparsed Content Unparsed content is rendered at runtime, but is not parsed or interpreted. Example: -#[[ +#[[ -This has invalid syntax that would normally need -poor mans escaping like: +This has invalid syntax that would normally need +poor mans escaping like: - - #define() - - ${blah + - #define() + - ${blah -]]# +]]# Modified: velocity/site/production/engine/devel/webapps.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/webapps.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/devel/webapps.html (original) +++ velocity/site/production/engine/devel/webapps.html Tue Jun 26 10:03:18 2018 @@ -249,33 +249,33 @@ providing a consistent way to mark up te Really, any of the other ResourceLoader implementations out there are preferred, but all the other ResourceLoaders shipped with Velocity Engine will require you to store your templates somewhere besides the standard file system (e.g. in the classpath, in a database, or on a remote server). If that works for you, then great! However, we recognize that these are not convenient for most people's development cycle. The simplest replacement for FileResourceLoader in a web application is actually a part of the VelocityTools project. It is the WebappResourceLoader This ResourceLoader implementation is specifically designed to work just like the FileResourceLoader, but it is aware of the servlet context and allows you to configure resource paths relative to the servlet root, rather than the local file system. If you are using the VelocityViewServlet, then it is automatically configured and ready to use the WebappResourceLoader. So if you want to change the configured path(s), you need only add a line like the following to your velocity.properties: -webapp.resource.loader.path=/WEB-INF/mytemplates/ +webapp.resource.loader.path=/WEB-INF/mytemplates/ If you need to set the WebappResourceLoader up on your own, then you can make your properties something like this: -resource.loader=webapp -webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader -webapp.resource.loader.path=/WEB-INF/mytemplates/ +resource.loader=webapp +webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader +webapp.resource.loader.path=/WEB-INF/mytemplates/ You will also need to put the ServletContext into your VelocityEngine's application attributes before initializing that Engine. This is how the WebappResourceLoader knows how to find templates.
svn commit: r1834410 [6/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/devel/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/user-guide.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/devel/user-guide.html (original) +++ velocity/site/production/engine/devel/user-guide.html Tue Jun 26 10:03:18 2018 @@ -312,22 +312,22 @@ h2:hover > .headerlink, h3:hover > .head Velocity makes it easy to customize web pages to your online visitors. As a web site designer at The Mud Room, you want to make the web page that the customer will see after logging into your site. You meet with software engineers at your company, and everyone has agreed that $customer will hold information pertaining to the customer currently logged in, that $mudsOnSpecial will be all the types mud on sale at present. The $flogger object contains methods that help with promotion. For the task at hand, let's concern ourselves only with these three references. Remember, you don't need to worry about how the software engineers extract the necessary information from the database, you just need to know that it works. This lets you get on with your job, and lets the software engineers get on with theirs. You could embed the following VTL statement in the web page: -html - body -Hello $customer.Name! -table -#foreach( $mud in $mudsOnSpecial ) - #if ( $customer.hasPurchased($mud) ) -tr - td -$flogger.getPromo( $mud ) - /td -/tr - #end -#end -/table - /body -/html +html + body +Hello $customer.Name! +table +#foreach( $mud in $mudsOnSpecial ) + #if ( $customer.hasPurchased($mud) ) +tr + td +$flogger.getPromo( $mud ) + /td +/tr + #end +#end +/table + /body +/html @@ -336,7 +336,7 @@ h2:hover > .headerlink, h3:hover > .head Velocity Template Language (VTL): An Introduction The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page. Even a web page developer with little or no programming experience should soon be capable of using VTL to incorporate dynamic content in a web site. VTL uses references to embed dynamic content in a web site, and a variable is one type of reference. Variables are one type of reference that can refer to something defined in the Java code, or it can get its value from a VTL statement in the web page itself. Here is an example of a VTL statement that could be embedded in an HTML document: -#set( $a = Velocity ) +#set( $a = Velocity ) @@ -347,12 +347,12 @@ h2:hover > .headerlink, h3:hover > .head In the example above, #set is used to assign a value to a variable. The variable, $a, can then be used in the template to output "Velocity". Hello Velocity World! Once a value has been assigned to a variable, you can reference the variable anywhere in your HTML document. In the following example, a value is assigned to $foo and later referenced. -html - body - #set( $foo = Velocity ) - Hello $foo World! - /body -/html +html + body + #set( $foo = Velocity ) + Hello $foo World! + /body +/html @@ -360,44 +360,44 @@ h2:hover > .headerlink, h3:hover > .head To make statements containing VTL directives more readable, we encourage you to start each VTL statement on a new line, although you are not required to do so. The set directive will be revisited in greater detail later on. Comments Comments allows descriptive text to be included that is not placed into the output of the template engine. Comments are a useful way of reminding yourself and explaining to others what your VTL statements are doing, or any other purpose you find useful. Below is an example of a comment in VTL. -## This is a single line comment. +## This is a single line comment. A single line comment begins with ## and finishes at the end of the line. If you're going to write a few lines of commentary, there's no need to have numerous single line comments. Multi-line comments, which begin with # and end with #, are available to handle this scenario. -This is text that is outside the multi-line comment. -Online visitors can see it. +This is text that is outside the multi-line comment. +Online visitors can see it. -#* - Thus begins a multi-line comment. Online visitors wont - see this text because the Velocity Templating Engine will - ignore it. -*# +#* + Thus begins a multi-line comment. Online visitors wont + see this text because the Velocity Templating Engine will + ignore it. +*# -Here is text outside the multi-line comment; it is visible. +Here is text outside the multi-line comment; it is visible. Here are a few examples to clarify how single line and multi-line comments work: -This text is visible. ## This text is not. -This
svn commit: r1834410 [4/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/2.0/vtl-reference.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/vtl-reference.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/vtl-reference.html (original) +++ velocity/site/production/engine/2.0/vtl-reference.html Tue Jun 26 10:03:18 2018 @@ -400,17 +400,17 @@ h2:hover > .headerlink, h3:hover > .head Range operator: #foreach ( $item in [1..3] ) Velocity provides an easy way to get the loop counter so that you can do something like the following: -table -#foreach( $customer in $customerList ) -trtd$foreach.count/tdtd$customer.Name/td/tr -#end -/table +table +#foreach( $customer in $customerList ) +trtd$foreach.count/tdtd$customer.Name/td/tr +#end +/table -Additionally, the maximum allowed number of loop iterations can be controlled engine-wide (an ability introduced in Velocity 1.5). By default, there is no limit: -# The maximum allowed number of loops. -directive.foreach.maxloops = -1 +Additionally, the maximum allowed number of loop iterations can be controlled engine-wide with velocity.properties. By default, there is no limit: +# The maximum allowed number of loops. +directive.foreach.maxloops = -1 @@ -484,12 +484,12 @@ directive.foreach.maxloops = -1 [ VM VTL code... ] - Any valid VTL code, anything you can put into a template, can be put into a VM. Once defined, the VM is used like any other VTL directive in a template. -#vmname( $arg1 $arg2 ) +#vmname( $arg1 $arg2 ) Except, that when you wish to call a VM with a body, then you must prefix the name of the VM with @. The content of that body may be referenced in the macro definition via $!bodyContent as many or few times as you like. -#@vmname( $arg1 $arg2 ) here is the body#end +#@vmname( $arg1 $arg2 ) here is the body#end @@ -502,31 +502,31 @@ directive.foreach.maxloops = -1 Comments are not rendered at runtime. Single Line Comments Example: -## This is a comment.** +## This is a comment.** Multi Line Comments Example: -#** - This is a multiline comment. - This is the second line. -*# +#** + This is a multiline comment. + This is the second line. +*# Unparsed Content Unparsed content is rendered at runtime, but is not parsed or interpreted. Example: -#[[ +#[[ -This has invalid syntax that would normally need -poor mans escaping like: +This has invalid syntax that would normally need +poor mans escaping like: - - #define() - - ${blah + - #define() + - ${blah -]]# +]]# Modified: velocity/site/production/engine/2.0/webapps.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/webapps.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/webapps.html (original) +++ velocity/site/production/engine/2.0/webapps.html Tue Jun 26 10:03:18 2018 @@ -249,33 +249,33 @@ providing a consistent way to mark up te Really, any of the other ResourceLoader implementations out there are preferred, but all the other ResourceLoaders shipped with Velocity Engine will require you to store your templates somewhere besides the standard file system (e.g. in the classpath, in a database, or on a remote server). If that works for you, then great! However, we recognize that these are not convenient for most people's development cycle. The simplest replacement for FileResourceLoader in a web application is actually a part of the VelocityTools project. It is the WebappResourceLoader This ResourceLoader implementation is specifically designed to work just like the FileResourceLoader, but it is aware of the servlet context and allows you to configure resource paths relative to the servlet root, rather than the local file system. If you are using the VelocityViewServlet, then it is automatically configured and ready to use the WebappResourceLoader. So if you want to change the configured path(s), you need only add a line like the following to your velocity.properties: -webapp.resource.loader.path=/WEB-INF/mytemplates/ +webapp.resource.loader.path=/WEB-INF/mytemplates/ If you need to set the WebappResourceLoader up on your own, then you can make your properties something like this: -resource.loader=webapp -webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader -webapp.resource.loader.path=/WEB-INF/mytemplates/ +resource.loader=webapp +webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader +webapp.resource.loader.path=/WEB-INF/mytemplates/ You will also need to put the ServletContext into your VelocityEngine's application attributes before initializing that Engine. This is how the WebappResourceLoader knows how to find templates.
svn commit: r1834410 [8/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/tools/devel/view-layoutservlet.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/view-layoutservlet.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/tools/devel/view-layoutservlet.html (original) +++ velocity/site/production/tools/devel/view-layoutservlet.html Tue Jun 26 10:03:18 2018 @@ -214,36 +214,36 @@ h2:hover > .headerlink, h3:hover > .head org.apache.velocity.tools.view.servlet.VelocityLayoutServlet Configuration Settings Three settings can be added to velocity.properties to control the VLS, or the following default values will be used: -# Filepath for error template, -# relative to web application root directory -tools.view.servlet.error.template = Error.vm - -# Directory for layout templates, -# relative to web application root directory -tools.view.servlet.layout.directory = layout/ - -# Filepath of the default layout template -# relative to the layout directory -# NOT relative to the root directory of the webapp! -tools.view.servlet.layout.default.template = Default.vm/sourcecode/pre +# Filepath for error template, +# relative to web application root directory +tools.view.servlet.error.template = Error.vm + +# Directory for layout templates, +# relative to web application root directory +tools.view.servlet.layout.directory = layout/ + +# Filepath of the default layout template +# relative to the layout directory +# NOT relative to the root directory of the webapp! +tools.view.servlet.layout.default.template = Default.vm/sourcecode/pre Layouts Now, in your layout templates, the only thing you really need is the screen content reference. So an acceptable layout template could be: -$screen_content +$!screen_content ...but that would make this whole thing an idiotic waste of time. At the least, you'll probably want to do something along these lines: -html -head - title$!page_title/title -/head -body - $screen_content -/body -/html +html +head + title$!page_title/title +/head +body + $screen_content +/body +/html @@ -251,62 +251,59 @@ tools.view.servlet.layout.default.templa Alternative Layouts VLS provides two ways to specify an alternate template for a requested page: - -Specify the layout in the request parameters +Specify the layout in the request parameters + Just add the query string "layout=MyOtherLayout.vm" to any request params and the VLS will find it and render your screen within that layout instead of the default layout. It don't matter how you get the layout param into the query data, only that it's there. - - -Specify the layout in the requested screen. - + +Specify the layout in the requested screen. In the requested screen, put a line like this: -#set( $layout = MyOtherLayout.vm ) - -This will direct the VLS to use MyOtherLayout.vm instead of Default.vm. *Setting the layout in this fashion will override any layout set by the request parameters.* +#set( $layout = MyOtherLayout.vm ) +This will direct the VLS to use "MyOtherLayout.vm" instead of "Default.vm". Setting the layout in this fashion will override any layout set by the request parameters. 'Navigations', 'Tiles', and How Those of you who are (or were) Turbine or Struts users will probably want to do more than just set the layout and screen content. You want to include arbitrary "tiles" or "navigations", right? Well, thanks to Velocity's built-in #parse directive, this is easy. First, create your "tile" as a separate template file like: -div id=footerI made this!/div +div id=footerI made this!/div For creativity's sake, we'll pretend this code is in a file named "Footer.vm" that is located in the root of my webapp like my other non-layout templates. -html -head - title$!page_title/title -/head -body +html +head + title$!page_title/title +/head +body -$screen_content +$screen_content -#parse(Footer.vm) +#parse(Footer.vm) -/body -/html +/body +/html Easy, eh? Now, what if you have a lot of different "footer" files and you want your screen to decide which one will be used? No problem! Do something like this: -html -head - title$!page_title/title -/head -body +html +head + title$!page_title/title +/head +body -$screen_content +$screen_content -#parse( $screen_footer ) +#parse( $screen_footer ) -/body -/html +/body +/html -and in your screen, just do `#set( $screen_footer = 'FooFooter.vm' ).\ +and in your screen, just do #set( $screen_footer = 'FooFooter.vm' ). Remember, your #parsed footer template will have access to the same velocity context as your layout, which gets the screen's context once the screen is done with it. This lets you set variables for the layout and footer to use from your screens. Error Screen Ok, the idea here is pretty simple. If an uncaught exception or error is thrown at some point during the processing of your screen and
svn commit: r1834410 [2/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/production/engine/2.0/developer-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/developer-guide.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/developer-guide.html (original) +++ velocity/site/production/engine/2.0/developer-guide.html Tue Jun 26 10:03:18 2018 @@ -345,45 +345,45 @@ h2:hover > .headerlink, h3:hover > .head 'Merge' the template and your data to produce the ouput. In code, using the singleton pattern via the org.apache.velocity.app.Velocity class, this looks like -import java.io.StringWriter; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.Template; -import org.apache.velocity.app.Velocity; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.MethodInvocationException; +import java.io.StringWriter; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.MethodInvocationException; -Velocity.init(); +Velocity.init(); -VelocityContext context = new VelocityContext(); +VelocityContext context = new VelocityContext(); -context.put( name, new String(Velocity) ); +context.put( name, new String(Velocity) ); -Template template = null; +Template template = null; try -{ - template = Velocity.getTemplate(mytemplate.vm); -} -catch( ResourceNotFoundException rnfe ) -{ - // couldnt find the template -} -catch( ParseErrorException pee ) -{ - // syntax error: problem parsing the template -} -catch( MethodInvocationException mie ) -{ - // something invoked in the template - // threw an exception -} -catch( Exception e ) -{} +{ + template = Velocity.getTemplate(mytemplate.vm); +} +catch( ResourceNotFoundException rnfe ) +{ + // couldnt find the template +} +catch( ParseErrorException pee ) +{ + // syntax error: problem parsing the template +} +catch( MethodInvocationException mie ) +{ + // something invoked in the template + // threw an exception +} +catch( Exception e ) +{} -StringWriter sw = new StringWriter(); +StringWriter sw = new StringWriter(); -template.merge( context, sw ); +template.merge( context, sw ); @@ -392,60 +392,60 @@ h2:hover > .headerlink, h3:hover > .head Developers have two options for using the Velocity engine, the singleton model and the separate instance model. The same core Velocity code is used for both approaches, which are provided to make Velocity easier to integrate into your Java application. Singleton Model This is the legacy pattern, where there is only one instance of the Velocity engine in the JVM (or web application, depending) that is shared by all. This is very convenient as it allows localized configuration and sharing of resources. For example, this is a very appropriate model for use in a Servlet 2.2+ compliant web application as each web application can have its own instance of Velocity, allowing that web application's servlet to share resources like templates, a logger, etc. The singleton is accessable via the org.apache.velocity.app.Velocity class, and and example of use: -import org.apache.velocity.app.Velocity; -import org.apache.velocity.Template; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.Template; ... -/* - * Configure the engine - */ - -Velocity.setProperty( -Velocity.RUNTIME_LOG_NAME, mylog); - -/* - * now initialize the engine - */ +/* + * Configure the engine + */ + +Velocity.setProperty( +Velocity.RUNTIME_LOG_NAME, mylog); + +/* + * now initialize the engine + */ -Velocity.init(); +Velocity.init(); ... -Template t = Velocity.getTemplate(foo.vm); +Template t = Velocity.getTemplate(foo.vm); Separate Instance New in version 1.2, the separate instance allows you to create, configure and use as many instances of Velocity as you wish in the same JVM (or web application.) This is useful when you wish to support separate configurations, such as template directories, loggers, etc in the same application. To use separate instances, use the org.apache.velocity.app.VelocityEngine class. An example, which parallels the above singleton example, looks like: -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.Template; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.Template; ... -/* - * create a new instance of the engine - */ +/* + * create a new instance of the engine + */ -VelocityEngine ve = new VelocityEngine(); +VelocityEngine ve = new VelocityEngine(); -/* - * configure the engine. In this case, we are using - * a specific logger name - */ +/* + *
svn commit: r1834409 [1/3] - in /velocity/site/cms/trunk/content: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Author: cbrisson Date: Tue Jun 26 10:02:24 2018 New Revision: 1834409 URL: http://svn.apache.org/viewvc?rev=1834409=rev Log: [site] Proper syntax coloring for VTL, Java, XML, ... Modified: velocity/site/cms/trunk/content/engine/2.0/build.mdtext velocity/site/cms/trunk/content/engine/2.0/configuration.mdtext velocity/site/cms/trunk/content/engine/2.0/developer-guide.mdtext velocity/site/cms/trunk/content/engine/2.0/getting-started.mdtext velocity/site/cms/trunk/content/engine/2.0/source-repository.mdtext velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext velocity/site/cms/trunk/content/engine/2.0/webapps.mdtext velocity/site/cms/trunk/content/engine/devel/build.mdtext velocity/site/cms/trunk/content/engine/devel/configuration.mdtext velocity/site/cms/trunk/content/engine/devel/developer-guide.mdtext velocity/site/cms/trunk/content/engine/devel/getting-started.mdtext velocity/site/cms/trunk/content/engine/devel/source-repository.mdtext velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext velocity/site/cms/trunk/content/engine/devel/webapps.mdtext velocity/site/cms/trunk/content/tools/2.0/config-java.mdtext velocity/site/cms/trunk/content/tools/2.0/config-properties.mdtext velocity/site/cms/trunk/content/tools/2.0/config-xml.mdtext velocity/site/cms/trunk/content/tools/2.0/creating-tools.mdtext velocity/site/cms/trunk/content/tools/2.0/standalone.mdtext velocity/site/cms/trunk/content/tools/2.0/upgrading.mdtext velocity/site/cms/trunk/content/tools/2.0/view-layoutservlet.mdtext velocity/site/cms/trunk/content/tools/2.0/view-servlet.mdtext velocity/site/cms/trunk/content/tools/2.0/view-tag.mdtext velocity/site/cms/trunk/content/tools/devel/config-java.mdtext velocity/site/cms/trunk/content/tools/devel/config-properties.mdtext velocity/site/cms/trunk/content/tools/devel/config-xml.mdtext velocity/site/cms/trunk/content/tools/devel/creating-tools.mdtext velocity/site/cms/trunk/content/tools/devel/generic.mdtext velocity/site/cms/trunk/content/tools/devel/standalone.mdtext velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext velocity/site/cms/trunk/content/tools/devel/view-servlet.mdtext velocity/site/cms/trunk/content/tools/devel/view-tag.mdtext Modified: velocity/site/cms/trunk/content/engine/2.0/build.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/2.0/build.mdtext?rev=1834409=1834408=1834409=diff == --- velocity/site/cms/trunk/content/engine/2.0/build.mdtext (original) +++ velocity/site/cms/trunk/content/engine/2.0/build.mdtext Tue Jun 26 10:02:24 2018 @@ -16,6 +16,7 @@ To build Velocity we require [Maven](htt In each case below, it is assumed that you were successful in [downloading](/download.cgi#engine) and unpacking the distribution source or [checking out the sources from Subversion](/download.cgi#source-code-repository): +:::shell svn checkout https://svn.apache.org/repos/asf/velocity/engine/tags/2.0 velocity-2.0 cd velocity-2.0 mvn install Modified: velocity/site/cms/trunk/content/engine/2.0/configuration.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/2.0/configuration.mdtext?rev=1834409=1834408=1834409=diff == --- velocity/site/cms/trunk/content/engine/2.0/configuration.mdtext (original) +++ velocity/site/cms/trunk/content/engine/2.0/configuration.mdtext Tue Jun 26 10:02:24 2018 @@ -152,6 +152,7 @@ The following resource management config > To illustrate, here is an example taken right from the default Velocity > properties, showing how setting up the FileResourceLoader is managed +:::properties resource.loader = file file.resource.loader.description = Velocity File Resource Loader @@ -295,15 +296,18 @@ Configuring the resource loaders for Vel The first step in configuring one or more resource loaders is do 'declare' them by name to Velocity. Use the property `resource.loader` and list one or more loader names. You can use anything you want - these names are used to associate configuration properties with a given loader. +:::properties resource.loader = file That entry declares that we will have a resource loader known as 'file'. The next thing to do is to set the important properties. The most critical is to declare the class to use as the loader: +:::properties file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader In this case, we are telling velocity that we are setting up a re
svn commit: r1834410 [1/8] - in /velocity/site/production: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Author: cbrisson Date: Tue Jun 26 10:03:18 2018 New Revision: 1834410 URL: http://svn.apache.org/viewvc?rev=1834410=rev Log: [site] Proper syntax coloring for VTL, Java, XML, ... => into prod Modified: velocity/site/production/engine/2.0/build.html velocity/site/production/engine/2.0/configuration.html velocity/site/production/engine/2.0/developer-guide.html velocity/site/production/engine/2.0/source-repository.html velocity/site/production/engine/2.0/user-guide.html velocity/site/production/engine/2.0/vtl-reference.html velocity/site/production/engine/2.0/webapps.html velocity/site/production/engine/devel/build.html velocity/site/production/engine/devel/configuration.html velocity/site/production/engine/devel/developer-guide.html velocity/site/production/engine/devel/source-repository.html velocity/site/production/engine/devel/user-guide.html velocity/site/production/engine/devel/vtl-reference.html velocity/site/production/engine/devel/webapps.html velocity/site/production/tools/2.0/config-java.html velocity/site/production/tools/2.0/config-properties.html velocity/site/production/tools/2.0/creating-tools.html velocity/site/production/tools/2.0/standalone.html velocity/site/production/tools/2.0/view-layoutservlet.html velocity/site/production/tools/2.0/view-servlet.html velocity/site/production/tools/2.0/view-tag.html velocity/site/production/tools/devel/config-java.html velocity/site/production/tools/devel/config-properties.html velocity/site/production/tools/devel/creating-tools.html velocity/site/production/tools/devel/generic.html velocity/site/production/tools/devel/standalone.html velocity/site/production/tools/devel/view-layoutservlet.html velocity/site/production/tools/devel/view-servlet.html velocity/site/production/tools/devel/view-tag.html Modified: velocity/site/production/engine/2.0/build.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/build.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/build.html (original) +++ velocity/site/production/engine/2.0/build.html Tue Jun 26 10:03:18 2018 @@ -232,7 +232,7 @@ h2:hover > .headerlink, h3:hover > .head Building In each case below, it is assumed that you were successful in downloading and unpacking the distribution source or checking out the sources from Subversion: svn checkout https://svn.apache.org/repos/asf/velocity/engine/tags/2.0 velocity-2.0 -cd velocity-2.0 +cd velocity-2.0 mvn install Modified: velocity/site/production/engine/2.0/configuration.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/configuration.html?rev=1834410=1834409=1834410=diff == --- velocity/site/production/engine/2.0/configuration.html (original) +++ velocity/site/production/engine/2.0/configuration.html Tue Jun 26 10:03:18 2018 @@ -386,13 +386,13 @@ h2:hover > .headerlink, h3:hover > .head This is the number of seconds between modification checks when caching is turned on. When this is an integer 0, this represents the number of seconds between checks to see if the template was modified. If the template has been modified since last check, then it is reloaded and reparsed. Otherwise nothing is done. When = 0, no modification checks will take place, and assuming that the property cache (above) is true, once a template is loaded and parsed the first time it is used, it will not be checked or reloaded after that until the application or servlet engine is restarted. To illustrate, here is an example taken right from the default Velocity properties, showing how setting up the FileResourceLoader is managed -resource.loader = file +resource.loader = file -file.resource.loader.description = Velocity File Resource Loader -file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader -file.resource.loader.path = . -file.resource.loader.cache = false -file.resource.loader.modificationCheckInterval = 2 +file.resource.loader.description = Velocity File Resource Loader +file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader +file.resource.loader.path = . +file.resource.loader.cache = false +file.resource.loader.modificationCheckInterval = 2 @@ -521,76 +521,76 @@ file.resource.loader.modificationCheckIn Configuration Examples Configuring the resource loaders for Velocity is straightforward. The properties that control the are listed in the resource configuration section, for further reference. The first step in configuring one or more resource loaders is do 'declare' them by name to Velocity. Use the property resource.loader and list one or more loader names. You can use anything you want - these
svn commit: r1834409 [3/3] - in /velocity/site/cms/trunk/content: engine/2.0/ engine/devel/ tools/2.0/ tools/devel/
Modified: velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext?rev=1834409=1834408=1834409=diff == --- velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext Tue Jun 26 10:02:24 2018 @@ -16,6 +16,7 @@ For custom objects refering directly to Default tools aren't loaded anymore in velocity-tools-view. To load them, you must enable default loading from your `WEB-INF/web.xml` file: +:::xml org.apache.velocity.tools.loadDefaults true @@ -23,6 +24,7 @@ Default tools aren't loaded anymore in v or do the same for a specific servlet inside its `` tag: +::xml org.apache.velocity.tools.loadDefaults true @@ -98,6 +100,7 @@ If you do need a configuration, you shou If you are largely happy with the default tools.xml configuration, but wish to override just a few parts, you can override them with your own file. Tool configurations are key-centric. If you just want to provide a different default format for the [DateTool](apidocs/org/apache/velocity/tools/generic/DateTool.html) and a second bundle for the ResourceTool, your tools.xml can be just: +::xml Modified: velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext?rev=1834409=1834408=1834409=diff == --- velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext Tue Jun 26 10:02:24 2018 @@ -14,6 +14,7 @@ Since this class is an extension of the Three settings can be added to velocity.properties to control the VLS, or the following default values will be used: +:::properties # Filepath for error template, # relative to web application root directory tools.view.servlet.error.template = Error.vm @@ -32,11 +33,12 @@ Three settings can be added to velocity. Now, in your layout templates, the only thing you really need is the screen content reference. So an acceptable layout template could be: -$screen_content - +:::velocity +$!screen_content ...but that would make this whole thing an idiotic waste of time. At the least, you'll probably want to do something along these lines: +::html+velocity $!page_title @@ -54,15 +56,16 @@ VLS provides two ways to specify an alte 1. **Specify the layout in the request parameters** -Just add the query string "layout=MyOtherLayout.vm" to any request params and the VLS will find it and render your screen within that layout instead of the default layout. It don't matter how you get the layout param into the query data, only that it's there. +Just add the query string "layout=MyOtherLayout.vm" to any request params and the VLS will find it and render your screen within that layout instead of the default layout. It don't matter how you get the layout param into the query data, only that it's there. 2. **Specify the layout in the requested screen.** - In the requested screen, put a line like this: - -#set( $layout = "MyOtherLayout.vm" ) - -This will direct the VLS to use "MyOtherLayout.vm" instead of "Default.vm". *Setting the layout in this fashion will override any layout set by the request parameters.* +In the requested screen, put a line like this: + +:::velocity +#set( $layout = "MyOtherLayout.vm" ) + +This will direct the VLS to use "MyOtherLayout.vm" instead of "Default.vm". *Setting the layout in this fashion will override any layout set by the request parameters.* ## 'Navigations', 'Tiles', and How @@ -70,10 +73,12 @@ Those of you who are (or were) Turbine o First, create your "tile" as a separate template file like: +:::html I made this! For creativity's sake, we'll pretend this code is in a file named "Footer.vm" that is located in the root of my webapp like my other non-layout templates. +:::html+velocity $!page_title @@ -91,6 +96,7 @@ Easy, eh? Now, what if you have a lot of different "footer" files and you want your screen to decide which one will be used? No problem! Do something like this: +:::html+velocity $!page_title @@ -104,7 +110,7 @@ Now, what if you have a lot of different -and in your screen, just do `#set( $screen_footer = 'FooFooter.vm' ).\ +and in your screen, just do `#set( $screen_footer = 'FooFooter.vm' )`. Remember, your #parsed footer template will have access to the same velocity context as your layout, which gets the screen's context once
svn commit: r1834413 - /velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext
Author: cbrisson Date: Tue Jun 26 10:21:05 2018 New Revision: 1834413 URL: http://svn.apache.org/viewvc?rev=1834413=rev Log: [site/tools] Update VelocityLayoutServlet doc Modified: velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext Modified: velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext?rev=1834413=1834412=1834413=diff == --- velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/view-layoutservlet.mdtext Tue Jun 26 10:21:05 2018 @@ -52,13 +52,24 @@ This saves you the trouble of doing the ## Alternative Layouts -VLS provides two ways to specify an alternate template for a requested page: +VLS provides several ways to specify an alternate template for a requested page: -1. **Specify the layout in the request parameters** - -Just add the query string "layout=MyOtherLayout.vm" to any request params and the VLS will find it and render your screen within that layout instead of the default layout. It don't matter how you get the layout param into the query data, only that it's there. +1. **Specify the layout in the request attribute** -2. **Specify the layout in the requested screen.** +:::java +request.setAttribute("layout", "MyOtherLayout.vm"); + +2. **Specify the layout by overloading the `VelocityLayoutServlet.findLayout(HttpServletRequest)` function** + +:::java +@Override +public String findLayout(HttpServletRequest request) +{ +if (request.getParameter("change_layout") != null) return "MyOtherLayout.vm"; +else return super.findLayout(request) +} + +3. **Specify the layout in the requested screen.** In the requested screen, put a line like this:
svn commit: r1834414 - /velocity/site/production/tools/devel/view-layoutservlet.html
Author: cbrisson Date: Tue Jun 26 10:21:36 2018 New Revision: 1834414 URL: http://svn.apache.org/viewvc?rev=1834414=rev Log: [site/tools] Update VelocityLayoutServlet doc => prod Modified: velocity/site/production/tools/devel/view-layoutservlet.html Modified: velocity/site/production/tools/devel/view-layoutservlet.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/view-layoutservlet.html?rev=1834414=1834413=1834414=diff == --- velocity/site/production/tools/devel/view-layoutservlet.html (original) +++ velocity/site/production/tools/devel/view-layoutservlet.html Tue Jun 26 10:21:36 2018 @@ -249,13 +249,30 @@ h2:hover > .headerlink, h3:hover > .head This saves you the trouble of doing the basic ,, and tags in every single screen. That's the point of layouts: to save effort and eliminate redundancy. Note that this still lets the inner screen control the title of the page. This works because the layout template is blessed by the VLS with access to the same context as the screen after the screen is done with it. Just do a #set( $page_title = "Hello" ) in the screen. Alternative Layouts -VLS provides two ways to specify an alternate template for a requested page: +VLS provides several ways to specify an alternate template for a requested page: -Specify the layout in the request parameters - -Just add the query string "layout=MyOtherLayout.vm" to any request params and the VLS will find it and render your screen within that layout instead of the default layout. It don't matter how you get the layout param into the query data, only that it's there. - -Specify the layout in the requested screen. + +Specify the layout in the request attribute +request.setAttribute(layout, MyOtherLayout.vm); + + + + + +Specify the layout by overloading the VelocityLayoutServlet.findLayout(HttpServletRequest) function +@Override +public String findLayout(HttpServletRequest request) +{ +if (request.getParameter(change_layout) != null) return MyOtherLayout.vm; +else return super.findLayout(request) +} + + + + + +Specify the layout in the requested screen. + In the requested screen, put a line like this: #set( $layout = MyOtherLayout.vm )
svn commit: r1834420 - in /velocity/site/cms/trunk/content: README css/site.css site-building.mdtext
Author: cbrisson Date: Tue Jun 26 12:11:54 2018 New Revision: 1834420 URL: http://svn.apache.org/viewvc?rev=1834420=rev Log: [site] Supress redundant README and update site building page Removed: velocity/site/cms/trunk/content/README Modified: velocity/site/cms/trunk/content/css/site.css velocity/site/cms/trunk/content/site-building.mdtext Modified: velocity/site/cms/trunk/content/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/css/site.css?rev=1834420=1834419=1834420=diff == --- velocity/site/cms/trunk/content/css/site.css (original) +++ velocity/site/cms/trunk/content/css/site.css Tue Jun 26 12:11:54 2018 @@ -278,6 +278,13 @@ pre, code padding: 3px 3px; } +.grayed +{ +color: darkgray; +font-style: italic; +text-decoration: strike-though; +} + /* tables */ table.standard, table.table Modified: velocity/site/cms/trunk/content/site-building.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/site-building.mdtext?rev=1834420=1834419=1834420=diff == --- velocity/site/cms/trunk/content/site-building.mdtext (original) +++ velocity/site/cms/trunk/content/site-building.mdtext Tue Jun 26 12:11:54 2018 @@ -2,7 +2,7 @@ Title: Apache Velocity - Site Building ## the Apache Velocity Site -WARNING! This document might be out of date! For the latest information on how to build the Apache Velocity Site, please check out the actual [README](/README) file which contains the latest information. This document has been created from the README and is not updated as often. +[TOC] ### Introduction @@ -20,14 +20,20 @@ Apache Velocity uses the [Apache Content For the time being, the site is not yet *hosted* by the CMS (which is not yet accepting new sites before undergoing a machine transition), so the site still has to be build locally. Please refer to the next section. The rest of this section is *not yet applicable*. To just edit one page, all you need is the bookmarklet found [here](https://cms.apache.org/#bookmark) +{.grayed} If you're a commiter, you'll be able to push your edits by yourself on the production site. Otherwise, the CMS will let you generate a diff file that you can [send to the devs](/contact.html). +{.grayed} Commiters can also commit changes to [the site under svn](http://svn.apache.org/repos/asf/velocity/site/cms/trunk/) and trigger a publication in production from the CMS. +{.grayed} ### Building the Site -To build the site locally, you'll need a local checkout of the [Apache CMS](https://svn.apache.org/repos/infra/websites/cms) (check the [STATUS](https://svn.apache.org/repos/infra/websites/cms/STATUS) file) and of course a local checkout of [Velocity's site sources](https://svn.apache.org/repos/asf/velocity/site). +To build the site locally, you'll need a local checkout of the [Apache CMS](https://svn.apache.org/repos/infra/websites/cms), then refer to the [STATUS](https://svn.apache.org/repos/infra/websites/cms/STATUS) file. +You'll of course also need a local checkout of [the site sources](https://svn.apache.org/repos/asf/velocity/site) (the sources for the cms are in /cms/, but the process needs the whole site). + +While Velocity isn't yet hosted on the CMS, you'll have to generate the site in velocity/site/production, then check added/modified/deleted files with `svn status`, and commit the result. Typically, you'll have to: @@ -58,8 +64,39 @@ Here's a bash script that you can reuse: svn status $VELOCITY/site/production/ +Notes: + +* the markdown tables extension, in the python-markdown package (python 2.7), seems broken at version 2.6.9 ; I had to revert the markdown package to 2.6.7. +* the python pygments lexer (used by markdown/codehilite for code syntax highlighting) knows about the Velocity syntax, but not about silent references like `$!foo` or `$!{bar}`. I patched it and sent the [patch](https://bitbucket.org/birkenfeld/pygments-main/pull-requests/771/add-velocity-silent-references-syntax/diff) upstream. + ### Additional Notes + Table of Content + +Per-page table of contents can be displayed with the following placeholder: + +[TOC] + + Tables + +Tables are supported. See the documentation of the [python-markdown](https://python-markdown.github.io/extensions/tables/) extension. + + Syntax highlighting + +The markdown module used by the CMS allows one to specify which language lexer to use for syntax coloring of blocks of code, using the following syntax: + + :::velocity + #set( $foo = 'bar' ) + ... + +which produces: + +:::velocity +#set( $foo = 'bar' ) + ... + +There are many lexers available, among which :::java, :::html, :::xml, :::properties, :::velocity, :::html+velocity, :::xml+velocity, etc. + Breadcrumbs Breadcrumbs use
svn commit: r1834421 - in /velocity/site/production: README css/site.css site-building.html
Author: cbrisson Date: Tue Jun 26 12:13:08 2018 New Revision: 1834421 URL: http://svn.apache.org/viewvc?rev=1834421=rev Log: [site] Supress redundant README and update site building page => prod Removed: velocity/site/production/README Modified: velocity/site/production/css/site.css velocity/site/production/site-building.html Modified: velocity/site/production/css/site.css URL: http://svn.apache.org/viewvc/velocity/site/production/css/site.css?rev=1834421=1834420=1834421=diff == --- velocity/site/production/css/site.css (original) +++ velocity/site/production/css/site.css Tue Jun 26 12:13:08 2018 @@ -278,6 +278,13 @@ pre, code padding: 3px 3px; } +.grayed +{ +color: darkgray; +font-style: italic; +text-decoration: strike-though; +} + /* tables */ table.standard, table.table Modified: velocity/site/production/site-building.html URL: http://svn.apache.org/viewvc/velocity/site/production/site-building.html?rev=1834421=1834420=1834421=diff == --- velocity/site/production/site-building.html (original) +++ velocity/site/production/site-building.html Tue Jun 26 12:13:08 2018 @@ -225,7 +225,26 @@ h2:hover > .headerlink, h3:hover > .head } h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible } the Apache Velocity Site -WARNING! This document might be out of date! For the latest information on how to build the Apache Velocity Site, please check out the actual README file which contains the latest information. This document has been created from the README and is not updated as often. + + +the Apache Velocity Site +Introduction +Editing the Site +Building the Site +Additional Notes +Table of Content +Tables +Syntax highlighting +Breadcrumbs +Left Navigation +Post-Processing + + + + +TODO + + Introduction The Apache Velocity Site is what you get when you visit our homepage. It is the envelope site for all Apache Velocity sub projects. In short: This svn repository is only interesting for you if you @@ -236,11 +255,16 @@ h2:hover > .headerlink, h3:hover > .head Editing the Site Apache Velocity uses the http://www.apache.org/dev/cms.html;>Apache Content Management System to manage its site. For the time being, the site is not yet hosted by the CMS (which is not yet accepting new sites before undergoing a machine transition), so the site still has to be build locally. Please refer to the next section. The rest of this section is not yet applicable. -To just edit one page, all you need is the bookmarklet found https://cms.apache.org/#bookmark;>here -If you're a commiter, you'll be able to push your edits by yourself on the production site. Otherwise, the CMS will let you generate a diff file that you can send to the devs. -Commiters can also commit changes to http://svn.apache.org/repos/asf/velocity/site/cms/trunk/;>the site under svn and trigger a publication in production from the CMS. +To just edit one page, all you need is the bookmarklet found https://cms.apache.org/#bookmark;>here + +If you're a commiter, you'll be able to push your edits by yourself on the production site. Otherwise, the CMS will let you generate a diff file that you can send to the devs. + +Commiters can also commit changes to http://svn.apache.org/repos/asf/velocity/site/cms/trunk/;>the site under svn and trigger a publication in production from the CMS. + Building the Site -To build the site locally, you'll need a local checkout of the https://svn.apache.org/repos/infra/websites/cms;>Apache CMS (check the https://svn.apache.org/repos/infra/websites/cms/STATUS;>STATUS file) and of course a local checkout of https://svn.apache.org/repos/asf/velocity/site;>Velocity's site sources. +To build the site locally, you'll need a local checkout of the https://svn.apache.org/repos/infra/websites/cms;>Apache CMS, then refer to the https://svn.apache.org/repos/infra/websites/cms/STATUS;>STATUS file. +You'll of course also need a local checkout of https://svn.apache.org/repos/asf/velocity/site;>the site sources (the sources for the cms are in /cms/, but the process needs the whole site). +While Velocity isn't yet hosted on the CMS, you'll have to generate the site in velocity/site/production, then check added/modified/deleted files with svn status, and commit the result. Typically, you'll have to: define the environment variable MARKDOWN_SOCKET to something like /tmp/markdown @@ -288,7 +312,32 @@ svn status $VELOCITY +Notes: + +the markdown tables extension, in the python-markdown package (python 2.7), seems broken at version 2.6.9 ; I had to revert the markdown package to 2.6.7. +the python pygments lexer (u
svn commit: r1833963 - in /velocity/site/production/tools/devel/apidocs: ./ org/apache/velocity/tools/ org/apache/velocity/tools/class-use/ org/apache/velocity/tools/config/ org/apache/velocity/tools/
Author: cbrisson Date: Thu Jun 21 00:27:32 2018 New Revision: 1833963 URL: http://svn.apache.org/viewvc?rev=1833963=rev Log: [site] Push tools/devel javadocs to production [This commit notification would consist of 120 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
svn commit: r1833960 - /velocity/tools/trunk/src/changes/changes.xml
Author: cbrisson Date: Thu Jun 21 00:01:18 2018 New Revision: 1833960 URL: http://svn.apache.org/viewvc?rev=1833960=rev Log: [tools] upgrade changes Modified: velocity/tools/trunk/src/changes/changes.xml Modified: velocity/tools/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/changes/changes.xml?rev=1833960=1833959=1833960=diff == --- velocity/tools/trunk/src/changes/changes.xml (original) +++ velocity/tools/trunk/src/changes/changes.xml Thu Jun 21 00:01:18 2018 @@ -25,6 +25,18 @@ + +Drop undocumented autoloaded tools feature, and have org.apache.velocity.tools.loadDefaults default to false + + +Make tools-view initialization much pickier about file accesses, to ease the use of a Java SecurityManager + + +Fixed BrowserTool Accept-Language header parsing + + +Added new $conv.toList(obj) method + Added $browser.IPAddress
svn commit: r1833961 - in /velocity/site/cms/trunk/content/tools/devel: frameworks.mdtext upgrading.mdtext view-servlet.mdtext
Author: cbrisson Date: Thu Jun 21 00:07:30 2018 New Revision: 1833961 URL: http://svn.apache.org/viewvc?rev=1833961=rev Log: [site] Document recent changes Modified: velocity/site/cms/trunk/content/tools/devel/frameworks.mdtext velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext velocity/site/cms/trunk/content/tools/devel/view-servlet.mdtext Modified: velocity/site/cms/trunk/content/tools/devel/frameworks.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/frameworks.mdtext?rev=1833961=1833960=1833961=diff == --- velocity/site/cms/trunk/content/tools/devel/frameworks.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/frameworks.mdtext Thu Jun 21 00:07:30 2018 @@ -12,28 +12,28 @@ VelocityTools is not meant to be a frame ### Configuring -[VelocityView](apidocs/org/apache/velocity/tools/view/VelocityView.html) supports the following configuration parameters as s in web.xml: +[VelocityView](apidocs/org/apache/velocity/tools/view/VelocityView.html) supports the following configuration parameters as application s or as specific servlet s in web.xml: -org.apache.velocity.toolbox +**org.apache.velocity.toolbox** : Path and name of the toolbox configuration file. The path must be relative to the web application root directory. If this parameter is not found, the servlet will check for a toolbox file at `/WEB-INF/tools.xml`. -org.apache.velocity.properties +**org.apache.velocity.properties** : Path and name of the Velocity configuration file. The path must be relative to the web application root directory. If this parameter is not present, Velocity will check for a properties file at `/WEB-INF/velocity.properties`. If no file is found there, then Velocity is initialized with the settings in the classpath at `org.apache.velocity.tools.view.velocity.properties`. -org.apache.velocity.tools.deprecationSupportMode +**org.apache.velocity.tools.deprecationSupportMode** : Tells VelocityView whether or not it should : + support old tools that rely on init(Object) methods, : + look for and translate old toolbox.xml configurations, and : + use the deprecated ChainedContext class instead of ViewToolContext. : By default, this is true, so turn it to false if you want to fully upgrade to the new systems. Also, specific tools may look for and respect the deprecationSupportMode setting (e.g. ValueParser, ResourceTool) to provide old behavior where it has otherwise changed. -org.apache.velocity.tools.loadDefaults -: Tells VelocityView whether or not it should include the default tools.xml configurations provided in the VelocityTools jar(s). This is true by default. +**org.apache.velocity.tools.loadDefaults** +: Tells VelocityView whether or not it should include the default tools.xml configurations provided in the VelocityTools jar(s). This was true by default in 2.0, it's now false by default. -org.apache.velocity.tools.cleanConfiguration +**org.apache.velocity.tools.cleanConfiguration** : Tells VelocityView to test all the tool configurations and remove any invalid ones, rather than allow them to throw errors. This is false by default. -org.apache.velocity.tools.userCanOverwriteTools +**org.apache.velocity.tools.userCanOverwriteTools** : Tells VelocityView to construct the context in such a way that any user-set variables with the same keys as any of the configured tools are given primacy when resolving references. This is true by default, unlike in Tools 1.x. The VelocityView instance is typically the heart of any VelocityTools-using application. It encapsulates all necessary VelocityEngine and ToolboxFactory configuration and provides a simple API for processing templates or other VTL (e.g. VelocityViewTag body content). Modified: velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext?rev=1833961=1833960=1833961=diff == --- velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/upgrading.mdtext Thu Jun 21 00:07:30 2018 @@ -14,6 +14,20 @@ Support for the Struts 1.x tools has bee For custom objects refering directly to the Velocity Engine API, please refer to the [Velocity Engine 2.0 Upgrading section](http://velocity.apache.org/engine/2.0/upgrading.html). +Default tools aren't loaded anymore in velocity-tools-view. To load them, you must enable default loading from your `WEB-INF/web.xml` file: + + + org.apache.velocity.tools.loadDefaults + true + + +or do the same for a specific servlet inside its `` tag: + + + org.apache.velocity.tools.loadDefaults + true + + ## Upgrading to 2.0 VelocityTools 2.0 marks the most significant set
svn commit: r1833962 - /velocity/site/cms/trunk/content/README
Author: cbrisson Date: Thu Jun 21 00:08:09 2018 New Revision: 1833962 URL: http://svn.apache.org/viewvc?rev=1833962=rev Log: [site] Update README for building site Modified: velocity/site/cms/trunk/content/README Modified: velocity/site/cms/trunk/content/README URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/README?rev=1833962=1833961=1833962=diff == --- velocity/site/cms/trunk/content/README (original) +++ velocity/site/cms/trunk/content/README Thu Jun 21 00:08:09 2018 @@ -15,6 +15,8 @@ BUILDING To build the site locally, you need a local checkout of https://svn.apache.org/repos/infra/websites/cms (then refer to the STATUS file). You'll of course also need a local checkout of the site sources, https://svn.apache.org/repos/asf/velocity/site (the sources for the cms are in /cms/, but the process needs the whole site). +Note: the markdown tables extension, in the python-markdown package (python 2.7), seems broken at version 2.6.9 ; I had to revert the markdown package to 2.6.7. + BREADCRUMBS ---
svn commit: r1833898 - in /velocity/tools/trunk: velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/ velocity-tools-generic/src/main/java/org/apache/velocity/tools/ veloc
Author: cbrisson Date: Wed Jun 20 09:21:22 2018 New Revision: 1833898 URL: http://svn.apache.org/viewvc?rev=1833898=rev Log: [tools] Review configuration: * default tools not loaded by default by VelocityView * default config locations not checked if user provided a custom location (for velocity.properties and tools.xml) * dropped autoloading feature Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolManager.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ViewToolManager.java Modified: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml?rev=1833898=1833897=1833898=diff == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml (original) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/web.xml Wed Jun 20 09:21:22 2018 @@ -27,6 +27,10 @@ velocity org.apache.velocity.tools.view.VelocityLayoutServlet + org.apache.velocity.tools.loadDefaults + true + + org.apache.velocity.tools.cleanConfiguration true Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolManager.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolManager.java?rev=1833898=1833897=1833898=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolManager.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolManager.java Wed Jun 20 09:21:22 2018 @@ -48,8 +48,7 @@ public class ToolManager /** * Constructs an instance already configured to use the - * {@link ConfigurationUtils#getAutoLoaded()} configuration - * and any configuration specified via a "org.apache.velocity.tools" + * any configuration specified via a "org.apache.velocity.tools" * system property. */ public ToolManager() @@ -74,16 +73,12 @@ public class ToolManager public void autoConfigure(boolean includeDefaults) { -FactoryConfiguration config = -ConfigurationUtils.getAutoLoaded(includeDefaults); - // look for any specified via system property FactoryConfiguration sys = ConfigurationUtils.findFromSystemProperty(); if (sys != null) { -config.addConfiguration(sys); +configure(sys); } -configure(config); } public void configure(FactoryConfiguration config) Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java?rev=1833898=1833897=1833898=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java Wed Jun 20 09:21:22 2018 @@ -48,12 +48,8 @@ public class ConfigurationUtils { public static final String GENERIC_DEFAULTS_PATH = "/org/apache/velocity/tools/generic/tools.xml"; -public static final String XML_DEFAULTS_PATH = -"/org/apache/velocity/tools/xml/tools.xml"; public static final String VIEW_DEFAULTS_PATH = "/org/apache/velocity/tools/view/tools.xml"; -public static final String STRUTS_DEFAULTS_PATH = -"/org/apache/velocity/tools/struts/tools.xml"; public static final String AUTOLOADED_XML_PATH = "tools.xml"; public static final String AUTOLOADED_PROPS_PATH = "tools.prope
svn commit: r1834426 - /velocity/contribs/
Author: cbrisson Date: Tue Jun 26 12:54:00 2018 New Revision: 1834426 URL: http://svn.apache.org/viewvc?rev=1834426=rev Log: Creates a velocity/contribs versionned directory Added: velocity/contribs/
svn commit: r1834427 - /velocity/contribs/tools/
Author: cbrisson Date: Tue Jun 26 12:54:23 2018 New Revision: 1834427 URL: http://svn.apache.org/viewvc?rev=1834427=rev Log: Creates a velocity/contribs/tools versionned directory Added: velocity/contribs/tools/
svn commit: r1819156 - in /velocity/tools/trunk: src/changes/changes.xml velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java
Author: cbrisson Date: Sat Dec 23 15:17:17 2017 New Revision: 1819156 URL: http://svn.apache.org/viewvc?rev=1819156=rev Log: Added BrowserTool.getIPAddress() Modified: velocity/tools/trunk/src/changes/changes.xml velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Modified: velocity/tools/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/changes/changes.xml?rev=1819156=1819155=1819156=diff == --- velocity/tools/trunk/src/changes/changes.xml (original) +++ velocity/tools/trunk/src/changes/changes.xml Sat Dec 23 15:17:17 2017 @@ -25,6 +25,9 @@ + +Added $browser.IPAddress + Removed deprecated components velocity-tools-uberjar and velocity-tools-assembly Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java?rev=1819156=1819155=1819156=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Sat Dec 23 15:17:17 2017 @@ -49,6 +49,7 @@ import javax.servlet.http.HttpServletReq * Specific rendering engine tests:gecko webKit KHTML trident blink edgeHTML presto * Specific OS tests:windows OSX linux unix BSD android iOS symbian * Languages: preferredLanguageTag (a string like 'en', 'da', 'en-US', ...), preferredLocale (a java Locale) + * IP address: IPAddress * * * Language properties are filtered by the languagesFilter tool param, if present, which is here to specify which languages are acceptable on the server side. @@ -100,6 +101,9 @@ public class BrowserTool extends Browser { private static final long serialVersionUID = 1734529350532353339L; +/* IP */ +private String IPAddress = null; + /* User-Agent */ private String userAgentString = null; private String lowercaseUserAgentString = null; @@ -125,6 +129,19 @@ public class BrowserTool extends Browser { setUserAgentString(request.getHeader("User-Agent")); setAcceptLanguage(request.getHeader("Accept-Language")); + +/* Get IP Address */ +IPAddress = request.getHeader("X-FORWARDED-FOR"); +if (IPAddress == null) +{ +IPAddress = request.getRemoteAddr(); +} +int coma; +if (IPAddress != null && (coma = IPAddress.indexOf(',')) != -1) +{ +/* keep the leftmost address */ +IPAddress = IPAddress.substring(0, coma); +} } else { @@ -198,7 +215,7 @@ public class BrowserTool extends Browser } -/* Generic getter for unknown tests +/* Generic getter for custom tests */ public boolean get(String key) { @@ -215,6 +232,25 @@ public class BrowserTool extends Browser return acceptLanguage; } +/** + * + * Get the client browser IP address. In the session scope, which is the default, + * it corresponds to the first seen IP adress. + * + * + * The tool tries to get the real IP address whenever the request has been proxied. + * + * + * Please note that the result may be null. + * + * @return the IP address as a string + * @Since VelocityTools 3.0 + */ +public String getIPAddress() +{ +return IPAddress; +} + /* device type */ /**
svn commit: r1819155 - /velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml
Author: cbrisson Date: Sat Dec 23 15:16:21 2017 New Revision: 1819155 URL: http://svn.apache.org/viewvc?rev=1819155=rev Log: Fix tools version data Modified: velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml Modified: velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml?rev=1819155=1819154=1819155=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml Sat Dec 23 15:16:21 2017 @@ -20,7 +20,7 @@ --> - +
svn commit: r1822294 - /velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext
Author: cbrisson Date: Fri Jan 26 13:42:16 2018 New Revision: 1822294 URL: http://svn.apache.org/viewvc?rev=1822294=rev Log: [site] Fix typo in tools summary Modified: velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext Modified: velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext?rev=1822294=1822293=1822294=diff == --- velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext (original) +++ velocity/site/cms/trunk/content/tools/devel/tools-summary.mdtext Fri Jan 26 13:42:16 2018 @@ -12,7 +12,7 @@ You will find here a summary of all the + [`$class` - ClassTool](#ClassTool), + [`$context` - ContextTool](#ContextTool), + [`$convert` - ConversionTool](#ConversionTool), -+ [`$date` - ComparisonDateTool](#ComparisonDateDool), ++ [`$date` - ComparisonDateTool](#ComparisonDateTool), + [`$disp` - DisplayTool](#DisplayTool), + [`$esc` - EscapeTool](#EscapeTool), + [`$field` - FieldTool](#FieldTool), @@ -114,7 +114,7 @@ You will find here a summary of all the `config.timezone` = [ JVM timezone] | time zone `$date` | returns the current date and time formatted with the default format `$date.format(`[ *format*,] *object* [ , *locale* [ ,*timezone*]]`)` | formats the specified object -`$date.get(`*format*`)` | returns the current date and time formatted using hte given format +`$date.get(`*format*`)` | returns the current date and time formatted using the given format `$date.get(`*date style*,*time style*`)` | returns the current date and time formatted using given styles, where each style is one of `full`, `long`, `medium`, `short`, `default` `$date.day` | current day in month `$date.month` | current month (warning: zero-based!)
svn commit: r1822295 - /velocity/site/production/tools/devel/tools-summary.html
Author: cbrisson Date: Fri Jan 26 13:43:35 2018 New Revision: 1822295 URL: http://svn.apache.org/viewvc?rev=1822295=rev Log: [site] Fix typo in tools summary - ditto in prod Modified: velocity/site/production/tools/devel/tools-summary.html Modified: velocity/site/production/tools/devel/tools-summary.html URL: http://svn.apache.org/viewvc/velocity/site/production/tools/devel/tools-summary.html?rev=1822295=1822294=1822295=diff == --- velocity/site/production/tools/devel/tools-summary.html (original) +++ velocity/site/production/tools/devel/tools-summary.html Fri Jan 26 13:43:35 2018 @@ -216,7 +216,7 @@ h2:hover > .headerlink, h3:hover > .head $class - ClassTool, $context - ContextTool, $convert - ConversionTool, -$date - ComparisonDateTool, +$date - ComparisonDateTool, $disp - DisplayTool, $esc - EscapeTool, $field - FieldTool, @@ -501,7 +501,7 @@ h2:hover > .headerlink, h3:hover > .head $date.get(format) -returns the current date and time formatted using hte given format +returns the current date and time formatted using the given format $date.get(date style,time style)
svn commit: r1822794 - /velocity/tools/trunk/pom.xml
Author: cbrisson Date: Wed Jan 31 13:05:04 2018 New Revision: 1822794 URL: http://svn.apache.org/viewvc?rev=1822794=rev Log: [tools] Less strict javadoc syntax for Java 1.8 Modified: velocity/tools/trunk/pom.xml Modified: velocity/tools/trunk/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/pom.xml?rev=1822794=1822793=1822794=diff == --- velocity/tools/trunk/pom.xml (original) +++ velocity/tools/trunk/pom.xml Wed Jan 31 13:05:04 2018 @@ -51,6 +51,19 @@ 3.0.1 + + + +doclint-java8-disable + + [1.8,) + + + -Xdoclint:none + + + + install @@ -110,6 +123,7 @@ true org.apache.velocity.tools.examples +${javadoc.opts}
svn commit: r1822793 - /velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java
Author: cbrisson Date: Wed Jan 31 13:03:56 2018 New Revision: 1822793 URL: http://svn.apache.org/viewvc?rev=1822793=rev Log: [tools] Trivial javadoc fix Modified: velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java Modified: velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java?rev=1822793=1822792=1822793=diff == --- velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java (original) +++ velocity/tools/trunk/velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/JspUtils.java Wed Jan 31 13:03:56 2018 @@ -115,7 +115,6 @@ public class JspUtils * @param pageContext The page context. * @param tag The tag to execute. * @throws JspException If something goes wrong. - * @throws IOException If something goes wrong. */ public static void executeTag(InternalContextAdapter context, Node node, PageContext pageContext, Tag tag) throws JspException
svn commit: r1823587 - /velocity/site/production/download.html
Author: cbrisson Date: Thu Feb 8 17:23:50 2018 New Revision: 1823587 URL: http://svn.apache.org/viewvc?rev=1823587=rev Log: [site] fix Tools 2.0 sources download link - production Modified: velocity/site/production/download.html Modified: velocity/site/production/download.html URL: http://svn.apache.org/viewvc/velocity/site/production/download.html?rev=1823587=1823586=1823587=diff == --- velocity/site/production/download.html (original) +++ velocity/site/production/download.html Thu Feb 8 17:23:50 2018 @@ -409,8 +409,8 @@ The MD5 links download the chec Sources: -velocity-tools-2.0-src.zip [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.asc;>PGP] [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.md5;>MD5] [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.sha1;>SHA1] -velocity-tools-2.0-src.tar.gz [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.asc;>PGP] [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.md5;>MD5] [http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.sha1;>SHA1] +velocity-tools-2.0-src.zip [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.asc;>PGP] [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.md5;>MD5] [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.sha1;>SHA1] +velocity-tools-2.0-src.tar.gz [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.asc;>PGP] [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.md5;>MD5] [http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.sha1;>SHA1] Alpha/Beta Releases
svn commit: r1823586 - /velocity/site/cms/trunk/content/download.mdtext
Author: cbrisson Date: Thu Feb 8 17:22:24 2018 New Revision: 1823586 URL: http://svn.apache.org/viewvc?rev=1823586=rev Log: [site] fix Tools 2.0 sources download link Modified: velocity/site/cms/trunk/content/download.mdtext Modified: velocity/site/cms/trunk/content/download.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/download.mdtext?rev=1823586=1823585=1823586=diff == --- velocity/site/cms/trunk/content/download.mdtext (original) +++ velocity/site/cms/trunk/content/download.mdtext Thu Feb 8 17:22:24 2018 @@ -201,8 +201,8 @@ Binaries: Sources: -+ [velocity-tools-2.0-src.zip]([preferred]/velocity/tools/2.0-src/velocity-tools-2.0-src.zip) [[PGP](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.asc)] [[MD5](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.md5)] [[SHA1](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.zip.sha1)] -+ [velocity-tools-2.0-src.tar.gz]([preferred]/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz) [[PGP](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.asc)] [[MD5](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.md5)] [[SHA1](http://www.apache.org/dist/velocity/tools/2.0-src/velocity-tools-2.0-src.tar.gz.sha1)] ++ [velocity-tools-2.0-src.zip]([preferred]/velocity/tools/2.0/velocity-tools-2.0-src.zip) [[PGP](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.asc)] [[MD5](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.md5)] [[SHA1](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.zip.sha1)] ++ [velocity-tools-2.0-src.tar.gz]([preferred]/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz) [[PGP](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.asc)] [[MD5](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.md5)] [[SHA1](http://www.apache.org/dist/velocity/tools/2.0/velocity-tools-2.0-src.tar.gz.sha1)] ---
svn commit: r1823441 - in /velocity/site/cms/trunk/content/engine: 2.0/user-guide.mdtext devel/user-guide.mdtext
Author: cbrisson Date: Wed Feb 7 08:48:13 2018 New Revision: 1823441 URL: http://svn.apache.org/viewvc?rev=1823441=rev Log: [site] Fix #if section (issue #VELOCITY-890) Modified: velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext Modified: velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext?rev=1823441=1823440=1823441=diff == --- velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext (original) +++ velocity/site/cms/trunk/content/engine/2.0/user-guide.mdtext Wed Feb 7 08:48:13 2018 @@ -504,7 +504,7 @@ The variable *$foo* is evaluated to dete + *$foo* is a boolean (true/false) which has a true value + *$foo* is a string or a collection which is not null **and** not empty -+ *$foo* is a number which equals to zero ++ *$foo* is a number which is not equal to zero + *$foo* is an object (other than a string, a number or a collection) which is not null (please note that this is the default behavior, but Velocity can be configured to [skip all checks beyond boolean and nullity ones](configuration.html#if-directive)). Modified: velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext?rev=1823441=1823440=1823441=diff == --- velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext (original) +++ velocity/site/cms/trunk/content/engine/devel/user-guide.mdtext Wed Feb 7 08:48:13 2018 @@ -504,7 +504,7 @@ The variable *$foo* is evaluated to dete + *$foo* is a boolean (true/false) which has a true value + *$foo* is a string or a collection which is not null **and** not empty -+ *$foo* is a number which equals to zero ++ *$foo* is a number which is not equal to zero + *$foo* is an object (other than a string, a number or a collection) which is not null (please note that this is the default behavior, but Velocity can be configured to [skip all checks beyond boolean and nullity ones](configuration.html#if-directive)).
svn commit: r1823442 - in /velocity/site/production/engine: 2.0/user-guide.html devel/user-guide.html
Author: cbrisson Date: Wed Feb 7 08:49:17 2018 New Revision: 1823442 URL: http://svn.apache.org/viewvc?rev=1823442=rev Log: [site] Fix #if section (issue #VELOCITY-890) - production Modified: velocity/site/production/engine/2.0/user-guide.html velocity/site/production/engine/devel/user-guide.html Modified: velocity/site/production/engine/2.0/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/user-guide.html?rev=1823442=1823441=1823442=diff == --- velocity/site/production/engine/2.0/user-guide.html (original) +++ velocity/site/production/engine/2.0/user-guide.html Wed Feb 7 08:49:17 2018 @@ -778,7 +778,7 @@ The result of the second query is bill $foo is a boolean (true/false) which has a true value $foo is a string or a collection which is not null and not empty -$foo is a number which equals to zero +$foo is a number which is not equal to zero $foo is an object (other than a string, a number or a collection) which is not null (please note that this is the default behavior, but Velocity can be configured to skip all checks beyond boolean and nullity ones). Modified: velocity/site/production/engine/devel/user-guide.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/user-guide.html?rev=1823442=1823441=1823442=diff == --- velocity/site/production/engine/devel/user-guide.html (original) +++ velocity/site/production/engine/devel/user-guide.html Wed Feb 7 08:49:17 2018 @@ -778,7 +778,7 @@ The result of the second query is bill $foo is a boolean (true/false) which has a true value $foo is a string or a collection which is not null and not empty -$foo is a number which equals to zero +$foo is a number which is not equal to zero $foo is an object (other than a string, a number or a collection) which is not null (please note that this is the default behavior, but Velocity can be configured to skip all checks beyond boolean and nullity ones).
svn commit: r1833909 [2/2] - in /velocity/tools/trunk: ./ velocity-tools-generic/src/main/java/org/apache/velocity/tools/ velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ velocit
Modified: velocity/tools/trunk/velocity-tools-view-jsp/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view-jsp/pom.xml?rev=1833909=1833908=1833909=diff == --- velocity/tools/trunk/velocity-tools-view-jsp/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-view-jsp/pom.xml Wed Jun 20 12:28:19 2018 @@ -45,19 +45,25 @@ javax.servlet.jsp jsp-api - 2.1 + 2.2 + provided + + + javax.el + el-api + 2.2 provided junit junit - 4.8.2 + ${junit.version} test org.easymock easymock - 3.4 + 3.6 test Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java?rev=1833909=1833908=1833909=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java Wed Jun 20 12:28:19 2018 @@ -94,21 +94,21 @@ import org.apache.velocity.tools.config. * #end * * - * The output of this might look like: - * - * - * - * - * Showing 1-5 of 8 - * 1. foo - * 2. bar - * 3. blah - * 4. woogie - * 5. baz - * 1 2 Next - * - * - * Example tools.xml configuration: + * The output of this might look like: + * + * form method="get" action="" + *input type="text" value="foo" + *input type="submit" value="Find" + * /form + * Showing 1-5 of 8br + * 1. foobr + * 2. barbr + * 3. blahbr + * 4. woogiebr + * 5. bazbrbr + * b1/b a href=""2/a a href=""Next/a + * + * Example tools.xml configuration: * * tools * toolbox scope="request" @@ -116,7 +116,6 @@ import org.apache.velocity.tools.config. * /toolbox * /tools * - * * * @author Nathan Bubna * @since VelocityTools 2.0 Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java?rev=1833909=1833908=1833909=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java Wed Jun 20 12:28:19 2018 @@ -57,18 +57,16 @@ import javax.servlet.http.HttpServletReq * matching language, the tools defaut locale (or the first value of languagesFilter) is returned. * Their value is guarantied to belong to the set provided in languagesFilter, if any. * - * - * Notes on implementation: - * - * The parsing algorithm is mainly empirical. Used rules are rather generic, so shouldn't need recent updates to be accurate, but accuracy remains far from guaranteed for new devices. - * Parsing should be fast, as the parser only uses a single regex iteration on the user agent string. - * Game consoles, e-readers, etc... are for now classified as mobile devices (but can sometimes be identified by their operating system). - * Needless to say, the frontier between different device types can be very thin... - * - * + * Notes on implementation: + * + * The parsing algorithm is mainly empirical. Used rules are rather generic, so shouldn't need recent updates to be accurate, but accuracy remains far from guaranteed for new devices. + * Parsing should be fast, as the parser only uses a single regex iteration on the user agent string. + * Game consoles, e-readers, etc... are for now classified as mobile devices (but can sometimes be identified by their operating system). + * Needless to say, the frontier between different device types can be very thin... + * * * Thanks to Lee Semel (l...@semel.net), the author of the HTTP::BrowserDetect Perl module. - * See also: + * See also: * * http://www.zytrax.com/tech/web/browser_ids.htm * http://en.wikipedia.org/wiki/User_agent @@ -81,14 +79,11 @@ import javax.servlet.http.HttpServletReq * http://www.webapps-online.com/online-tools/user-agent-strings * https://whichbrowser.net/data/ * - * - * - * TODO: - * - * parse X-Wap-Profile
svn commit: r1833910 - in /velocity/site/cms/trunk/content/tools/devel/apidocs: ./ org/apache/velocity/tools/ org/apache/velocity/tools/class-use/ org/apache/velocity/tools/config/ org/apache/velocity
Author: cbrisson Date: Wed Jun 20 12:43:58 2018 New Revision: 1833910 URL: http://svn.apache.org/viewvc?rev=1833910=rev Log: [site] ugly javadoc commit for tools/devel [This commit notification would consist of 121 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
svn commit: r1833909 [1/2] - in /velocity/tools/trunk: ./ velocity-tools-generic/src/main/java/org/apache/velocity/tools/ velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ velocit
Author: cbrisson Date: Wed Jun 20 12:28:19 2018 New Revision: 1833909 URL: http://svn.apache.org/viewvc?rev=1833909=rev Log: [tools] Fix javadoc errors (still lots of warnings) Modified: velocity/tools/trunk/pom.xml velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ClassUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolInfo.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/Toolbox.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ToolboxFactory.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/Data.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfigurationRuleSet.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/Alternator.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ClassTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ComparisonDateTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ContextTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/DateTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/DisplayTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/FieldTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportSupport.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LinkTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LogTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/LoopTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/MarkupTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/MathTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/NumberTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/SortTool.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ValueParser.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/XmlTool.java velocity/tools/trunk/velocity-tools-view-jsp/pom.xml velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/AbstractSearchTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/BrowserTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/CookieTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ImportTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/IncludeTool.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache
svn commit: r1837413 - in /velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included: ./ test-xinclude1.xml test-xinclude2.xml test-xinclude3.txt
Author: cbrisson Date: Sat Aug 4 10:36:51 2018 New Revision: 1837413 URL: http://svn.apache.org/viewvc?rev=1837413=rev Log: Add missing test files for xi:include Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml?rev=1837413=auto == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml (added) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml Sat Aug 4 10:36:51 2018 @@ -0,0 +1 @@ +success Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml?rev=1837413=auto == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml (added) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml Sat Aug 4 10:36:51 2018 @@ -0,0 +1,5 @@ + + +success + + Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt?rev=1837413=auto == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt (added) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt Sat Aug 4 10:36:51 2018 @@ -0,0 +1 @@ +success
svn commit: r1836010 - /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
Author: cbrisson Date: Mon Jul 16 08:40:56 2018 New Revision: 1836010 URL: http://svn.apache.org/viewvc?rev=1836010=rev Log: [engine] Add ASTIdentifier.getIdentifier() getter Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java?rev=1836010=1836009=1836010=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java Mon Jul 16 08:40:56 2018 @@ -79,6 +79,14 @@ public class ASTIdentifier extends Simpl super(p, id); } +/** + * Identifier getter + * @returns identifier + */ +public String getIdentifier() +{ +return identifier; +} /** * @see org.apache.velocity.runtime.parser.node.SimpleNode#jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
svn commit: r1840464 - in /velocity/site/production/engine: 2.0/vtl-reference.html devel/vtl-reference.html
Author: cbrisson Date: Mon Sep 10 13:19:16 2018 New Revision: 1840464 URL: http://svn.apache.org/viewvc?rev=1840464=rev Log: [engine] Push previous docfix in production. Modified: velocity/site/production/engine/2.0/vtl-reference.html velocity/site/production/engine/devel/vtl-reference.html Modified: velocity/site/production/engine/2.0/vtl-reference.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/vtl-reference.html?rev=1840464=1840463=1840464=diff == --- velocity/site/production/engine/2.0/vtl-reference.html (original) +++ velocity/site/production/engine/2.0/vtl-reference.html Mon Sep 10 13:19:16 2018 @@ -228,7 +228,7 @@ h2:hover > .headerlink, h3:hover > .head References Variables Notation: -$ [ ! ][ { ][a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ] +$ [ ! ][ { ][a..z, A..Z ][ a..z, A..Z, 0..9, _ ][ } ] Examples: Shorthand notation: $mudSlinger_9 @@ -238,7 +238,7 @@ h2:hover > .headerlink, h3:hover > .head Properties Notation: -$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ] .[a..z, A..Z ][a..z, A-Z, 0..9, -, _ ] [ } ] +$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, _ ] .[a..z, A..Z ][a..z, A-Z, 0..9, _ ] [ } ] Examples: Regular Notation: $customer.Address @@ -246,7 +246,7 @@ h2:hover > .headerlink, h3:hover > .head Methods Notation: -$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ] .[ a..z, A..Z ][a..z, A..Z, 0..9, -, _ ]( [optional parameter list...* ] ) [ } *] +$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, _ ] .[ a..z, A..Z ][a..z, A..Z, 0..9, _ ]( [optional parameter list...* ] ) [ } *] Examples: Regular Notation: $customer.getAddress() Modified: velocity/site/production/engine/devel/vtl-reference.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/vtl-reference.html?rev=1840464=1840463=1840464=diff == --- velocity/site/production/engine/devel/vtl-reference.html (original) +++ velocity/site/production/engine/devel/vtl-reference.html Mon Sep 10 13:19:16 2018 @@ -228,7 +228,7 @@ h2:hover > .headerlink, h3:hover > .head References Variables Notation: -$ [ ! ][ { ][a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ] +$ [ ! ][ { ][a..z, A..Z ][ a..z, A..Z, 0..9, _ ][ } ] Examples: Shorthand notation: $mudSlinger_9 @@ -238,7 +238,7 @@ h2:hover > .headerlink, h3:hover > .head Properties Notation: -$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ] .[a..z, A..Z ][a..z, A-Z, 0..9, -, _ ] [ } ] +$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, _ ] .[a..z, A..Z ][a..z, A-Z, 0..9, _ ] [ } ] Examples: Regular Notation: $customer.Address @@ -246,7 +246,7 @@ h2:hover > .headerlink, h3:hover > .head Methods Notation: -$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ] .[ a..z, A..Z ][a..z, A..Z, 0..9, -, _ ]( [optional parameter list...* ] ) [ } *] +$ [ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, _ ] .[ a..z, A..Z ][a..z, A..Z, 0..9, _ ]( [optional parameter list...* ] ) [ } *] Examples: Regular Notation: $customer.getAddress()
svn commit: r1840463 - in /velocity/site/cms/trunk/content/engine: 2.0/vtl-reference.mdtext devel/vtl-reference.mdtext
Author: cbrisson Date: Mon Sep 10 13:14:21 2018 New Revision: 1840463 URL: http://svn.apache.org/viewvc?rev=1840463=rev Log: [engine] Docfix: no hyphen in VTL identifiers Modified: velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext Modified: velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext?rev=1840463=1840462=1840463=diff == --- velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext (original) +++ velocity/site/cms/trunk/content/engine/2.0/vtl-reference.mdtext Mon Sep 10 13:14:21 2018 @@ -10,7 +10,7 @@ This guide is the reference for the Velo Notation: -**$** [ **!** ][ **{** ][**a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ][ **}** ] +**$** [ **!** ][ **{** ][**a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ][ **}** ] Examples: @@ -23,7 +23,7 @@ Examples: Notation: -**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ]* **.**[**a..z**, **A..Z** ][**a..z**, **A-Z**, **0..9**, **-**, **_** ]* [ **}** ] +**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ]* **.**[**a..z**, **A..Z** ][**a..z**, **A-Z**, **0..9**, **_** ]* [ **}** ] Examples: @@ -34,7 +34,7 @@ Examples: Notation: -**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ]* **.**[ **a..z**, **A..Z** ][**a..z**, **A..Z**, **0..9**, **-**, **_** ]***(** [*optional parameter list...* ] **)** [** } **] +**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ]* **.**[ **a..z**, **A..Z** ][**a..z**, **A..Z**, **0..9**, **_** ]***(** [*optional parameter list...* ] **)** [** } **] Examples: Modified: velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext?rev=1840463=1840462=1840463=diff == --- velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext (original) +++ velocity/site/cms/trunk/content/engine/devel/vtl-reference.mdtext Mon Sep 10 13:14:21 2018 @@ -10,7 +10,7 @@ This guide is the reference for the Velo Notation: -**$** [ **!** ][ **{** ][**a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ][ **}** ] +**$** [ **!** ][ **{** ][**a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ][ **}** ] Examples: @@ -23,7 +23,7 @@ Examples: Notation: -**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ]* **.**[**a..z**, **A..Z** ][**a..z**, **A-Z**, **0..9**, **-**, **_** ]* [ **}** ] +**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ]* **.**[**a..z**, **A..Z** ][**a..z**, **A-Z**, **0..9**, **_** ]* [ **}** ] Examples: @@ -34,7 +34,7 @@ Examples: Notation: -**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **-**, **_** ]* **.**[ **a..z**, **A..Z** ][**a..z**, **A..Z**, **0..9**, **-**, **_** ]***(** [*optional parameter list...* ] **)** [** } **] +**$** [ **{** ][ **a..z**, **A..Z** ][ **a..z**, **A..Z**, **0..9**, **_** ]* **.**[ **a..z**, **A..Z** ][**a..z**, **A..Z**, **0..9**, **_** ]***(** [*optional parameter list...* ] **)** [** } **] Examples:
svn commit: r1835855 - /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java
Author: cbrisson Date: Fri Jul 13 19:26:37 2018 New Revision: 1835855 URL: http://svn.apache.org/viewvc?rev=1835855=rev Log: Fix potential NPE Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java?rev=1835855=1835854=1835855=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java Fri Jul 13 19:26:37 2018 @@ -70,6 +70,15 @@ public class ASTText extends SimpleNode } /** + * text getter + * @return literal representation + */ +public String literal() +{ +return ctext; +} + +/** * @see org.apache.velocity.runtime.parser.node.SimpleNode#jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object) */ public Object jjtAccept(ParserVisitor visitor, Object data)
svn commit: r1835856 - in /velocity/engine/trunk/velocity-engine-core/src/main: java/org/apache/velocity/context/ java/org/apache/velocity/runtime/ java/org/apache/velocity/util/introspection/ parser/
Author: cbrisson Date: Fri Jul 13 19:27:31 2018 New Revision: 1835856 URL: http://svn.apache.org/viewvc?rev=1835856=rev Log: some javadoc bugs incidentally fixed Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextAdapterImpl.java velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/Converter.java velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java?rev=1835856=1835855=1835856=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/ChainedInternalContextAdapter.java Fri Jul 13 19:27:31 2018 @@ -97,7 +97,7 @@ public abstract class ChainedInternalCon } /** - * @see org.apache.velocity.context.Context#containsKey(java.lang.Object) + * @see org.apache.velocity.context.Context#containsKey(java.lang.String) */ public boolean containsKey(String key) { @@ -113,7 +113,7 @@ public abstract class ChainedInternalCon } /** - * @see org.apache.velocity.context.Context#remove(java.lang.Object) + * @see org.apache.velocity.context.Context#remove(java.lang.String) */ public Object remove(String key) { Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextAdapterImpl.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextAdapterImpl.java?rev=1835856=1835855=1835856=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextAdapterImpl.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextAdapterImpl.java Fri Jul 13 19:27:31 2018 @@ -259,7 +259,7 @@ public final class InternalContextAdapte } /** - * @see org.apache.velocity.context.Context#containsKey(java.lang.Object) + * @see org.apache.velocity.context.Context#containsKey(java.lang.String) */ public boolean containsKey(String key) { @@ -275,7 +275,7 @@ public final class InternalContextAdapte } /** - * @see org.apache.velocity.context.Context#remove(java.lang.Object) + * @see org.apache.velocity.context.Context#remove(java.lang.String) */ public Object remove(String key) { Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1835856=1835855=1835856=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java Fri Jul 13 19:27:31 2018 @@ -1630,9 +1630,9 @@ public class RuntimeInstance implements /** * Get a logger for the specified child namespace. * If a logger was configured using the runtime.log.instance configuration property, returns this instance. - * Otherwise, uses SLF4J LoggerFactory on baseNamespace + childNamespace. + * Otherwise, uses SLF4J LoggerFactory on baseNamespace '.' childNamespace. * @param childNamespace - * @return + * @return child namespace logger */ public Logger getLog(String childNamespace) { Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1835856=1835855=1835856=diff
svn commit: r1821734 - in /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic: JsonContent.java JsonTool.java
Author: cbrisson Date: Sat Jan 20 09:11:49 2018 New Revision: 1821734 URL: http://svn.apache.org/viewvc?rev=1821734=rev Log: [tools] Nicify Json tool API Added: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java Added: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java?rev=1821734=auto == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java (added) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonContent.java Sat Jan 20 09:11:49 2018 @@ -0,0 +1,205 @@ +package org.apache.velocity.tools.generic; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Iterator; +import java.util.Set; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +/** + * Container for *either* an array *or* an object + */ + +public class JsonContent +{ +/** + * JSONObject content + */ +private JSONObject jsonObject = null; + +/** + * JSONArray content + */ +private JSONArray jsonArray = null; + +/** + * wraps the object into an hybrid JSON container if necessary + */ +private static Object wrapIfNeeded(Object obj) +{ +if (obj == null) +{ +return obj; +} +else if (obj instanceof JSONArray) +{ +return new JsonContent((JSONArray)obj); +} +else if (obj instanceof JSONObject) +{ +return new JsonContent((JSONObject)obj); +} +else +{ +return obj; +} +} + +/** + * wraps an object + */ +public JsonContent(JSONObject object) +{ +jsonObject = object; +} + +/** + * wraps an array + */ +public JsonContent(JSONArray array) +{ +jsonArray = array; +} + +/** + * Get a value from root array + * @param key + * @return value, or null + */ +public Object get(int index) +{ +Object ret = null; +if (jsonArray != null) +{ +ret = wrapIfNeeded(jsonArray.get(index)); +} +else if (jsonObject != null) +{ +ret = wrapIfNeeded(jsonObject.get(String.valueOf(index))); +} +return ret; +} + +/** + * Get a property from root object + * @param key + * @return property value, or null + */ +public Object get(String key) +{ +Object ret = null; +if (jsonArray != null) +{ +try +{ +ret = wrapIfNeeded(jsonArray.get(Integer.parseInt(key))); +} +catch (NumberFormatException nfe) {} +} +else if (jsonObject != null) +{ +ret = wrapIfNeeded(jsonObject.get(key)); +} +return ret; +} + +/** + * Iterate keys of root object. + * @return iterator + */ +public Iterator keys() +{ +return jsonObject == null ? null : jsonObject.keySet().iterator(); +} + +/** + * Get set of root object keys. + * @return + */ +public Set keySet() +{ +return jsonObject == null ? null : jsonObject.keySet(); +} + +/** + * Get an iterator. For a root object, returns an iterator over key names. For a root array, returns an iterator + * over contained objects. + * @return iterator + */ +public Iterator iterator() +{ +if (jsonObject != null) +{ +return jsonObject.keySet().iterator(); +} +else if (jsonArray != null) +{ +return jsonArray.iterator(); +} +return null; +} + +
svn commit: r1827576 - in /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools: ConversionUtils.java generic/ConversionTool.java
Author: cbrisson Date: Fri Mar 23 15:13:52 2018 New Revision: 1827576 URL: http://svn.apache.org/viewvc?rev=1827576=rev Log: [tools] add new $conv.toList(obj) conversion method Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java?rev=1827576=1827575=1827576=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java Fri Mar 23 15:13:52 2018 @@ -31,10 +31,13 @@ import java.text.FieldPosition; import java.text.NumberFormat; import java.text.ParsePosition; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.Calendar; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -841,4 +844,16 @@ public class ConversionUtils catch (Exception e) {} return null; } + +public static List asList(Object value) +{ +if (value instanceof List) return (List)value; +else if (value.getClass().isArray()) return Arrays.asList(value); +else +{ +List ret = new ArrayList(); +ret.add(value); +return ret; +} +} } Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java?rev=1827576=1827575=1827576=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java Fri Mar 23 15:13:52 2018 @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.Date; import java.util.Calendar; import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.TimeZone; import org.apache.velocity.tools.ConversionUtils; @@ -657,6 +658,19 @@ public class ConversionTool extends Loca return calendars; } +/** + * Convert a singleton or an array as List + * @param value Object to be converted + * @return either the object itself if it's already a list, + * the object converted to a list if it's an array, + * or a new singleton list. + */ +public List toList(Object value) +{ +if (value == null) return null; +else return ConversionUtils.asList(value); +} + // - basic string parsing methods --
svn commit: r1827587 - /velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java
Author: cbrisson Date: Fri Mar 23 17:34:23 2018 New Revision: 1827587 URL: http://svn.apache.org/viewvc?rev=1827587=rev Log: fix and improve asList() method Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java?rev=1827587=1827586=1827587=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/ConversionUtils.java Fri Mar 23 17:34:23 2018 @@ -19,8 +19,6 @@ package org.apache.velocity.tools; * under the License. */ -import org.slf4j.LoggerFactory; - import java.io.File; import java.lang.reflect.Array; import java.net.URL; @@ -43,6 +41,8 @@ import java.util.Map; import java.util.TimeZone; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.lang3.ArrayUtils; +import org.slf4j.LoggerFactory; /** * Utility methods for parsing or otherwise converting between types. @@ -848,7 +848,21 @@ public class ConversionUtils public static List asList(Object value) { if (value instanceof List) return (List)value; -else if (value.getClass().isArray()) return Arrays.asList(value); +else if (value.getClass().isArray()) +{ +Class componentClass = value.getClass().getComponentType(); +if (componentClass.isPrimitive()) +{ +if (componentClass.equals(char.class)) value = ArrayUtils.toObject((char[])value); +else if (componentClass.equals(long.class)) value = ArrayUtils.toObject((long[])value); +else if (componentClass.equals(int.class)) value = ArrayUtils.toObject((int[])value); +else if (componentClass.equals(short.class)) value = ArrayUtils.toObject((short[])value); +else if (componentClass.equals(byte.class)) value = ArrayUtils.toObject((byte[])value); +else if (componentClass.equals(double.class)) value = ArrayUtils.toObject((double[])value); +else if (componentClass.equals(float.class)) value = ArrayUtils.toObject((float[])value); +} +return new ArrayList(Arrays.asList((Object[])value)); +} else { List ret = new ArrayList();
svn commit: r1825883 - /velocity/site/production/download.html
Author: cbrisson Date: Mon Mar 5 12:33:22 2018 New Revision: 1825883 URL: http://svn.apache.org/viewvc?rev=1825883=rev Log: [site] Remove md5 signatures from the Downloads page (production) Modified: velocity/site/production/download.html Modified: velocity/site/production/download.html URL: http://svn.apache.org/viewvc/velocity/site/production/download.html?rev=1825883=1825882=1825883=diff == --- velocity/site/production/download.html (original) +++ velocity/site/production/download.html Mon Mar 5 12:33:22 2018 @@ -256,7 +256,7 @@ The currently selected mirror is [pre You may also consult the http://www.apache.org/mirrors/;>complete list of mirrors. The KEYS link links to the code signing keys used to sign the product. The PGP links download the OpenPGP compatible signature from our main site. -The MD5 links download the checksum from the main site. None of these should be downloaded from the mirrors. +The SHA links download the checksum from the main site. None of these should be downloaded from the mirrors. http://www.apache.org/dist/velocity/KEYS;>KEYS Production releases These releases are considered stable and suitable for production. @@ -280,21 +280,18 @@ The MD5 links download the chec engine-core velocity-engine-core-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.sha1;>SHA1] engine-examples velocity-engine-examples-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.sha1;>SHA1] @@ -309,28 +306,24 @@ The MD5 links download the chec engine-parent velocity-engine-parent-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.sha1;>SHA1] engine-core velocity-engine-core-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.sha1;>SHA1] engine-examples velocity-engine-examples-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.sha1;>SHA1] @@ -345,21 +338,18 @@ The MD5 links download the chec engine-core velocity-engine-core-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.sha1;>SHA1] engine-examples velocity-engine-examples-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engin
svn commit: r25429 - /release/velocity/engine/2.0/
Author: cbrisson Date: Mon Mar 5 12:22:55 2018 New Revision: 25429 Log: [dist] remove md5 signatures Removed: release/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.md5 release/velocity/engine/2.0/velocity-engine-core-2.0-sources.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-core-2.0-sources.jar.md5 release/velocity/engine/2.0/velocity-engine-core-2.0.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-core-2.0.jar.md5 release/velocity/engine/2.0/velocity-engine-core-2.0.pom.asc.md5 release/velocity/engine/2.0/velocity-engine-core-2.0.pom.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0-javadoc.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0-javadoc.jar.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0-sources.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0-sources.jar.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0.jar.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0.pom.asc.md5 release/velocity/engine/2.0/velocity-engine-examples-2.0.pom.md5 release/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.asc.md5 release/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.md5 release/velocity/engine/2.0/velocity-engine-parent-2.0.pom.asc.md5 release/velocity/engine/2.0/velocity-engine-parent-2.0.pom.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0-sources.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0-sources.jar.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.asc.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.asc.md5 release/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.md5
svn commit: r1825882 - /velocity/site/cms/trunk/content/download.mdtext
Author: cbrisson Date: Mon Mar 5 12:27:14 2018 New Revision: 1825882 URL: http://svn.apache.org/viewvc?rev=1825882=rev Log: [site] Remove md5 signatures from the Downloads page Modified: velocity/site/cms/trunk/content/download.mdtext Modified: velocity/site/cms/trunk/content/download.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/download.mdtext?rev=1825882=1825881=1825882=diff == --- velocity/site/cms/trunk/content/download.mdtext (original) +++ velocity/site/cms/trunk/content/download.mdtext Mon Mar 5 12:27:14 2018 @@ -37,7 +37,7 @@ You may also consult the [complete list The KEYS link links to the code signing keys used to sign the product. The PGP links download the OpenPGP compatible signature from our main site. -The MD5 links download the checksum from the main site. None of these should be downloaded from the mirrors. +The SHA links download the checksum from the main site. None of these should be downloaded from the mirrors. [KEYS](http://www.apache.org/dist/velocity/KEYS) @@ -67,21 +67,18 @@ Be sure to check the [release notes](htt engine-core velocity-engine-core-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.jar.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.jar.sha1;>SHA1] engine-examples velocity-engine-examples-2.0.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.jar.sha1;>SHA1] @@ -97,28 +94,24 @@ Be sure to check the [release notes](htt engine-parent velocity-engine-parent-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0.pom.sha1;>SHA1] engine-core velocity-engine-core-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0.pom.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0.pom.sha1;>SHA1] engine-examples velocity-engine-examples-2.0.pom [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0.pom.sha1;>SHA1] @@ -134,21 +127,18 @@ Be sure to check the [release notes](htt engine-core velocity-engine-core-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-core-2.0-javadoc.jar.sha1;>SHA1] engine-scripting velocity-engine-scripting-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.md5;>MD5] [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-scripting-2.0-javadoc.jar.sha1;>SHA1] engine-examples velocity-engine-examples-2.0-javadoc.jar [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-examples-2.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2
svn commit: r1834601 - in /velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view: ServletUtils.java VelocityView.java
Author: cbrisson Date: Thu Jun 28 12:14:41 2018 New Revision: 1834601 URL: http://svn.apache.org/viewvc?rev=1834601=rev Log: [tools/view] Config code simplification: relies on servlet context for WEB-INF/*, on class loader for everything else Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java?rev=1834601=1834600=1834601=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/ServletUtils.java Thu Jun 28 12:14:41 2018 @@ -297,22 +297,18 @@ public class ServletUtils return null; } -public static InputStream getInputStream(final String path, ServletContext application) -{ -return getInputStream(path, application, true, true); -} - -public static InputStream getInputStream(final String path, final ServletContext application, boolean searchClasspath, boolean searchWebapp) +public static InputStream getInputStream(final String path, final ServletContext application) { InputStream inputStream = null; -// first search classpath if asked so -if (searchClasspath) +boolean webappResource = path != null && (path.startsWith("WEB-INF") || path.startsWith("/WEB-INF")); +if (!webappResource) { +// search classpath except for WEB-INF/* inputStream = ClassUtils.getResourceAsStream(path, ServletUtils.class); } -if (inputStream == null && searchWebapp) +else { -// then webapp +// then webapp only for WEB-INF/* if (System.getSecurityManager() != null) { inputStream = AccessController.doPrivileged( Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=1834601=1834600=1834601=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Thu Jun 28 12:14:41 2018 @@ -337,15 +337,14 @@ public class VelocityView extends ViewTo protected void configure(final JeeConfig config, final VelocityEngine velocity) { // first get the default properties from the classpath, and bail if we don't find them -Properties defaultProperties = getProperties(DEFAULT_PROPERTIES_PATH, true, true, false); +Properties defaultProperties = getProperties(DEFAULT_PROPERTIES_PATH, true); velocity.setProperties(defaultProperties); // check for application-wide user props in the context init params String appPropsPath = servletContext.getInitParameter(PROPERTIES_KEY); if (appPropsPath != null) { -boolean isInWebInf = appPropsPath.startsWith("/WEB-INF") || appPropsPath.startsWith("WEB-INF"); -Properties appProperties = getProperties(appPropsPath, true, !isInWebInf, isInWebInf); +Properties appProperties = getProperties(appPropsPath, true); getLog().debug("Configuring Velocity with properties at: {}", appPropsPath); velocity.setProperties(appProperties); } @@ -355,7 +354,7 @@ public class VelocityView extends ViewTo if (servletPropsPath != null && (appPropsPath == null || !appPropsPath.equals(servletPropsPath))) { boolean isInWebInf = servletPropsPath.startsWith("/WEB-INF") || servletPropsPath.startsWith("WEB-INF"); -Properties servletProperties = getProperties(servletPropsPath, true, !isInWebInf, isInWebInf); +Properties servletProperties = getProperties(servletPropsPath, true); getLog().debug("Configuring Velocity with properties at: {}", servletPropsPath); velocity.setProperties(servletProperties); } @@ -364,7 +363,7 @@ public class VelocityView extends ViewTo // conventional location, and be silent if they're missing if (appPropsPath == null &&
svn commit: r1842398 - /velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Author: cbrisson Date: Sun Sep 30 16:05:43 2018 New Revision: 1842398 URL: http://svn.apache.org/viewvc?rev=1842398=rev Log: [tools] Fix servlet tools loading Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Modified: velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=1842398=1842397=1842398=diff == --- velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java (original) +++ velocity/tools/trunk/velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java Sun Sep 30 16:05:43 2018 @@ -415,7 +415,7 @@ public class VelocityView extends ViewTo String servletToolsPath = config.getInitParameter(TOOLS_KEY); if (servletToolsPath != null) { -FactoryConfiguration servletToolsConfig = getConfiguration(appToolsPath, true); +FactoryConfiguration servletToolsConfig = getConfiguration(servletToolsPath, true); factoryConfig.addConfiguration(servletToolsConfig); getLog().debug("Loaded configuration from: {}", servletToolsPath); }
svn commit: r1842400 - in /velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout: ./ xinclude.txt
Author: cbrisson Date: Sun Sep 30 16:50:26 2018 New Revision: 1842400 URL: http://svn.apache.org/viewvc?rev=1842400=rev Log: [tools] Fix VELTOOLS-162 - missing files added Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt Added: velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt?rev=1842400=auto == --- velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt (added) +++ velocity/tools/trunk/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt Sun Sep 30 16:50:26 2018 @@ -0,0 +1,2 @@ +$xinclude_1 $xinclude_2 $xinclude_3 +
svn commit: r1843128 - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/runtime/parser/ main/parser/ test/java/org/apache/velocity/test/issues/
Author: cbrisson Date: Mon Oct 8 11:05:21 2018 New Revision: 1843128 URL: http://svn.apache.org/viewvc?rev=1843128=rev Log: [VELOCITY-896] Fix parsing of a terminal hash or dollar sign in sing litteral and template (also fixes VELOCITY-897) Added: velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity896TestCase.java (with props) Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity667TestCase.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java?rev=1843128=1843127=1843128=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java Mon Oct 8 11:05:21 2018 @@ -60,6 +60,11 @@ implements CharStream private int maxNextCharInd = 0; private int inBuf = 0; +/* CB - to properly handle EOF *inside* javacc lexer, + * we send a 'zero-width whitespace' *just before* EOF + */ +private boolean beforeEOF = false; + private void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + nextBufExpand]; @@ -151,8 +156,13 @@ implements CharStream if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { -inputStream.close(); -throw new java.io.IOException(); +if (beforeEOF) +{ +inputStream.close(); +throw new java.io.IOException(); +} +buffer[maxNextCharInd++] = '\u200B'; +beforeEOF = true; } else { @@ -349,6 +359,7 @@ implements CharStream prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; +beforeEOF = false; } /** Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt?rev=1843128=1843127=1843128=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Mon Oct 8 11:05:21 2018 @@ -564,6 +564,26 @@ TOKEN_MGR_DECLS: * * - */ +/* The VelocityCharStream will send a zero-width whitespace + just before EOF to let us accept a terminal $ or # +*/ + +TOKEN : +{ + +{ +inReference = false; +stateStackPop(); +} +} + +/* In all other states, drop the zero-width whitespace */ + +SKIP : +{ + +} + TOKEN: { @@ -811,7 +831,7 @@ MORE : } } -| <"#**" ~["#"]> +| <"#**" ~["#","\u200B"]> { if (!inComment) { @@ -962,7 +982,7 @@ SKIP : MORE : { - < ~[] > + < ~["\u200B"] > } /* --- @@ -1006,7 +1026,7 @@ TOKEN : // < STRING_LITERAL: ("\"" -( (~["\""]) +( (~["\"","\u200B"]) | ("\\" ( ["n","t","b","r","f"] | ["0"-"7"] ( ["0"-"7"] )? @@ -1021,7 +1041,7 @@ TOKEN : ) | ("\'" -( (~["\'"]) +( (~["\'","\u200B"]) | ("''") | ( "\\" (" ")* "\n") )* @@ -1283,12 +1303,12 @@ TOKEN : { | -|((~["$", "#", "\\", "\r", "\n"])* )* > +| ((~["$", "#", "\\", "\r", "\n","\u200B"])* )* > } TOKEN : { - + } /** @@ -1885,7 +1905,10 @@ TOKEN : * unscathed. * @return true if last read token was a newline */ -boolean Text() : {} +boolean Text() : +{ +Token t = null; +} { { return true; } | { return
svn commit: r1843127 - /velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt
Author: cbrisson Date: Mon Oct 8 11:00:31 2018 New Revision: 1843127 URL: http://svn.apache.org/viewvc?rev=1843127=rev Log: [engine] Improve parser debugging output Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt?rev=1843127=1843126=1843127=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Mon Oct 8 11:00:31 2018 @@ -68,11 +68,11 @@ options USER_CHAR_STREAM=true; /** - * for debugging purposes. Keep false + * for debugging purposes. Those are now handled from within javacc-maven-plugin debugging flags in pom.xml +DEBUG_PARSER = true; +DEBUG_LOOKAHEAD = true; +DEBUG_TOKEN_MANAGER = true; */ -DEBUG_PARSER = false; -DEBUG_LOOKAHEAD = false; -DEBUG_TOKEN_MANAGER = false; } PARSER_BEGIN(Parser) @@ -402,6 +402,7 @@ TOKEN_MGR_DECLS: List stateStack = new ArrayList(50); +/* More debug output */ public boolean debugPrint = false; private boolean inReference; @@ -409,12 +410,19 @@ TOKEN_MGR_DECLS: public boolean inSet; /** - * pushes the current state onto the 'state stack', - * and maintains the parens counts - * public because we need it in PD & VM handling + * Switches to a new state (add some log to the default method) + */ + public void switchTo(int lexState) + { +if( debugPrint ) +System.out.println(" switch to " + lexStateNames[lexState]); +SwitchTo(lexState); + } + +/** + * pops a state off the stack, and restores paren counts * - * @return boolean : success. It can fail if the state machine - * gets messed up (do don't mess it up :) + * @return boolean : success of operation */ public boolean stateStackPop() { @@ -427,34 +435,34 @@ TOKEN_MGR_DECLS: { // empty stack lparen=0; -SwitchTo(DEFAULT); +switchTo(DEFAULT); return false; } if( debugPrint ) -System.out.println( -" stack pop (" + stateStack.size() + ") : lparen=" + -s.lparen + -" newstate=" + s.lexstate ); +System.out.println(" stack pop (" + stateStack.size() + ")"); lparen = s.lparen; rparen = s.rparen; -SwitchTo(s.lexstate); +switchTo(s.lexstate); return true; } /** - * pops a state off the stack, and restores paren counts + * pushes the current state onto the 'state stack', + * and maintains the parens counts + * public because we need it in PD & VM handling * - * @return boolean : success of operation + * @return boolean : success. It can fail if the state machine + * gets messed up (do don't mess it up :) */ public boolean stateStackPush() { if( debugPrint ) System.out.println(" (" + stateStack.size() + ") pushing cur state : " + -curLexState ); +lexStateNames[curLexState] ); ParserState s = new ParserState(); s.lparen = lparen; @@ -562,7 +570,7 @@ TOKEN: { stateStackPush(); - SwitchTo(REFINDEX); + switchTo(REFINDEX); } } @@ -618,7 +626,7 @@ TOKEN: */ if (curLexState == REFMODIFIER ) -SwitchTo( REFMOD2 ); +switchTo( REFMOD2 ); } } @@ -651,7 +659,7 @@ TOKEN: * $foo.bar().blargh().woogie().doogie() */ -SwitchTo( REFMOD3 ); +switchTo( REFMOD3 ); } } @@ -698,11 +706,11 @@ TOKEN: if (! inComment) { if ( debugPrint ) -System.out.print("#set : going to " + DIRECTIVE ); +System.out.println(" #set : going to DIRECTIVE" ); stateStackPush(); inSet = true; -SwitchTo(DIRECTIVE); +switchTo(DIRECTIVE); } /* @@ -719,7 +727,7 @@ TOKEN: */ if (curLexState == REFMODIFIER ) -SwitchTo( REFMOD2 ); +switchTo( REFMOD2 ); } } } @@ -749,14 +757,14 @@ MORE : inReference = true; if ( debugPrint ) -System.out.print( "$ : going to " + PRE_REFERENCE ); +System.out.println( " $ : going to PRE_REFERENCE" ); /* do not push PRE states
svn commit: r1843686 - in /velocity/engine/trunk/velocity-engine-core/src: main/parser/Parser.jjt test/resources/templates/compare/diabolical.cmp test/resources/templates/diabolical.vm
Author: cbrisson Date: Fri Oct 12 16:06:42 2018 New Revision: 1843686 URL: http://svn.apache.org/viewvc?rev=1843686=rev Log: [engine] Fix parser regression in 2.0 Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/diabolical.vm Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt?rev=1843686=1843685=1843686=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Fri Oct 12 16:06:42 2018 @@ -781,7 +781,7 @@ TOKEN: * http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-ie.htm#tth_sEc3.12 * */ - + TOKEN: { Modified: velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp?rev=1843686=1843685=1843686=diff == --- velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp (original) +++ velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp Fri Oct 12 16:06:42 2018 @@ -48,3 +48,6 @@ $nullToString $nullToString.toString() + +$ +$fooo$fooo.$fooo.bar$fooo.bar($fooo.bar() \ No newline at end of file Modified: velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/diabolical.vm URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/diabolical.vm?rev=1843686=1843685=1843686=diff == --- velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/diabolical.vm (original) +++ velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/diabolical.vm Fri Oct 12 16:06:42 2018 @@ -65,3 +65,10 @@ $nullToString $nullToString.toString() $!nullToString $!nullToString.toString() + +$#set($foo = $bar) +$fooo#set($foo = $bar) +$fooo.#set($foo = $bar) +$fooo.bar#set($foo = $bar) +$fooo.bar(#set($foo = $bar) +$fooo.bar()#set($foo = $bar)
svn commit: r1843733 - /velocity/site/cms/trunk/content/download.mdtext
Author: cbrisson Date: Sat Oct 13 10:09:38 2018 New Revision: 1843733 URL: http://svn.apache.org/viewvc?rev=1843733=rev Log: [site] Fix broken links on download page Modified: velocity/site/cms/trunk/content/download.mdtext Modified: velocity/site/cms/trunk/content/download.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/download.mdtext?rev=1843733=1843732=1843733=diff == --- velocity/site/cms/trunk/content/download.mdtext (original) +++ velocity/site/cms/trunk/content/download.mdtext Sat Oct 13 10:09:38 2018 @@ -47,7 +47,7 @@ These releases are considered stable and ### Engine -Be sure to check the [release notes](https://dist.apache.org/repos/dist/release/velocity/engine/2.0/release-notes.html) and the [dependencies](http://velocity.apache.org/engine/devel/dependencies.html). +Be sure to check the [release notes](http://www.apache.org/dist/velocity/tools/3.0/release-notes.html) and the [dependencies](http://velocity.apache.org/engine/devel/dependencies.html). Inclusion as a maven dependency @@ -152,9 +152,9 @@ Be sure to check the [release notes](htt engine-parent - velocity-engine-parent-2.0-sources-release.zip - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-sources-release.zip.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-sources-release.zip.sha1;>SHA1] + velocity-engine-parent-2.0-source-release.zip + [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.asc;>PGP] + [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.sha1;>SHA1] engine-core @@ -210,19 +210,19 @@ Be sure to check the [release notes](htt Generic Tools velocity-tools-generic-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.sha256;>SHA256] View Tools velocity-tools-view-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.sha256;>SHA256] JSP View Tools velocity-tools-view-jsp-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.sha256;>SHA256] @@ -234,22 +234,28 @@ Be sure to check the [release notes](htt + Parent Tools Module + velocity-tools-parent-2.0.pom + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc;>PGP] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha256;>SHA256] + + Generic Tools - velocity-engine-parent-2.0.pom + velocity-tools-generic-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha256;>SHA256] View Tools - velocity-engine-parent-2.0.pom + velocity-tools-view-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.sha256;>SHA256] JSP View Tools - velocity-engine-parent-2.0.pom + velocity-tools-view-jsp-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.sha256;>SHA256] @@ -262,21 +268,21 @@ Be sure to check the [release notes](htt Generic Tools - velocity-engine-core-2.0-javadoc.jar - [https://www.apache.org/dist/velocity/tools/3.0/velocity-toole-generic-3.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-toole-generic-3.0-javadoc.jar.sha1;>SHA1] + velocity-tools-generic-3.0-jav
svn commit: r1843734 - /velocity/site/production/download.html
Author: cbrisson Date: Sat Oct 13 10:10:12 2018 New Revision: 1843734 URL: http://svn.apache.org/viewvc?rev=1843734=rev Log: [site] Fix broken links on download page (prod) Modified: velocity/site/production/download.html Modified: velocity/site/production/download.html URL: http://svn.apache.org/viewvc/velocity/site/production/download.html?rev=1843734=1843733=1843734=diff == --- velocity/site/production/download.html (original) +++ velocity/site/production/download.html Sat Oct 13 10:10:12 2018 @@ -261,7 +261,7 @@ The SHA links download the chec Production releases These releases are considered stable and suitable for production. Engine -Be sure to check the https://dist.apache.org/repos/dist/release/velocity/engine/2.0/release-notes.html;>release notes and the http://velocity.apache.org/engine/devel/dependencies.html;>dependencies. +Be sure to check the http://www.apache.org/dist/velocity/tools/3.0/release-notes.html;>release notes and the http://velocity.apache.org/engine/devel/dependencies.html;>dependencies. Inclusion as a maven dependency dependency groupIdorg.apache.velocity/groupId @@ -362,9 +362,9 @@ The SHA links download the chec engine-parent - velocity-engine-parent-2.0-sources-release.zip - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-sources-release.zip.asc;>PGP] - [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-sources-release.zip.sha1;>SHA1] + velocity-engine-parent-2.0-source-release.zip + [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.asc;>PGP] + [https://www.apache.org/dist/velocity/engine/2.0/velocity-engine-parent-2.0-source-release.zip.sha1;>SHA1] engine-core @@ -418,19 +418,19 @@ The SHA links download the chec Generic Tools velocity-tools-generic-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.jar.sha256;>SHA256] View Tools velocity-tools-view-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.jar.sha256;>SHA256] JSP View Tools velocity-tools-view-jsp-3.0.jar [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.jar.sha256;>SHA256] @@ -441,22 +441,28 @@ The SHA links download the chec + Parent Tools Module + velocity-tools-parent-2.0.pom + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc;>PGP] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha256;>SHA256] + + Generic Tools - velocity-engine-parent-2.0.pom + velocity-tools-generic-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-generic-3.0.pom.sha256;>SHA256] View Tools - velocity-engine-parent-2.0.pom + velocity-tools-view-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-3.0.pom.sha256;>SHA256] JSP View Tools - velocity-engine-parent-2.0.pom + velocity-tools-view-jsp-2.0.pom [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.sha1;>SHA1] + [https://www.apache.org/dist/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.sha256;>SHA256] @@ -468,21 +474,21 @@ The SHA links download the chec Generic Tools - velocity-engine-core-2.0-javadoc.jar - [https://www.apache.org/dist/velocity/tools/3.0/velocity-toole-generic-3.0-javadoc.jar.asc;>PGP] - [https://www.apache.org/dist/velocity/tools/3.0/velocity-toole-generic-3.0-javadoc.jar.sha1;>SHA1]
svn commit: r1843755 - /velocity/site/cms/trunk/content/release-process.mdtext
Author: cbrisson Date: Sat Oct 13 13:55:04 2018 New Revision: 1843755 URL: http://svn.apache.org/viewvc?rev=1843755=rev Log: [site] Update release process page Modified: velocity/site/cms/trunk/content/release-process.mdtext Modified: velocity/site/cms/trunk/content/release-process.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/release-process.mdtext?rev=1843755=1843754=1843755=diff == --- velocity/site/cms/trunk/content/release-process.mdtext (original) +++ velocity/site/cms/trunk/content/release-process.mdtext Sat Oct 13 13:55:04 2018 @@ -10,8 +10,8 @@ Instructions make explicit references to To create a release you have to install: -* [Java Development Kit 6](http://www.oracle.com/technetwork/java/javase/downloads/index.html) -* [Maven 2](http://maven.apache.org/) +* [Java Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) +* [Maven 3](http://maven.apache.org/) * [GnuPG](http://www.gnupg.org/) * [OpenSSH](http://www.openssh.com/}OpenSSH) @@ -26,23 +26,6 @@ These operations need to be performed on /www/www.apache.org/dist/velocity/ Publish your GPG key in a PGP key server, such as [MIT Keyserver](http://pgp.mit.edu/). - -* Create and upload yout SSH key - -* Generate your SSH key (in this case we will use RSA encryption): - -ssh-keygen -t rsa - - -* Copy your public key to the server: - -scp ~/.ssh/id_rsa.pub u...@people.apache.org:.ssh/authorized_keys - -* Try to login: - -ssh u...@people.apache.org - -If it does not ask you a password, everything is ok. * Modify `settings.xml` @@ -50,6 +33,7 @@ These operations need to be performed on This is the minimal configuration, obviously if you already have a `settings.xml` file, you must edit it: + :::xml http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 @@ -74,8 +58,9 @@ These operations need to be performed on - release + apache-release +YOUR_KEY_NAME YOUR_SECRET_PHRASE @@ -92,25 +77,53 @@ These steps must be performed **for each If it's not the first release candidate you're trying to release, you should archive the previous release candidate. For instance: +:::shell svn mv ci -m "[engine] archive engine 2.0 RC4" https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0 https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0-RC4 And don't forget to also drop the staged artifact. + +Of course, you will also have to revert the automated commits from the previous `mvn release:*` commands. + +* Complete and update the changelog source file `src/changes/changes.xml` (note: we may get rid of this changelog in the future since it is quite painful to maintain and seems highly redundant with the JIRA release notes). * Prepare the release tag To prepare the release Subversion tag, check out the branch/trunk from where you are preparing the release and type: +:::shell mvn release:prepare -Dusername=YOUR_SVN_USER -Dpassword=YOUR_SVN_PASSWORD The plugin interactively will ask you the version to release, the Subversion tag to use and the next snapshot version. Rather than `velocity-engine-parent-X.X` (the default), we tend to use X.X for the tag name. -* Perform the Release +* Perform the release To perform the release, i.e. creating and deploying Maven artifacts, use: +:::shell mvn release:perform + +* Stage the release + +Commit all poms (renamed from `/pom.xml` to `module-.pom`), binary, sources, javadoc jars in the proper subdirectory of the [release staging area](https://dist.apache.org/repos/dist/dev/velocity) svn repository, along with their signature files (*.asc), which have been generated under the `target/checkout` folder. + +* Provide sha-256 checksums + +Create sha-256 checksums for each pom/jar/asc file on the + +:::shell +for file in *.jar *.asc *.pom; do sha256sum < $file > $file.sha256; done +and add those files to the release staging area svn repository. + +* Release the JIRA version + +* In JIRA go to the version that you want to release and release it. + +* Create a new version, if it has not been done before. + +* Create the JIRA release notes and **copy the content** inside your pretty release notes HTML file, which is to be hosted under svn on the same release staging area. + * Close the staging r
svn commit: r1843756 - /velocity/site/production/release-process.html
Author: cbrisson Date: Sat Oct 13 13:55:22 2018 New Revision: 1843756 URL: http://svn.apache.org/viewvc?rev=1843756=rev Log: [site] Update release process page (prod) Modified: velocity/site/production/release-process.html Modified: velocity/site/production/release-process.html URL: http://svn.apache.org/viewvc/velocity/site/production/release-process.html?rev=1843756=1843755=1843756=diff == --- velocity/site/production/release-process.html (original) +++ velocity/site/production/release-process.html Sat Oct 13 13:55:22 2018 @@ -230,8 +230,8 @@ h2:hover > .headerlink, h3:hover > .head Prerequisites To create a release you have to install: -http://www.oracle.com/technetwork/java/javase/downloads/index.html;>Java Development Kit 6 -http://maven.apache.org/;>Maven 2 +http://www.oracle.com/technetwork/java/javase/downloads/index.html;>Java Development Kit 8 +http://maven.apache.org/;>Maven 3 http://www.gnupg.org/;>GnuPG http://www.openssh.com/}OpenSSH;>OpenSSH @@ -248,35 +248,11 @@ h2:hover > .headerlink, h3:hover > .head Publish your GPG key in a PGP key server, such as http://pgp.mit.edu/;>MIT Keyserver. -Create and upload yout SSH key - - -Generate your SSH key (in this case we will use RSA encryption): -ssh-keygen -t rsa - - - - - -Copy your public key to the server: -scp ~/.ssh/id_rsa.pub u...@people.apache.org:.ssh/authorized_keys - - - - - -Try to login: -ssh u...@people.apache.org - - - -If it does not ask you a password, everything is ok. - - Modify settings.xml Your settings.xml must be modified to allow deployment. This is the minimal configuration, obviously if you already have a settings.xml file, you must edit it: -settings xmlns=http://maven.apache.org/POM/4.0.0; + :::xml +settings xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd; @@ -300,8 +276,9 @@ h2:hover > .headerlink, h3:hover > .head /servers profiles profile - idrelease/id + idapache-release/id properties +gpg.keynameYOUR_KEY_NAME/gpg.keyname gpg.passphraseYOUR_SECRET_PHRASE/gpg.passphrase /properties /profile @@ -319,24 +296,28 @@ h2:hover > .headerlink, h3:hover > .head Archive the previous release candidate If it's not the first release candidate you're trying to release, you should archive the previous release candidate. For instance: -svn mv ci -m [engine] archive engine 2.0 RC4 https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0 https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0-RC4 +svn mv ci -m [engine] archive engine 2.0 RC4 https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0 https://_your_apache_...@svn.apache.org/repos/asf/velocity/engine/tags/2.0-RC4 And don't forget to also drop the staged artifact. +Of course, you will also have to revert the automated commits from the previous mvn release:* commands. + + +Complete and update the changelog source file src/changes/changes.xml (note: we may get rid of this changelog in the future since it is quite painful to maintain and seems highly redundant with the JIRA release notes). Prepare the release tag To prepare the release Subversion tag, check out the branch/trunk from where you are preparing the release and type: -mvn release:prepare -Dusername=YOUR_SVN_USER -Dpassword=YOUR_SVN_PASSWORD +mvn release:prepare -Dusername=YOUR_SVN_USER -Dpassword=YOUR_SVN_PASSWORD The plugin interactively will ask you the version to release, the Subversion tag to use and the next snapshot version. Rather than velocity-engine-parent-X.X (the default), we tend to use X.X for the tag name. -Perform the Release +Perform the release To perform the release, i.e. creating and deploying Maven artifacts, use: mvn release:perform @@ -344,6 +325,33 @@ you are preparing the release and type:< +Stage the release +Commit all poms (renamed from module/pom.xml to module-version.pom), binary, sources, javadoc jars in the proper subdirectory of the https://dist.apache.org/repos/dist/dev/velocity;>release staging area svn repository, along with their signature files (*.asc), which have been generated under the target/checkout folder. + + +Provide sha-256 checksums +Create sha-256 checksums for each pom/jar/asc file on the +for file in *.jar *.asc *.pom; do sha256sum $file $file.sha256; done + + + +and add those files to the release staging area svn repository. + + +Release the JIRA version + + +In JIRA go to the version that you want to release and release it. + + +Create a new version, if it has not been done before. + + +Create the JIRA release notes and copy the content inside your pretty release notes HTML
svn commit: r1843757 - /velocity/site/cms/trunk/content/release-process.mdtext
Author: cbrisson Date: Sat Oct 13 14:03:56 2018 New Revision: 1843757 URL: http://svn.apache.org/viewvc?rev=1843757=rev Log: [site] Trivial changes in the release process page Modified: velocity/site/cms/trunk/content/release-process.mdtext Modified: velocity/site/cms/trunk/content/release-process.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/release-process.mdtext?rev=1843757=1843756=1843757=diff == --- velocity/site/cms/trunk/content/release-process.mdtext (original) +++ velocity/site/cms/trunk/content/release-process.mdtext Sat Oct 13 14:03:56 2018 @@ -317,8 +317,8 @@ After a vote is finished, and it has bee [2]: http://velocity.apache.org/${module}/${version}/upgrading.html [3]: http://velocity.apache.org/download.cgi#${module} [4]: http://velocity.apache.org/contact.html#mailing-lists -[5]: https://issues.apache.org/jira/projects/VELTOOLS +[5]: https://issues.apache.org/jira/projects/[VELTOOLS or VELOCITY] -And send the same announcement in a separate email to the **annou...@apache.org** moderated list using your `@apache.org` (see [how to configure your SMTP client](https://reference.apache.org/committer/email)). +And send the same announcement in a separate email to the **annou...@apache.org** moderated list using your `@apache.org` email (see [how to configure your SMTP client](https://reference.apache.org/committer/email)). **You have finished!**
svn commit: r1843764 - in /velocity/engine/branches/VELOCITY-898: ./ velocity-engine-core/ velocity-engine-core/src/main/parser/ velocity-engine-core/src/test/java/org/apache/velocity/test/ velocity-e
Author: cbrisson Date: Sat Oct 13 14:52:28 2018 New Revision: 1843764 URL: http://svn.apache.org/viewvc?rev=1843764=rev Log: [VELOCITY-898] WIP plus merge from trunk Added: velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/test/java/org/apache/velocity/test/AlternateValuesTestCase.java - copied, changed from r1843220, velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java Modified: velocity/engine/branches/VELOCITY-898/ (props changed) velocity/engine/branches/VELOCITY-898/velocity-engine-core/pom.xml velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/parser/Parser.jjt velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/test/resources/templates/compare/diabolical.cmp velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/test/resources/templates/diabolical.vm Propchange: velocity/engine/branches/VELOCITY-898/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 13 14:52:28 2018 @@ -1,2 +1,2 @@ /velocity/engine/branches/2.0_Exp:958513,991637-995742 -/velocity/engine/trunk:992133,1032159 +/velocity/engine/trunk:992133,1032159,1843220-1843763 Modified: velocity/engine/branches/VELOCITY-898/velocity-engine-core/pom.xml URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-898/velocity-engine-core/pom.xml?rev=1843764=1843763=1843764=diff == --- velocity/engine/branches/VELOCITY-898/velocity-engine-core/pom.xml (original) +++ velocity/engine/branches/VELOCITY-898/velocity-engine-core/pom.xml Sat Oct 13 14:52:28 2018 @@ -169,9 +169,9 @@ true ${parser.nodefiles} true - false - false - false + true + true + true ${maven.compiler.target} true org.apache.velocity.runtime.parser.node Modified: velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/parser/Parser.jjt URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/parser/Parser.jjt?rev=1843764=1843763=1843764=diff == --- velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/parser/Parser.jjt (original) +++ velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/parser/Parser.jjt Sat Oct 13 14:52:28 2018 @@ -466,7 +466,7 @@ TOKEN_MGR_DECLS: List stateStack = new ArrayList(50); /* More debug output */ -public boolean debugPrint = false; +public boolean debugPrint = true; private boolean inReference; private boolean inComment; @@ -675,7 +675,7 @@ TOKEN: } - + TOKEN: { @@ -683,23 +683,42 @@ TOKEN: | } - + TOKEN: { } - + TOKEN: { } - + TOKEN : { - | +{ +if (curLexState == ALT_VAL) +{ +++curlyLevel; +} +} + | + +{ +System.out.println(" RIGHT_CURLEY, curlyLevel was " + curlyLevel); +if (curLexState == ALT_VAL) +{ +if (--curlyLevel == 0) +{ +stateStackPop(); +System.out.println(" Poped state to " + lexStateNames[curLexState]); +} + +} +} } @@ -788,7 +807,7 @@ TOKEN: * http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-ie.htm#tth_sEc3.12 * */ - + TOKEN: { @@ -1065,7 +1084,7 @@ MORE : * * -- */ - + TOKEN: { @@ -1074,8 +1093,6 @@ TOKEN: if ( debugPrint ) System.out.println(" NEWLINE :"); -//stateStackPop(); - if (inSet) inSet = false; } @@ -1348,8 +1365,10 @@ TOKEN : } | { +System.out.println(" RCURLY, curlyLevel was " + curlyLevel); --curlyLevel; stateStackPop(); +System.out.println(" Poped state to " + lexStateNames[curLexState]); } } @@ -1955,7 +1974,7 @@ void Index() : {} void Reference() : {} { /* - * A reference is either $ or ${} or ${'|') + * A reference is either $ or ${} or ${'|') */ ( @@ -1964,11 +1983,11 @@ void Reference() : {} ) | ( - + { System.out.println(" INSIDE LCURLY"); } ( | ) (Index())* (LOOKAHEAD(2) (LOOKAHEAD(3) Method() | Identifier() ) (Index())* )* - [ Expression() ] - + [ { System.out.println(" FOUND PIPE"); } Expression() { System.out.println(" FOUND EXPRESSION"); } ] + ( { System.out.println(" FOUND RCURLY"); } | { System.out.println("@@
svn commit: r30036 - /release/velocity/tools/3.0/
Author: cbrisson Date: Sat Oct 13 10:05:14 2018 New Revision: 30036 Log: [dist/tools] Add signatures and checksums for pom files Added: release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc.sha256 release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc.sha256 release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc.sha256 release/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc release/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc.sha256 Added: release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc == --- release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc (added) +++ release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc Sat Oct 13 10:05:14 2018 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEEzkQ5wb7z2oOxgy+dvv7vInqYuAkFAlvBwxMACgkQvv7vInqY +uAk+hwf/Z4mopnSk1Kmxzt46G79IL2KoEtm3Uz19b6diM3EzvitNrsPwAvCOJjcJ +n1rtbkJHdK+mqSXz65tZvHdEBzUdpMXb4AF70WAHlTbj1J4XONusnZn5to2fNv7q +Q/RVJ8tB3mOk2xYybyYx+DBIZtGCMReDYG6QvyRi8kRWoyVQxxcQ+M0BJpWYcr8P +/kVmzogxd6RAllew39iVJGp02BF+WSLzpKUczPt9OVtDH6JPD9aoaix3NadC8HxO +2DIo/GAsDCk+eYw82BGRaHOOggPs/9WRE3Q3w/76nUgXwp8wXShqSddtWC+dEKGd +2LuUgAVrsOgRA9dz0np58Yo84ApAsw== +=drHA +-END PGP SIGNATURE- Added: release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc.sha256 == --- release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc.sha256 (added) +++ release/velocity/tools/3.0/velocity-tools-generic-3.0.pom.asc.sha256 Sat Oct 13 10:05:14 2018 @@ -0,0 +1 @@ +018a319afdccd08a6c2741d45b96ff5b1eccae7fdf290ddd848e6415d7252841 - Added: release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc == --- release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc (added) +++ release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc Sat Oct 13 10:05:14 2018 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEEzkQ5wb7z2oOxgy+dvv7vInqYuAkFAlvBwxMACgkQvv7vInqY +uAlCqgf+InHtfGVFZfzpIz3D4j/kYvgLaHYDFFYHciMVwmwzJI1HWGqOASv1I/qJ +jlem9dOZOEJpg0rJjF8FTFYSfhyP3AmYEP9ds/2v8P8YhvSeFDGzFgabMPs5uoQZ +BJb+ET2BSHJNJvNPZrBL0LGJEnEQqJWpyb7bpZXfqfPjskFl3TcVsDDO+a80PScT +7CVX9dUHZabarjX0wwxdAWb07HqXqmediuUNV/rachVp8ckmYov14iblSRy4ZAsO +pF3HFYVboNcdjQogZfcrPwiin13eRBvAwtt8Jbf5tMOq2g5OxBAVVhE6Rfn7YeCj +7RBAcabu6tkH0NJay/oQ6j01lGfY6A== +=FQii +-END PGP SIGNATURE- Added: release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc.sha256 == --- release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc.sha256 (added) +++ release/velocity/tools/3.0/velocity-tools-parent-3.0.pom.asc.sha256 Sat Oct 13 10:05:14 2018 @@ -0,0 +1 @@ +99000487f0598f58c3020a0babd0dd9b55730089b37516ee3e8b1156fdb310f6 - Added: release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc == --- release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc (added) +++ release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc Sat Oct 13 10:05:14 2018 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEEzkQ5wb7z2oOxgy+dvv7vInqYuAkFAlvBwxQACgkQvv7vInqY +uAl4JAf/Q8TYyJAeJKGaeNowRIcc9QfXjpsxEYLz4Nu9SPVZKIEF28eMiIn4rMpM +6j68pEn/fDCBJPFZLGlT/xUclfubHmJTAEDgC6aUJ8tNpBvMftePRsX70aAh3FBd +TCzDB0duQ29CbeQ85f3UsMBbie+mrXWXTpSQZ5E+iHT6AM30SLPqAKn2n2vl060Z +1PPk0T675Njwhc7dLx/Q8Kw+vSciPslOoXUB7l5qbl4rXNLDEStjRVHzCUGLPzII +zqdP83RBPzjT9w4TBPumoWTriEZj5fqIMgG2qDN4Dg1UsQ4t25ycJhRPIwHBbraR +7xfUb6H86VEWPsehRHE7U58RaBSvTw== +=JZkT +-END PGP SIGNATURE- Added: release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc.sha256 == --- release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc.sha256 (added) +++ release/velocity/tools/3.0/velocity-tools-view-3.0.pom.asc.sha256 Sat Oct 13 10:05:14 2018 @@ -0,0 +1 @@ +8df6bbabae1c9fa6b09f78040c1f1897eb96ef56e0d2cd5925ba4f6a3dec2595 - Added: release/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc == --- release/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc (added) +++ release/velocity/tools/3.0/velocity-tools-view-jsp-3.0.pom.asc Sat Oct 13 10:05:14 2018 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEEzkQ5wb7z2oOxgy+dvv7vInqYuAkFAlvBwxQACgkQvv7vInqY +uAk3ewf6A+tZLLN3MSVdyshXL61Vd7TI9sirUD6AflWUqthxup2ACYjgkbKMsOff +TU8hsjV9hqy7ofaeULsAgA7Zjpqfe92WyHKgAdrmo1zaqVGVI47jLGDm8MFRBSaA +bPqUUtl5
svn commit: r1843825 - in /velocity/engine/trunk: pom.xml src/changes/changes.xml velocity-engine-core/pom.xml velocity-engine-examples/pom.xml velocity-engine-scripting/pom.xml
Author: cbrisson Date: Sun Oct 14 11:16:27 2018 New Revision: 1843825 URL: http://svn.apache.org/viewvc?rev=1843825=rev Log: [VELOCITY-888] Include proper OSGi bundle informations in manifest files Modified: velocity/engine/trunk/pom.xml velocity/engine/trunk/src/changes/changes.xml velocity/engine/trunk/velocity-engine-core/pom.xml velocity/engine/trunk/velocity-engine-examples/pom.xml velocity/engine/trunk/velocity-engine-scripting/pom.xml Modified: velocity/engine/trunk/pom.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/pom.xml?rev=1843825=1843824=1843825=diff == --- velocity/engine/trunk/pom.xml (original) +++ velocity/engine/trunk/pom.xml Sun Oct 14 11:16:27 2018 @@ -76,6 +76,29 @@ -Papache-release + + maven-jar-plugin + 3.1.0 + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + org.apache.felix + maven-bundle-plugin + 3.5.0 + + + bundle-manifest + process-classes + + manifest + + + + Modified: velocity/engine/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=1843825=1843824=1843825=diff == --- velocity/engine/trunk/src/changes/changes.xml (original) +++ velocity/engine/trunk/src/changes/changes.xml Sun Oct 14 11:16:27 2018 @@ -26,6 +26,9 @@ + +Include proper OSGi bundle informations in manifest files + Alternate reference values: ${foo|'foo'} evaluates to false whenever boolean evaluation of $foo is false Modified: velocity/engine/trunk/velocity-engine-core/pom.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/pom.xml?rev=1843825=1843824=1843825=diff == --- velocity/engine/trunk/velocity-engine-core/pom.xml (original) +++ velocity/engine/trunk/velocity-engine-core/pom.xml Sun Oct 14 11:16:27 2018 @@ -179,6 +179,21 @@ true + +org.apache.felix +maven-bundle-plugin + + + + org.apache.velocity.* + + + !org.apache.commons.io, + * + + + + Modified: velocity/engine/trunk/velocity-engine-examples/pom.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-examples/pom.xml?rev=1843825=1843824=1843825=diff == --- velocity/engine/trunk/velocity-engine-examples/pom.xml (original) +++ velocity/engine/trunk/velocity-engine-examples/pom.xml Sun Oct 14 11:16:27 2018 @@ -30,6 +30,15 @@ Apache Velocity Engine - Examples Very simple examples to use Velocity + + + +org.apache.felix +maven-bundle-plugin + + + + org.apache.velocity Modified: velocity/engine/trunk/velocity-engine-scripting/pom.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-scripting/pom.xml?rev=1843825=1843824=1843825=diff == --- velocity/engine/trunk/velocity-engine-scripting/pom.xml (original) +++ velocity/engine/trunk/velocity-engine-scripting/pom.xml Sun Oct 14 11:16:27 2018 @@ -74,6 +74,10 @@ + +org.apache.felix +maven-bundle-plugin +
svn commit: r1843862 - /velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt
Author: cbrisson Date: Sun Oct 14 21:51:28 2018 New Revision: 1843862 URL: http://svn.apache.org/viewvc?rev=1843862=rev Log: [VELOCITY-903] #foreach #else #end ready in the parser but not yet taken into account (tests do pass) Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt?rev=1843862=1843861=1843862=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Sun Oct 14 21:51:28 2018 @@ -85,6 +85,7 @@ import org.apache.velocity.exception.Vel import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.parser.node.*; import org.apache.velocity.runtime.directive.Directive; +import org.apache.velocity.runtime.directive.Foreach; import org.apache.velocity.runtime.directive.MacroParseException; import org.apache.velocity.runtime.RuntimeConstants; @@ -1652,7 +1653,7 @@ void DirectiveAssign() : {} */ boolean Directive() : { -Token id = null, t = null, u = null, end = null; +Token id = null, t = null, u = null, end = null, _else = null; int argType; int argPos = 0; Directive d; @@ -1660,9 +1661,9 @@ boolean Directive() : boolean isVM = false; boolean isMacro = false; ArrayList argtypes = new ArrayList(4); -boolean newlineAtEnd = false, newlineBeforeStatement = false; +boolean afterNewline = false, newlineAtEnd = false; String blockPrefix = ""; -ASTBlock block = null; +ASTBlock block = null, elseBlock = null; } { [ @@ -1805,7 +1806,7 @@ boolean Directive() : else { blockPrefix = (t == null ? u.image : t.image + u.image); - newlineBeforeStatement = true; + afterNewline = true; } t = u = null; } @@ -1826,23 +1827,70 @@ boolean Directive() : ( ( ( - LOOKAHEAD( { getToken(1).kind != END && ( !newlineBeforeStatement || getToken(1).kind != WHITESPACE || getToken(2).kind != END ) }) newlineBeforeStatement = Statement(newlineBeforeStatement) + LOOKAHEAD( { getToken(1).kind != END && getToken(1).kind != ELSE && ( !afterNewline || getToken(1).kind != WHITESPACE || getToken(2).kind != END && getToken(2).kind != ELSE ) }) afterNewline = Statement(afterNewline) )* { block = jjtThis; block.setPrefix(blockPrefix); +blockPrefix = ""; } ) #Block ) [ - LOOKAHEAD( 1, { newlineBeforeStatement }) + LOOKAHEAD( 1, { afterNewline }) (t = ) { block.setPostfix(t.image); t = null; } ] +/* + * then an optional #else for the #foreach directive + */ +( + [ +LOOKAHEAD( { d != null && (d instanceof Foreach) && getToken(1).kind == ELSE } ) +( + (_else = ) + ( +[ + LOOKAHEAD(2) ( [ ( t = ) ] ( u = ) ) + { + jjtThis.setPrefix(t == null ? u.image : t.image + u.image); + t = u = null; + afterNewline = true; + } +] +( + LOOKAHEAD( { getToken(1).kind != END && (!afterNewline || getToken(1).kind != WHITESPACE || getToken(2).kind != END) }) + afterNewline = Statement(afterNewline) +)* +{ +elseBlock = jjtThis; +} + ) + #Block + { + int pos = _else.image.lastIndexOf('#'); + if (pos > 0) + { + block.setMorePostfix(_else.image.substring(0, pos)); + } + block = elseBlock; + } +) + ] +) +[ + LOOKAHEAD( 1, { afterNewline }) + (t = ) + { + block.setPostfix(t.image); + t = null; + afterNewline = false; + } +] ( (end = ) [
svn commit: r1843864 - /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
Author: cbrisson Date: Sun Oct 14 22:51:38 2018 New Revision: 1843864 URL: http://svn.apache.org/viewvc?rev=1843864=rev Log: [engine] Allow SimpleNode.dump() to be called before initialization Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java?rev=1843864=1843863=1843864=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Sun Oct 14 22:51:38 2018 @@ -281,13 +281,16 @@ public class SimpleNode implements Node */ public final void dump(String prefix, PrintStream out) { -String encoding = rsvc.getString(RuntimeConstants.INPUT_ENCODING); Charset charset = null; -try +if (rsvc == null) /* may be null if node isn't yet initialized */ { -charset = Charset.forName(encoding); +String encoding = rsvc.getString(RuntimeConstants.INPUT_ENCODING); +try +{ +charset = Charset.forName(encoding); +} +catch (Exception e) {} } -catch (Exception e) {} if (charset == null) { charset = Charset.defaultCharset();
svn commit: r1843865 - /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
Author: cbrisson Date: Sun Oct 14 22:52:13 2018 New Revision: 1843865 URL: http://svn.apache.org/viewvc?rev=1843865=rev Log: [engine] Fix previous commit Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java?rev=1843865=1843864=1843865=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Sun Oct 14 22:52:13 2018 @@ -282,7 +282,7 @@ public class SimpleNode implements Node public final void dump(String prefix, PrintStream out) { Charset charset = null; -if (rsvc == null) /* may be null if node isn't yet initialized */ +if (rsvc != null) /* may be null if node isn't yet initialized */ { String encoding = rsvc.getString(RuntimeConstants.INPUT_ENCODING); try
svn commit: r1843867 - /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
Author: cbrisson Date: Sun Oct 14 23:23:25 2018 New Revision: 1843867 URL: http://svn.apache.org/viewvc?rev=1843867=rev Log: [engine] Ensure PrintWriter is flushed in SimpleNode.dump(), and escape newlines Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java?rev=1843867=1843866=1843867=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Sun Oct 14 23:23:25 2018 @@ -252,7 +252,7 @@ public class SimpleNode implements Node toString(String), otherwise overriding toString() is probably all you need to do. */ /** - * @param prefix + * @param prefix display prefix * @return String representation of this node. */ public String toString(String prefix) @@ -277,7 +277,8 @@ public class SimpleNode implements Node * Override {@link #dump(String, PrintWriter} if you want to customize * how the node dumps out its children. * - * @param prefix + * @param prefix display prefix + * @param out output print stream */ public final void dump(String prefix, PrintStream out) { @@ -295,7 +296,9 @@ public class SimpleNode implements Node { charset = Charset.defaultCharset(); } -dump(prefix, new PrintWriter(new OutputStreamWriter(out, charset))); +PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, charset)); +dump(prefix, pw); +pw.flush(); } /** @@ -303,8 +306,8 @@ public class SimpleNode implements Node * Override this method if you want to customize how the node dumps * out its children. * - * @param Print - * @param prefix + * @param prefix display prefix + * @param out output print writer */ public void dump(String prefix, PrintWriter out) { @@ -494,7 +497,7 @@ public class SimpleNode implements Node for (Token t = getFirstToken(); t != null; ) { -tokens.append("[").append(t.image).append("]"); +tokens.append("[").append(t.image.replace("\n", "\\n")).append("]"); if (t.next != null) { if (t.equals(getLastToken()))
svn commit: r1843853 - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java test/resources/templates/compare/range.cmp test/resour
Author: cbrisson Date: Sun Oct 14 16:58:57 2018 New Revision: 1843853 URL: http://svn.apache.org/viewvc?rev=1843853=rev Log: [VELOCITY-886] Avoid OOM in large integer loops Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/range.cmp velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/range.vm Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java?rev=1843853=1843852=1843853=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java Sun Oct 14 16:58:57 2018 @@ -26,8 +26,9 @@ import org.apache.velocity.runtime.parse import org.apache.velocity.util.DuckType; import org.apache.velocity.util.StringUtils; -import java.util.ArrayList; -import java.util.List; +import java.util.AbstractList; +import java.util.Iterator; +import java.util.ListIterator; /** * handles the range 'operator' [ n .. m ] @@ -64,6 +65,141 @@ public class ASTIntegerRange extends Sim return visitor.visit(this, data); } +public static class IntegerRange extends AbstractList +{ +public class RangeIterator implements ListIterator +{ +private int value; + +public RangeIterator() +{ +value = left - delta; +} + +public RangeIterator(int startIndex) +{ +value = left + (startIndex - 1) * delta; +} + +@Override +public Integer next() +{ +value += delta; +return value; +} + +@Override +public boolean hasPrevious() +{ +return value != left - delta; +} + +@Override +public Integer previous() +{ +value -= delta; +return value; +} + +@Override +public int nextIndex() +{ +return (value + delta - left) * delta; +} + +@Override +public int previousIndex() +{ +return (value - delta - left) * delta; +} + +@Override +public void remove() +{ +throw new UnsupportedOperationException("integer range is read only"); +} + +@Override +public void set(Integer integer) +{ +throw new UnsupportedOperationException("integer range is read only"); +} + +@Override +public void add(Integer integer) +{ +throw new UnsupportedOperationException("integer range is read only"); +} + +@Override +public boolean hasNext() +{ +return value != right; +} +} + +private int left; +private int right; +private int delta; + +public IntegerRange(int left, int right, int delta) +{ +this.left = left; +this.right = right; +this.delta = delta; +} + +@Override +public Iterator iterator() +{ +return new RangeIterator(); +} + +@Override +public Integer get(int index) +{ +int ret = left + delta * index; +if (delta > 0 && ret > right || delta < 0 && ret < right) +{ +throw new IndexOutOfBoundsException(); +} +return ret; +} + +@Override +public int indexOf(Object o) +{ +int v = DuckType.asNumber(o).intValue(); +v -= left; +v *= delta; +return v >= 0 && v < size() ? v : -1; +} + +@Override +public int lastIndexOf(Object o) +{ +return indexOf(o); +} + +@Override +public ListIterator listIterator() +{ +return new RangeIterator(); +} + +@Override +public ListIterator listIterator(int index) +{ +return new RangeIterator(index); +} + +@Override +public int size() +{ +return Math.abs(right - left)
svn commit: r1843870 - /velocity/engine/trunk/src/changes/changes.xml
Author: cbrisson Date: Mon Oct 15 00:02:49 2018 New Revision: 1843870 URL: http://svn.apache.org/viewvc?rev=1843870=rev Log: [engine] Update changelog Modified: velocity/engine/trunk/src/changes/changes.xml Modified: velocity/engine/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=1843870=1843869=1843870=diff == --- velocity/engine/trunk/src/changes/changes.xml (original) +++ velocity/engine/trunk/src/changes/changes.xml Mon Oct 15 00:02:49 2018 @@ -26,6 +26,9 @@ + +Default block for empty loops: #foreach($i in []) loop block #else empty #end + Include proper OSGi bundle informations in manifest files
svn commit: r1843869 - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/runtime/directive/ test/java/org/apache/velocity/test/ test/resources/gobbling/ test/resources/
Author: cbrisson Date: Mon Oct 15 00:00:50 2018 New Revision: 1843869 URL: http://svn.apache.org/viewvc?rev=1843869=rev Log: [VELOCITY-903] #foreach #else #end ready Added: velocity/engine/trunk/velocity-engine-core/src/test/resources/gobbling/compare/foreach_empty.vtl.BC velocity/engine/trunk/velocity-engine-core/src/test/resources/gobbling/compare/foreach_empty.vtl.LINES velocity/engine/trunk/velocity-engine-core/src/test/resources/gobbling/compare/foreach_empty.vtl.NONE velocity/engine/trunk/velocity-engine-core/src/test/resources/gobbling/compare/foreach_empty.vtl.STRUCTURED velocity/engine/trunk/velocity-engine-core/src/test/resources/gobbling/foreach_empty.vtl Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/foreach-array.cmp velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/compare/foreach-type.cmp velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/foreach-array.vm velocity/engine/trunk/velocity-engine-core/src/test/resources/templates/foreach-type.vm Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java?rev=1843869=1843868=1843869=diff == --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java Mon Oct 15 00:00:50 2018 @@ -26,10 +26,8 @@ import org.apache.velocity.runtime.Runti import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.parser.ParseException; import org.apache.velocity.runtime.parser.Token; -import org.apache.velocity.runtime.parser.node.ASTReference; -import org.apache.velocity.runtime.parser.node.Node; +import org.apache.velocity.runtime.parser.node.*; import org.apache.velocity.runtime.parser.node.ParserTreeConstants; -import org.apache.velocity.runtime.parser.node.SimpleNode; import org.apache.velocity.util.StringUtils; import org.apache.velocity.util.introspection.Info; @@ -214,17 +212,30 @@ public class Foreach extends Directive public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { +// Get the block ast tree which is always the last child ... +Node block = node.jjtGetChild(node.jjtGetNumChildren()-1); + +// ... except if there is an #else claude +Node elseBlock = null; +Node previous = node.jjtGetChild(node.jjtGetNumChildren()-2); +if (previous instanceof ASTBlock) +{ +elseBlock = block; +block = previous; +} + Node iterableNode = node.jjtGetChild(2); Object iterable = iterableNode.value(context); Iterator i = getIterator(iterable, iterableNode); -if (i == null) +if (i == null || !i.hasNext()) { +if (elseBlock != null) +{ +renderBlock(context, writer, elseBlock); +} return false; } -// Get the block ast tree which is always the last child -Node block = node.jjtGetChild(node.jjtGetNumChildren()-1); - /* * save the element key if there is one */ Modified: velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java?rev=1843869=1843868=1843869=diff == --- velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java Mon Oct 15 00:00:50 2018 @@ -167,6 +167,7 @@ public class TemplateTestCase extends Ba Object[] oarr = { "a","b","c","d" } ; int intarr[] = { 10, 20, 30, 40, 50 }; +int emptyarr[] = {}; context.put( "collection", vec ); context2.put("iterator", vec.iterator()); @@ -174,6 +175,7 @@ public class TemplateTestCase extends Ba context.put("obarr", oarr ); context.put("enumerator", vec.elements()); context.put("intarr&qu