Methods Summary |
---|
public java.lang.String | execute()
if (page != null && page.trim().length() > 0) {
InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//")+1), getClass());
page = page.replace("//", "/");
if (in == null) {
in = servletContext.getResourceAsStream(page);
while (in == null && page.indexOf('/", 1) > 0) {
page = page.substring(page.indexOf('/", 1));
in = servletContext.getResourceAsStream(page);
}
}
pageLines = read(in, -1);
}
if (className != null && className.trim().length() > 0) {
className = "/"+className.replace('.", '/") + ".java";
InputStream in = getClass().getResourceAsStream(className);
if (in == null) {
in = servletContext.getResourceAsStream("/WEB-INF/src"+className);
}
classLines = read(in, -1);
}
if (config != null && config.trim().length() > 0) {
int pos = config.lastIndexOf(':");
configLine = Integer.parseInt(config.substring(pos+1));
config = config.substring(0, pos).replace("//", "/");
configLines = read(new URL(config).openStream(), configLine);
}
return SUCCESS;
|
public java.util.List | getClassLines()
return classLines;
|
public java.lang.String | getClassName()
return className;
|
public java.lang.String | getConfig()
return config;
|
public int | getConfigLine()
return configLine;
|
public java.util.List | getConfigLines()
return configLines;
|
public int | getPadding()
return padding;
|
public java.lang.String | getPage()
return page;
|
public java.util.List | getPageLines()
return pageLines;
|
private java.util.List | read(java.io.InputStream in, int targetLineNumber)Reads in a strea, optionally only including the target line number
and its padding
List snippet = null;
if (in != null) {
snippet = new ArrayList();
int startLine = 0;
int endLine = Integer.MAX_VALUE;
if (targetLineNumber > 0) {
startLine = targetLineNumber - padding;
endLine = targetLineNumber + padding;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
int lineno = 0;
String line;
while ((line = reader.readLine()) != null) {
lineno++;
if (lineno >= startLine && lineno <= endLine) {
snippet.add(line);
}
}
} catch (Exception ex) {
// ignoring as snippet not available isn't a big deal
}
}
return snippet;
|
public void | setClassName(java.lang.String className)
this.className = className;
|
public void | setConfig(java.lang.String config)
this.config = config;
|
public void | setPadding(int padding)
this.padding = padding;
|
public void | setPage(java.lang.String page)
this.page = page;
|
public void | setServletContext(javax.servlet.ServletContext arg0)
this.servletContext = arg0;
|