View Javadoc
1   package net.sourceforge.pmd.lang.vm.directive;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.    
20   */
21  
22  /**
23   * <p>Pluggable directive that handles the #include() statement in VTL.
24   * This #include() can take multiple arguments of either
25   * StringLiteral or Reference.</p>
26   *
27   * <p>Notes:</p>
28   * <ol>
29   * <li>For security reasons, the included source material can only come
30   *    from somewhere within the template root tree.  If you want to include
31   *    content from elsewhere on your disk, add extra template roots, or use
32   *    a link from somwhere under template root to that content.</li>
33   *
34   *  <li>By default, there is no output to the render stream in the event of
35   *    a problem.  You can override this behavior with two property values :
36   *       include.output.errormsg.start
37   *       include.output.errormsg.end
38   *     If both are defined in velocity.properties, they will be used to
39   *     in the render output to bracket the arg string that caused the
40   *     problem.
41   *     Ex. : if you are working in html then
42   *       include.output.errormsg.start=&lt;!-- #include error :
43   *       include.output.errormsg.end= --&gt;
44   *     might be an excellent way to start...</li>
45   *
46   *  <li>As noted above, #include() can take multiple arguments.
47   *    Ex : #include('foo.vm' 'bar.vm' $foo)
48   *    will include all three if valid to output without any
49   *    special separator.</li>
50   *  </ol>
51   *
52   * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
53   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
54   * @author <a href="mailto:kav@kav.dk">Kasper Nielsen</a>
55   * @version $Id: Include.java 746438 2009-02-21 05:41:24Z nbubna $
56   */
57  public class Include extends InputBase
58  {
59  
60      /**
61       * Return name of this directive.
62       * @return The name of this directive.
63       */
64      public String getName()
65      {
66          return "include";
67      }
68  
69      /**
70       * Return type of this directive.
71       * @return The type of this directive.
72       */
73      public int getType()
74      {
75          return LINE;
76      }
77  
78      /**
79       * Since there is no processing of content,
80       * there is never a need for an internal scope.
81       */
82      public boolean isScopeProvided()
83      {
84          return false;
85      }
86  }