public RestWriter beginDocument(final String baseUrl, final String propertyView) throws IOException {
String currentType = baseUrl.replace(restPath + "/", "").replace("/" + propertyView, "");
Tag head = doc.block("head");
head.empty("link").attr(new Rel("stylesheet"), new Type("text/css"), new Href("//structr.org/rest.css"));
head.inline("script").attr(new Type("text/javascript"), new Src("//structr.org/CollapsibleLists.js"));
head.inline("title").text(baseUrl);
Tag body = doc.block("body").attr(new Onload("CollapsibleLists.apply(true);"));
Tag top = body.block("div").id("top");
final App app = StructrApp.getInstance(securityContext);
final Tag left = body.block("div").id("left");
try (final Tx tx = app.tx()) {
for (SchemaNode node : app.nodeQuery(SchemaNode.class).getAsList()) {
final String rawType = node.getName();
top.inline("a").attr(new Href(restPath + "/" + rawType), new If(rawType.equals(currentType), new Css("active"))).text(rawType);
}
} catch (Throwable t) {
t.printStackTrace();
}
for (String view : StructrApp.getConfiguration().getPropertyViews()) {
if (!hiddenViews.contains(view)) {
left.inline("a").attr(new Href(restPath + "/" + currentType + "/" + view), new If(view.equals(propertyView), new Css("active"))).text(view);
}
}
// main div
currentElement = body.block("div").id("right");