1 22 package org.jboss.console.plugins.helpers.servlet; 23 24 31 public class ServletHelper 32 { 33 36 public static String filter(String input) 37 { 38 if (input == null) 39 { 40 return null; 41 } 42 else 43 { 44 StringBuffer filtered = new StringBuffer (input.length() * 2); 45 char c; 46 for (int i = 0; i < input.length(); i++) 47 { 48 c = input.charAt(i); 49 switch (c) 50 { 51 case '<': 52 filtered.append("<"); 53 break; 54 case '>': 55 filtered.append(">"); 56 break; 57 case '"': 58 filtered.append("""); 59 break; 60 case '&': 61 filtered.append("&"); 62 break; 63 default: 64 filtered.append(c); 65 break; 66 } 67 } 68 return filtered.toString(); 69 } 70 } 71 } 72 | Popular Tags |