* Pimp up res.debug() output a little bit, making it invisible by default and adding
a link to display it. This is just a minor facelift to a feature that needs to be rethought and replaced, though.
This commit is contained in:
parent
87722c3b8d
commit
4648a7eee2
1 changed files with 12 additions and 3 deletions
|
@ -362,13 +362,19 @@ public final class ResponseTrans extends Writer implements Serializable {
|
||||||
public void debug(Object message) {
|
public void debug(Object message) {
|
||||||
if (debugBuffer == null) {
|
if (debugBuffer == null) {
|
||||||
debugBuffer = new StringBuffer();
|
debugBuffer = new StringBuffer();
|
||||||
|
debugBuffer.append("<a href=\"#helma-debug-area\" name=\"helma-debug-area\" ");
|
||||||
|
debugBuffer.append("class=\"helma-debug-link\" style=\"font-size: small;\" onclick=\"");
|
||||||
|
debugBuffer.append("var s = this.nextSibling.style; s.display = s.display == 'none' ? '' : 'none'; return true;");
|
||||||
|
debugBuffer.append("\">[toggle debug info]</a>");
|
||||||
|
debugBuffer.append("<div id=\"helma-debug-area\" style=\"display: none; border-top: 1px solid black;\">");
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = (message == null) ? "null" : message.toString();
|
String str = (message == null) ? "null" : message.toString();
|
||||||
|
|
||||||
debugBuffer.append("<p><span style=\"background: yellow; color: black\">");
|
debugBuffer.append("<div class=\"helma-debug-line\" style=\"background: yellow; ");
|
||||||
|
debugBuffer.append("color: black; border-bottom: 1px solid black;\">");
|
||||||
debugBuffer.append(str);
|
debugBuffer.append(str);
|
||||||
debugBuffer.append("</span></p>");
|
debugBuffer.append("</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -611,7 +617,10 @@ public final class ResponseTrans extends Writer implements Serializable {
|
||||||
// only close if the response hasn't been closed yet
|
// only close if the response hasn't been closed yet
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
// if debug buffer exists, append it to main buffer
|
// if debug buffer exists, append it to main buffer
|
||||||
if (debugBuffer != null) {
|
if (contentType != null &&
|
||||||
|
contentType.startsWith("text/html") &&
|
||||||
|
debugBuffer != null) {
|
||||||
|
debugBuffer.append("</div>");
|
||||||
if (buffer == null) {
|
if (buffer == null) {
|
||||||
buffer = debugBuffer;
|
buffer = debugBuffer;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue