You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Daryl Olander <do...@bea.com> on 2004/08/13 22:02:37 UTC
RE: svn commit: rev 36368 - in incubator/beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/pageflow/internal test/webapps/drt/coreWeb/index
Sorry, production mode is enabled if asserts are off...
> -----Original Message-----
> From: dolander@apache.org [mailto:dolander@apache.org]
> Sent: Friday, August 13, 2004 2:00 PM
> To: beehive-cvs@incubator.apache.org
> Subject: svn commit: rev 36368 - in incubator/beehive/trunk/netui:
> src/pageflow/org/apache/beehive/netui/pageflow/internal
> test/webapps/drt/coreWeb/index
>
>
> Author: dolander
> Date: Fri Aug 13 13:00:04 2004
> New Revision: 36368
>
> Added:
>
> incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/index/d
> evMode.jsp
> Modified:
>
> incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/
> netui/pageflow/internal/DefaultServerAdapter.java
> Log:
> I've tied the notion of production mode into running the
> server with Asserts turned on.
>
>
>
>
> Modified:
> incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/
> netui/pageflow/internal/DefaultServerAdapter.java
> ==============================================================
> ================
> ---
> incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/
> netui/pageflow/internal/DefaultServerAdapter.java (original)
> +++
> incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/
> netui/pageflow/internal/DefaultServerAdapter.java Fri Aug
> 13 13:00:04 2004
> @@ -33,14 +33,24 @@
>
> public class DefaultServerAdapter implements ServerAdapter
> {
> - public static final String DEV_MODE_PROPERTY =
> "pageflow:devmode";
> -
> - private static final boolean DEV_MODE =
> Boolean.parseBoolean( System.getProperty( DEV_MODE_PROPERTY ) );
> -
> -
> + private static boolean devMode = false;
> + private static boolean modeInit = false;
> + private static void initProductionMode() {
> + try {
> + assert(false);
> + }
> + catch (AssertionError e) {
> + devMode = true;
> + }
> + modeInit = true;
> + }
> +
> public boolean isInProductionMode()
> {
> - return ! DEV_MODE;
> + if (!modeInit) {
> + initProductionMode();
> + }
> + return ! devMode;
> }
>
> public ServletContext getServletContext(
> HttpServletRequest request )
>
> Added:
> incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/index/d
> evMode.jsp
> ==============================================================
> ================
> --- (empty file)
> +++
> incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/index/d
> evMode.jsp Fri Aug 13 13:00:04 2004
> @@ -0,0 +1,16 @@
> +<%@ page language="java" contentType="text/html;charset=UTF-8"%>
>
> +<%@ page
> import="org.apache.beehive.netui.pageflow.internal.InternalUtils"%>
>
> +<html>
>
> +<head><title>Production Mode Test</title></head>
>
> +<body>
>
> +<h4>Production Mode Test</h4>
>
> +<%
>
> + boolean sa =
> InternalUtils.getServerAdapter().isInProductionMode();
>
> + pageContext.setAttribute("prodMode",new Boolean(sa));
>
> +%>
>
> +<p>
>
> +Dev Mode: <b>${!pageScope.prodMode}</b><br>
>
> +Production Mode: <b>${pageScope.prodMode}</b>
>
> +</p>
>
> +</body>
>
> +</html>
> \ No newline at end of file
>