beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryl Olander" <dolan...@bea.com>
Subject RE: svn commit: rev 36368 - in incubator/beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/pageflow/internal test/webapps/drt/coreWeb/index
Date Fri, 13 Aug 2004 20:02:37 GMT
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
> 

Mime
View raw message