Methods Summary |
---|
private static java.lang.String | mangleChar(char ch)definition of the char escaping algorithm
if (ch == File.separatorChar) {
ch = '/";
}
String s = Integer.toHexString(ch);
int nzeros = 5 - s.length();
char[] result = new char[6];
result[0] = '_";
for (int i = 1; i <= nzeros; ++i) {
result[i] = '0";
}
int resultIndex = 0;
for (int i = nzeros + 1; i < 6; ++i) {
result[i] = s.charAt(resultIndex++);
}
return new String(result);
|
private java.lang.String | mapJspToBaseName(java.io.File jspFile)map from a jsp file to a base name; does not deal with extensions
String className;
className = stripExtension(jspFile);
// since we don't mangle extensions like the servlet does,
// we need to check for keywords as class names
for (int i = 0; i < keywords.length; ++i) {
if (className.equals(keywords[i])) {
className += "%";
break;
}
}
// Fix for invalid characters. If you think of more add to the list.
StringBuffer modifiedClassName = new StringBuffer(className.length());
// first char is more restrictive than the rest
char firstChar = className.charAt(0);
if (Character.isJavaIdentifierStart(firstChar)) {
modifiedClassName.append(firstChar);
} else {
modifiedClassName.append(mangleChar(firstChar));
}
// this is the rest
for (int i = 1; i < className.length(); i++) {
char subChar = className.charAt(i);
if (Character.isJavaIdentifierPart(subChar)) {
modifiedClassName.append(subChar);
} else {
modifiedClassName.append(mangleChar(subChar));
}
}
return modifiedClassName.toString();
|
public java.lang.String | mapJspToJavaName(java.io.File jspFile)map from a jsp file to a java filename; does not do packages
// CheckStyle:ConstantNameCheck ON
return mapJspToBaseName(jspFile) + ".java";
|
public java.lang.String | mapPath(java.lang.String path)taking in the substring representing the path relative to the source dir
return a new string representing the destination path
not supported, as jasper in tomcat4.0 doesnt either
return null;
|
private java.lang.String | stripExtension(java.io.File jspFile)get short filename from file
String className;
String filename = jspFile.getName();
if (filename.endsWith(".jsp")) {
className = filename.substring(0, filename.length() - 4);
} else {
className = filename;
}
return className;
|