FileDocCategorySizeDatePackage
ServletHelper.javaAPI DocJBoss 4.2.12292Fri Jul 13 21:02:12 BST 2007org.jboss.console.plugins.helpers.servlet

ServletHelper

public class ServletHelper extends Object
Helper class
author
Sacha Labourey
author
Dimitris Andredis
version
$Revision: 57191 $

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.Stringfilter(java.lang.String input)
Encode '<', '>', '"', '&' characters to their html equivalent

      if (input == null)
      {
         return null;
      }
      else
      {
         StringBuffer filtered = new StringBuffer(input.length() * 2);
         char c;
         for (int i = 0; i < input.length(); i++)
         {
            c = input.charAt(i);
            switch (c)
            {
               case '<":
                  filtered.append("<");
                  break;
               case '>":
                  filtered.append(">");
                  break;
               case '"":
                  filtered.append(""");
                  break;
               case '&":
                  filtered.append("&");
                  break;
               default:
                  filtered.append(c);
                  break;
            }
         }
         return filtered.toString();
      }