Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket DebugBar / DevUtils during production

The Wicket DebugBar from wicket-devutils adds a lot of useful information when debugging session / serialization issues. The documentation suggest that it should be added to a base page.

This approach seems to provide very weak support for differentiating between development and production environment. I don't want wicket-devutils as a production dependency and I most certainly do not want to clutter the code with "if development" branches.

How do "Wicket" people deal with this in real life applications? Are there any established patterns?

http://wicket.apache.org/apidocs/1.4/org/apache/wicket/devutils/debugbar/DebugBar.html

like image 294
Kimble Avatar asked Jan 16 '23 15:01

Kimble


2 Answers

DebugBar already overrides isVisible. So you do not have to do anything.

@Override
public boolean isVisible()
{
    return getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled();
}
like image 152
elnino3800 Avatar answered Feb 16 '23 14:02

elnino3800


In our case, we only add it when development utilities are enabled.

if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
    add(new DebugBar("dev"));
} else {
    add(new EmptyPanel("dev").setVisible(false));
}

The dependency is not that big, it is ok for us to let it in our production dependencies.

like image 37
Cedric Gatay Avatar answered Feb 16 '23 15:02

Cedric Gatay