View Javadoc

1   package org.apache.turbine.modules;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.ecs.ConcreteElement;
20  
21  import org.apache.turbine.util.InputFilterUtils;
22  import org.apache.turbine.util.RunData;
23  
24  /***
25   * This is the base class that defines what a Navigation module is.
26   *
27   * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
28   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
29   * @version $Id: Navigation.java 264148 2005-08-29 14:21:04Z henning $
30   */
31  public abstract class Navigation
32      extends Assembler
33  {
34      /***
35       * A subclass must override this method to build itself.
36       * Subclasses override this method to store the navigation in
37       * RunData or to write the navigation to the output stream
38       * referenced in RunData.
39       *
40       * @param data Turbine information.
41       * @exception Exception a generic exception.
42       */
43      protected abstract ConcreteElement doBuild(RunData data)
44          throws Exception;
45  
46      /***
47       * Subclasses can override this method to add additional
48       * functionality.  This method is protected to force clients to
49       * use NavigationLoader to build a Navigation.
50       *
51       * @param data Turbine information.
52       * @exception Exception a generic exception.
53       */
54      protected ConcreteElement build(RunData data)
55          throws Exception
56      {
57          return doBuild(data);
58      }
59  
60      /***
61       * This function can/should be used in any screen that will output
62       * User entered text.  This will help prevent users from entering
63       * html (<SCRIPT>) tags that will get executed by the browser.
64       *
65       * @param s The string to prepare.
66       * @return A string with the input already prepared.
67       * @deprecated Use InputFilterUtils.prepareText(String s)
68       */
69      public static String prepareText(String s)
70      {
71          return InputFilterUtils.prepareText(s);
72      }
73  }