in odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/debug/ODataDebugResponseWrapper.java [168:236]
private InputStream wrapInHtml(final List<DebugInfo> parts) throws IOException {
StringWriter writer = new StringWriter();
PathInfo pathInfo = null;
try {
pathInfo = context.getPathInfo();
} catch (final ODataException e) {}
writer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n")
.append(" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n")
.append("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n")
.append("<head>\n")
.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n")
.append("<title>")
.append(pathInfo == null ? "" :
escapeHtml(pathInfo.getServiceRoot().relativize(pathInfo.getRequestUri()).getPath()))
.append("</title>\n")
.append("<style type=\"text/css\">\n")
.append("body { font-family: Arial, sans-serif; font-size: 13px;\n")
.append(" line-height: 16px; margin: 0;\n")
.append(" background-color: #eeeeee; color: #333333; }\n")
.append(".header { float: left; }\n")
.append(".header a { line-height: 22px; padding: 10px 18px;\n")
.append(" text-decoration: none; color: #333333; }\n")
.append(":target, .header:nth-last-child(2) { background-color: #cccccc; }\n")
.append(":target ~ .header:nth-last-child(2) { background-color: inherit; }\n")
.append(".header:focus, .header:hover,\n")
.append(" .header:nth-last-child(2):focus, .header:nth-last-child(2):hover\n")
.append(" { background-color: #999999; }\n")
.append(".section { position: absolute; top: 42px; min-width: 100%;\n")
.append(" padding-top: 18px; border-top: 1px solid #dddddd; }\n")
.append(".section > * { margin-left: 18px; }\n")
.append(":target + .section, .section:last-child { display: block; }\n")
.append(".section, :target + .section ~ .section { display: none; }\n")
.append("h1 { font-size: 18px; font-weight: normal; margin: 10px 0; }\n")
.append("h2 { font-size: 15px; }\n")
.append("h2:not(:first-child) { margin-top: 2em; }\n")
.append("table { border-collapse: collapse; border-spacing: 0;\n")
.append(" margin-top: 1.5em; }\n")
.append("table, thead { border-width: 1px 0; border-style: solid;\n")
.append(" border-color: #dddddd; text-align: left; }\n")
.append("th.name, td.name { padding: 1ex 2em 1ex 0; }\n")
.append("tbody > tr:hover { background-color: #cccccc; }\n")
.append(".code { font-family: \"Courier New\", monospace; }\n")
.append(".code, .tree li { line-height: 15px; }\n")
.append(".code a { text-decoration: underline; color: #666666; }\n")
.append(".xml .ns { font-style: italic; color: #999999; }\n")
.append("ul, .tree { list-style-type: none; }\n")
.append("div > ul.expr, div > .expand, .tree { padding-left: 0; }\n")
.append(".expr, .expand, .null, .numeric { padding-left: 1.5em; }\n")
.append("</style>\n")
.append("</head>\n")
.append("<body>\n");
char count = '0';
for (final DebugInfo part : parts) {
writer.append("<div class=\"header\" id=\"sec").append(++count).append("\">\n")
.append("<h1><a href=\"#sec").append(count).append("\">")
.append(part.getName())
.append("</a></h1>\n")
.append("</div>\n")
.append("<div class=\"section\">\n");
part.appendHtml(writer);
writer.append("</div>\n");
}
writer.append("</body>\n")
.append("</html>\n")
.close();
byte[] bytes = writer.toString().getBytes("UTF-8");
return new ByteArrayInputStream(bytes);
}