• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.apache.velocity.app.event;
2 
3 import org.apache.velocity.context.Context;
4 
5 /*
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements.  See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership.  The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License.  You may obtain a copy of the License at
13  *
14  *   http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied.  See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  */
23 
24 /**
25  *  Event handler for include type directives (e.g. <code>#include()</code>, <code>#parse()</code>)
26  *  Allows the developer to modify the path of the resource returned.
27  *
28  * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
29  * @version $Id$
30  * @since 1.5
31  */
32 public interface IncludeEventHandler extends EventHandler
33 {
34     /**
35      * Called when an include-type directive is encountered (
36      * <code>#include</code> or <code>#parse</code>). May modify the path
37      * of the resource to be included or may block the include entirely. All the
38      * registered IncludeEventHandlers are called unless null is returned. If
39      * none are registered the template at the includeResourcePath is retrieved.
40      *
41      * @param context current context
42      * @param includeResourcePath  the path as given in the include directive.
43      * @param currentResourcePath the path of the currently rendering template that includes the
44      *            include directive.
45      * @param directiveName  name of the directive used to include the resource. (With the
46      *            standard directives this is either "parse" or "include").
47      *
48      * @return a new resource path for the directive, or null to block the
49      *         include from occurring.
50      */
includeEvent(Context context, String includeResourcePath, String currentResourcePath, String directiveName)51     String includeEvent(Context context, String includeResourcePath, String currentResourcePath, String directiveName);
52 }
53