if (type.equals("system")) {
displaySystem(request);
} else if (type.equals("session")) {
displaySession(request);
} else if (type.equals("test")) {
final DebugBuilder debug = new DebugHtmlString();
debug.appendTitle("Title");
debug.appendln("boolean", true);
debug.appendln("number", 213);
debug.startSection("Section 1");
debug.appendln("boolean", false);
debug.appendln("number", 12348);
debug.endSection();
debug.startSection("Section 2");
debug.appendln("boolean", false);
debug.appendln("number", 12348);
debug.appendTitle("Another title");
debug.appendln("boolean", false);
debug.appendln("number", 12348);
debug.endSection();
debug.startSection("Section 3");
debug.appendln("boolean", false);
debug.appendln("number", 89878);
debug.endSection();
debug.startSection("Subsection 2");
debug.appendln("boolean", false);
debug.appendln("number", 12348);
debug.endSection();
debug.startSection("Section 4");
debug.appendln("boolean", false);
debug.indent();
debug.appendln("boolean", false);
debug.appendln("number", 12348);
debug.unindent();
debug.appendln("number", 12348);
debug.appendPreformatted("code", "line 1\nline 2\nline 3");
debug.appendln("A lot of text etc.");
debug.endSection();
request.appendHtml(debug.toString());
//request.appendHtml("<pre>" + debug.toString() + "</pre>");
debug.close();
} else if (type.equals("variables")) {
displayVariables(request);
} else if (type.equals("dispatcher")) {
displayDispatcher(request);
} else if (type.equals("context")) {
displayContext(request);
} else if (type.equals("specifications")) {
listSpecifications(request);
} else if (type.equals("specification-for")) {
specificationFor(request);
} else if (type.equals("specification")) {
specification(request);
} else if (type.equals("specification-graph")) {
specificationGraph(request);
} else if (type.equals("object-graph")) {
objectGraph(request);
} else if (type.equals("object")) {
final String value = request.getOptionalProperty(VALUE);
final RequestContext context = request.getContext();
final ObjectAdapter object = context.getMappedObject(value);
final DebugString str = new DebugString();
Dump.adapter(object, str);
Dump.graph(object, IsisContext.getAuthenticationSession(), str);
request.appendHtml("<h2>" + object.getSpecification().getFullIdentifier() + "</h2>");
request.appendHtml("<pre class=\"debug\">" + str + "</pre>");
}
}
if (alwaysShow || request.getContext().getDebug() == RequestContext.Debug.ON) {
final RequestContext context = request.getContext();
final String id = request.getOptionalProperty("object");
if (id != null) {
final ObjectAdapter object = context.getMappedObject(id);
if (object instanceof DebuggableWithTitle) {
final DebugString debug = new DebugString();
((DebuggableWithTitle) object).debugData(debug);
request.appendHtml("<pre class=\"debug\">" + debug + "</pre>");
} else {
request.appendHtml(object.toString());
}
}
final String variable = request.getOptionalProperty("variable");
if (variable != null) {
final Object object = context.getVariable(variable);
request.appendHtml(variable + " => " + (object == null ? "null" : object.toString()));
}
final String list = request.getOptionalProperty("list");
if (list != null) {
final DebugString debug = new DebugString();
context.append(debug, list);
request.appendHtml(debug.toString());
}
final String uri = request.getOptionalProperty("uri");
if (uri != null) {
request.appendHtml("<pre class=\"debug\">");