View Javadoc

1   package com.sri.emo.wizard.creation;
2   
3   import com.jcorporate.expresso.core.security.filters.HtmlPlusURLFilter;
4   import com.jcorporate.expresso.core.security.filters.AllowedHtmlPlusURLFilter;
5   
6   /***
7    * <p>Title: </p>
8    *
9    * <p>Description: </p>
10   *
11   * <p>Copyright: Copyright (c) 2003</p>
12   *
13   * <p>Company: </p>
14   *
15   * @author not attributable
16   * @version 1.0
17   */
18  public class ExtendedAllowedHtmlPlusURLFilter extends HtmlPlusURLFilter {
19  
20      public static final String[] ALLOWED_HTML = {
21          "<b>", "</b>", "<i>", "</i>", "<em>", "</em>", "<strong>", "</strong>",
22          "<blockquote>", "</blockquote>", "<p>", "</p>",
23          "<ol>", "</ol>", "<ul>", "</ul>", "<li>", "</li>"
24      };
25  
26      /***
27       * No-arg constructor required
28       * Just append special html filtering string list with allowed html
29       */
30      public ExtendedAllowedHtmlPlusURLFilter()
31              throws IllegalArgumentException {
32          super(appendArrays(SPECIAL_STRING_LIST, ALLOWED_HTML),
33                  appendArrays(REPLACE_LIST, ALLOWED_HTML));
34      }
35  
36      private static String[] appendArrays(String[] array1, String[] array2) {
37          if (array1 == null || array2 == null) {
38              return null;
39          }
40  
41          int totalLength = array1.length + array2.length;
42          String resultArray[] = new String[totalLength];
43          for (int i = 0; i < array1.length; i++) {
44              resultArray[i] = array1[i];
45          }
46          for (int i = 0; i < array2.length; i++) {
47              resultArray[array1.length + i] = array2[i];
48          }
49          return resultArray;
50      }
51  }