This class has all the utility method(s). Ideally should move all the bean containers here.
| 35 | * This class has all the utility method(s). Ideally should move all the bean containers here. |
| 36 | */ |
| 37 | public class JspUtil { |
| 38 | |
| 39 | private static final String WEB_INF_TAGS = "/WEB-INF/tags/"; |
| 40 | private static final String META_INF_TAGS = "/META-INF/tags/"; |
| 41 | |
| 42 | // Delimiters for request-time expressions (JSP and XML syntax) |
| 43 | private static final String OPEN_EXPR = "<%="; |
| 44 | private static final String CLOSE_EXPR = "%>"; |
| 45 | |
| 46 | private static final String[] javaKeywords = |
| 47 | { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", |
| 48 | "default", "do", "double", "else", "enum", "extends", "final", "finally", "float", "for", "goto", |
| 49 | "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", |
| 50 | "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", |
| 51 | "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile", "while" }; |
| 52 | |
| 53 | static final int JSP_INPUT_STREAM_BUFFER_SIZE = 1024; |
| 54 | |
| 55 | /** |
| 56 | * Default chunk size for reading files. |
| 57 | */ |
| 58 | public static final int CHUNKSIZE = 1024; |
| 59 | |
| 60 | |
| 61 | /** |
| 62 | * Private constructor to prevent instantiation. |
| 63 | */ |
| 64 | private JspUtil() { |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Takes a potential expression and converts it into XML form. |
| 69 | * |
| 70 | * @param expression The expression to convert |
| 71 | * |
| 72 | * @return XML view |
| 73 | */ |
| 74 | public static String getExprInXml(String expression) { |
| 75 | String returnString; |
| 76 | int length = expression.length(); |
| 77 | |
| 78 | if (expression.startsWith(OPEN_EXPR) && expression.endsWith(CLOSE_EXPR)) { |
| 79 | returnString = expression.substring(1, length - 1); |
| 80 | } else { |
| 81 | returnString = expression; |
| 82 | } |
| 83 | |
| 84 | return Escape.xml(returnString); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Checks to see if the given scope is valid. |
| 89 | * |
| 90 | * @param scope The scope to be checked |
| 91 | * @param n The Node containing the 'scope' attribute whose value is to be checked |
| 92 | * @param err error dispatcher |
| 93 | * |
| 94 | * @throws JasperException if scope is not null and different from "page", "request", |
nothing calls this directly
no outgoing calls
no test coverage detected