├── velocity-tools-view
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── inclasspath.json
│ │ │ ├── charset-test.vm
│ │ │ ├── webapp_mocking
│ │ │ │ ├── inwebapp.json
│ │ │ │ └── inwebapp.xml
│ │ │ ├── inclasspath.xml
│ │ │ ├── VM_global_library.vm
│ │ │ └── WEB-INF
│ │ │ │ └── velocity.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── apache
│ │ │ └── velocity
│ │ │ └── tools
│ │ │ ├── test
│ │ │ └── blackbox
│ │ │ │ ├── BreadcrumbToolTests.java
│ │ │ │ ├── BaseToolTests.java
│ │ │ │ ├── TestURLHandler.java
│ │ │ │ ├── ResponseAdaptor.java
│ │ │ │ └── ServletContextAdaptor.java
│ │ │ └── view
│ │ │ └── BaseWebappMockTest.java
│ └── main
│ │ ├── resources
│ │ └── org
│ │ │ └── apache
│ │ │ └── velocity
│ │ │ └── tools
│ │ │ └── view
│ │ │ ├── velocity.properties
│ │ │ └── tools.xml
│ │ └── java
│ │ └── org
│ │ └── apache
│ │ └── velocity
│ │ └── tools
│ │ └── view
│ │ ├── package.html
│ │ ├── JeeContextConfig.java
│ │ ├── JeeFilterConfig.java
│ │ ├── JeeServletConfig.java
│ │ ├── XmlTool.java
│ │ ├── JeeConfig.java
│ │ ├── ImportTool.java
│ │ └── ViewContext.java
└── pom.xml
├── velocity-tools-generic
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── foo.json
│ │ │ ├── resources2.properties
│ │ │ ├── resources_en.properties
│ │ │ ├── resources_fr.properties
│ │ │ ├── file.xml
│ │ │ ├── tools.properties
│ │ │ ├── tools.test.properties
│ │ │ ├── tools.xml
│ │ │ ├── tools.test.xml
│ │ │ ├── whiteboxtest-toolbox.xml
│ │ │ └── toolbox.test.xml
│ │ └── java
│ │ │ ├── org
│ │ │ └── apache
│ │ │ │ └── velocity
│ │ │ │ └── tools
│ │ │ │ └── generic
│ │ │ │ ├── CollectionToolTests.java
│ │ │ │ ├── MathToolTests.java
│ │ │ │ ├── JsonToolTests.java
│ │ │ │ └── Veltools128Tests.java
│ │ │ └── tools.java
│ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── apache
│ │ │ └── velocity
│ │ │ └── tools
│ │ │ ├── config
│ │ │ ├── Property.java
│ │ │ ├── ValidScope.java
│ │ │ ├── InvalidScope.java
│ │ │ ├── NullKeyException.java
│ │ │ ├── DefaultKey.java
│ │ │ ├── SkipSetters.java
│ │ │ ├── InvalidScopeException.java
│ │ │ └── ConfigurationException.java
│ │ │ ├── generic
│ │ │ ├── package.html
│ │ │ ├── FormatConfig.java
│ │ │ ├── LogTool.java
│ │ │ └── LocaleConfig.java
│ │ │ └── Scope.java
│ │ └── resources
│ │ └── org
│ │ └── apache
│ │ └── velocity
│ │ └── tools
│ │ └── generic
│ │ ├── times.properties
│ │ └── tools.xml
└── pom.xml
├── velocity-tools-examples
├── velocity-tools-examples-showcase
│ └── src
│ │ └── main
│ │ ├── webapp
│ │ ├── WEB-INF
│ │ │ ├── included
│ │ │ │ ├── test-xinclude3.txt
│ │ │ │ ├── test-xinclude1.xml
│ │ │ │ └── test-xinclude2.xml
│ │ │ ├── velocity.properties
│ │ │ ├── tools.xml
│ │ │ └── web.xml
│ │ ├── nolayout
│ │ │ └── xinclude.txt
│ │ ├── footer.vm
│ │ ├── post_json.vm
│ │ ├── layout
│ │ │ ├── Print.vm
│ │ │ ├── Simple.vm
│ │ │ ├── Table.vm
│ │ │ └── Default.vm
│ │ ├── index.vm
│ │ ├── json.vm
│ │ ├── collection.vm
│ │ ├── layoutmenu.vm
│ │ ├── header.vm
│ │ ├── include.vm
│ │ ├── xml.vm
│ │ ├── class.vm
│ │ ├── field.vm
│ │ ├── loop.vm
│ │ ├── sorter.vm
│ │ ├── context.vm
│ │ ├── convert.vm
│ │ ├── cookies.vm
│ │ ├── Error.vm
│ │ ├── alternator.vm
│ │ ├── import.vm
│ │ ├── display.vm
│ │ ├── template.txt
│ │ ├── mill.vm
│ │ ├── toolmenu.vm
│ │ ├── render.vm
│ │ ├── fullDemo.vm
│ │ ├── lists.vm
│ │ ├── text.vm
│ │ └── number.vm
│ │ ├── resources
│ │ ├── NOTICE
│ │ ├── otherStuff.properties
│ │ ├── resources_de.properties
│ │ ├── resources_fr.properties
│ │ └── file.xml
│ │ └── java
│ │ └── org
│ │ └── apache
│ │ └── velocity
│ │ └── tools
│ │ └── examples
│ │ └── showcase
│ │ ├── sample
│ │ ├── Person.java
│ │ └── SampleListInitializer.java
│ │ ├── ShowcaseLayoutServlet.java
│ │ └── tool
│ │ └── LayoutLinkTool.java
├── velocity-tools-examples-simple
│ ├── src
│ │ └── main
│ │ │ ├── java
│ │ │ └── org
│ │ │ │ └── apache
│ │ │ │ └── velocity
│ │ │ │ └── tools
│ │ │ │ └── examples
│ │ │ │ └── simple
│ │ │ │ └── tool
│ │ │ │ └── ToyTool.java
│ │ │ └── webapp
│ │ │ ├── WEB-INF
│ │ │ ├── tools.xml
│ │ │ └── web.xml
│ │ │ ├── index.vm
│ │ │ └── index.jsp
│ └── pom.xml
└── pom.xml
├── .gitignore
├── NOTICE
├── README.md
└── velocity-tools-view-jsp
├── src
├── main
│ └── java
│ │ └── org
│ │ └── apache
│ │ └── velocity
│ │ └── tools
│ │ └── view
│ │ └── jsp
│ │ ├── package-info.java
│ │ ├── jspimpl
│ │ ├── package-info.java
│ │ ├── VelocityToolsJspException.java
│ │ ├── ExternalWriterHttpServletResponse.java
│ │ └── VelocityJspFragment.java
│ │ └── JspToolContext.java
└── test
│ └── java
│ └── org
│ └── apache
│ └── velocity
│ └── tools
│ └── view
│ └── jsp
│ └── jspimpl
│ ├── ExternalWriterHttpServletResponseTest.java
│ └── VelocityJspFragmentTest.java
└── pom.xml
/velocity-tools-view/src/test/resources/inclasspath.json:
--------------------------------------------------------------------------------
1 | {"hey" : "brother" }
2 |
--------------------------------------------------------------------------------
/velocity-tools-view/src/test/resources/charset-test.vm:
--------------------------------------------------------------------------------
1 | Questo è il momento della verità.
2 |
--------------------------------------------------------------------------------
/velocity-tools-view/src/test/resources/webapp_mocking/inwebapp.json:
--------------------------------------------------------------------------------
1 | {"hey" : "there" }
2 |
--------------------------------------------------------------------------------
/velocity-tools-generic/src/test/resources/foo.json:
--------------------------------------------------------------------------------
1 | { "foo": "bar", "array": [ "foo1", "foo2"] }
2 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude3.txt:
--------------------------------------------------------------------------------
1 | success
2 |
--------------------------------------------------------------------------------
/velocity-tools-view/src/test/resources/inclasspath.xml:
--------------------------------------------------------------------------------
1 |
2 | brother
3 |
4 |
--------------------------------------------------------------------------------
/velocity-tools-view/src/test/resources/webapp_mocking/inwebapp.xml:
--------------------------------------------------------------------------------
1 |
2 | there
3 |
4 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/nolayout/xinclude.txt:
--------------------------------------------------------------------------------
1 | $xinclude_1 $xinclude_2 $xinclude_3
2 |
3 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude1.xml:
--------------------------------------------------------------------------------
1 | success
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #maven
2 | target
3 |
4 | #idea
5 | *.iml
6 | .idea
7 |
8 | #eclipse
9 | bin
10 | .project
11 | .classpath
12 | .settings
13 |
14 | # OSX
15 | .DS_Store
16 |
17 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/WEB-INF/included/test-xinclude2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | success
4 |
5 |
6 |
--------------------------------------------------------------------------------
/velocity-tools-view/src/test/resources/VM_global_library.vm:
--------------------------------------------------------------------------------
1 | #macro( quietnull $a)
2 | #if($a)$a#end
3 | #end
4 |
5 | #macro( recurse $a )
6 | global recurse $a
7 | #set( $a = $a - 1)
8 | #if ($a > 0)
9 | #recurse( $a )
10 | #end
11 | #end
12 |
13 | #macro( callrecurse )
14 | #set( $count = 5)
15 | #recurse( $count )
16 | #end
17 |
18 | #macro( testbool $b )
19 | #if($b)
20 | arg true
21 | #end
22 | #if( ! $b )
23 | arg false
24 | #end
25 | #end
26 |
27 |
28 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Velocity Tools
2 |
3 | Copyright (C) 2000-2007 The Apache Software Foundation
4 |
5 | This product includes software developed at
6 | The Apache Software Foundation (http://www.apache.org/).
7 |
8 | Support for using SSL with Struts is provided using
9 | the sslext library package, which is open source software
10 | under the Apache Software License 1.1 with copyright attributed
11 | to The Apache Software Foundation.
12 | This software is available from http://sslext.sourceforge.net/
13 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/resources/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Velocity Tools
2 | Showcase application
3 |
4 | Copyright (C) 2000-2010 The Apache Software Foundation
5 |
6 | This product includes software developed at
7 | The Apache Software Foundation (http://www.apache.org/).
8 |
9 | Support for using SSL with Struts is provided using
10 | the sslext library package, which is open source software
11 | under the Apache Software License 1.1 with copyright attributed
12 | to The Apache Software Foundation.
13 | This software is available from http://sslext.sourceforge.net/
14 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/java/org/apache/velocity/tools/examples/showcase/sample/Person.java:
--------------------------------------------------------------------------------
1 | package org.apache.velocity.tools.examples.showcase.sample;
2 |
3 | public class Person
4 | {
5 |
6 | private String name;
7 |
8 | private String surname;
9 |
10 | private String role;
11 |
12 | public Person(String name, String surname, String role)
13 | {
14 | this.name = name;
15 | this.surname = surname;
16 | this.role = role;
17 | }
18 |
19 | public String getName()
20 | {
21 | return name;
22 | }
23 |
24 | public String getSurname()
25 | {
26 | return surname;
27 | }
28 |
29 | public String getRole()
30 | {
31 | return role;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Title: Apache Velocity Tools
2 |
3 | # Apache Velocity Tools
4 |
5 | Welcome to the VelocityTools projects. This is a subproject of the
6 | Apache Velocity project hosted at https://velocity.apache.org/
7 |
8 | The VelocityTools project contains several subprojects:
9 |
10 | velocity-tools-generic/ A collection of general purpose tools
11 | velocity-tools-view/ Tools servlets and filters for use in a webapp
12 | velocity-tools-jsp/ Tools for a JEE JSP context
13 | velocity-tools-examples/
14 | velocity-tools-examples-simple/ Simple examples
15 | velocity-tools-examples-showcase/ A full webapp demonstrating tools
16 |
17 | Apache Velocity Tools require at least Java 8 to run.
18 |
19 | ## Feedback
20 |
21 | We welcome your feedback to user@velocity.apache.org.
22 |
23 | - The Apache Velocity Team
24 |
--------------------------------------------------------------------------------
/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/CollectionToolTests.java:
--------------------------------------------------------------------------------
1 | package org.apache.velocity.tools.generic;
2 |
3 | import org.junit.Test;
4 | import static org.junit.Assert.assertEquals;
5 |
6 | import java.util.Arrays;
7 | import java.util.List;
8 |
9 | public class CollectionToolTests
10 | {
11 | public @Test
12 | void testNullElements()
13 | {
14 | CollectionTool tool = new CollectionTool();
15 |
16 | List lst = Arrays.asList("b", null, "a");
17 | List sorted = (List)tool.sort(lst);
18 | assertEquals(2, sorted.size());
19 | assertEquals("a", sorted.get(0));
20 | assertEquals("b", sorted.get(1));
21 |
22 | String arr[] = new String[] { "foo", null, "bar"};
23 | sorted = (List)tool.sort(arr);
24 | assertEquals(2, sorted.size());
25 | assertEquals("bar", sorted.get(0));
26 | assertEquals("foo", sorted.get(1));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/velocity-tools-generic/src/test/resources/resources2.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | foo = woogie
19 |
--------------------------------------------------------------------------------
/velocity-tools-examples/velocity-tools-examples-showcase/src/main/webapp/footer.vm:
--------------------------------------------------------------------------------
1 | ## Licensed to the Apache Software Foundation (ASF) under one
2 | ## or more contributor license agreements. See the NOTICE file
3 | ## distributed with this work for additional information
4 | ## regarding copyright ownership. The ASF licenses this file
5 | ## to you under the Apache License, Version 2.0 (the
6 | ## "License"); you may not use this file except in compliance
7 | ## with the License. You may obtain a copy of the License at
8 | ##
9 | ## http://www.apache.org/licenses/LICENSE-2.0
10 | ##
11 | ## Unless required by applicable law or agreed to in writing,
12 | ## software distributed under the License is distributed on an
13 | ## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | ## KIND, either express or implied. See the License for the
15 | ## specific language governing permissions and limitations
16 | ## under the License.
17 |