Skip to content

Commit

Permalink
Added local scope info to the debug widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Jun 8, 2015
1 parent 22e8016 commit 4c29309
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions rapidoid-widget/src/main/java/org/rapidoid/widget/DebugWidget.java
Expand Up @@ -33,15 +33,31 @@ public class DebugWidget extends AbstractWidget {


@Override @Override
protected Object render() { protected Object render() {
return arr(sessionPanel(), localPanel());
}


Map<String, Object> visibleSessionAttributes = U.map(); protected PanelWidget sessionPanel() {
Map<String, Object> visibleAttributes = U.map();


for (Entry<String, Object> e : ctx().session().entrySet()) { for (Entry<String, Object> e : ctx().session().entrySet()) {
if (!e.getKey().startsWith("_")) { if (!e.getKey().startsWith("_")) {
visibleSessionAttributes.put(e.getKey(), e.getValue()); visibleAttributes.put(e.getKey(), e.getValue());
} }
} }


return panel(grid(visibleSessionAttributes)).header("Session"); return panel(grid(visibleAttributes)).header("Session scope");
} }

protected PanelWidget localPanel() {
Map<String, Object> visibleAttributes = U.map();

for (Entry<String, Object> e : ctx().locals().entrySet()) {
if (!e.getKey().startsWith("_")) {
visibleAttributes.put(e.getKey(), e.getValue());
}
}

return panel(grid(visibleAttributes)).header("Local scope");
}

} }

0 comments on commit 4c29309

Please sign in to comment.