detecting debug mode on server side

Hi all,

Is there a simple server-side API that allows me to check to see if the app is in debug mode. ApplicationConfiguration.isdebugmode() does not work on server side. Is there a server side equivalent of that? If not how would I go about getting this info?

Thanks

AbstractApplicationServlet has the method isProductionMode(), but I can’t quite remember how you call it from inside your application instance (might be app.getContext() and cast that).

For clarity: there are two different things: the client-side debug mode enabled with ?debug in the URL and server-side production mode vs. “development mode”.

The client side ?debug URL parameter is not separately communicated to the server, but is only available if the server is not running in production mode. On the client, $wnd.vaadin.debug contains information about whether the server side allows debug mode (i.e. server is not running in production mode), and ApplicationConfiguration.isDebugMode() checks it and then looks for the URL parameter ?debug.

On the server side, as Jouni mentioned, AbstractApplication[Servlet|Portlet]
.isProductionMode() checks the production mode setting (typically set in web.xml or portlet.xml).

The parameter ?debug could be extracted from the URL, but I don’t think there is any utility method for that in Vaadin core. You would then also have to check the production mode flag.

thank you. Checking the production mode flag is good enough for what I am trying to do. Thanks.

No, you can’t get access to the Servlet from the Context (as far as I know). So exactly how does one query the isProductionMode() method programmatically?


This ticket
contains an example how to read the production mode property from an Application class.

In Vaadin 7.2 you can use this:

VaadinService.getCurrent() .getDeploymentConfiguration().isProductionMode() It took me awhile to figure it out…