You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/12/21 14:00:39 UTC
svn commit: r892807 - in /myfaces/trinidad/branches/trinidad-2.0.x:
src/site/xdoc/devguide/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/
trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/
trinidad-impl/src/ma...
Author: matzew
Date: Mon Dec 21 13:00:38 2009
New Revision: 892807
URL: http://svn.apache.org/viewvc?rev=892807&view=rev
Log:
TRINIDAD-1652 - Use JSF ProjectState API for some configuration parameters
Modified:
myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/LibraryScriptlet.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
Modified: myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml Mon Dec 21 13:00:38 2009
@@ -415,20 +415,23 @@
</subsection>
<subsection name="org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT">
<p>
-Apache Trinidad by default obfuscates the Javascript it delivers
-to the client, as well as stripping comments and whitespace.
-This dramatically reduces the size of our Javascript download,
-but also makes it tricky to debug the Javascript. This
-flag can be set to true to turn off the obfuscation.
+For applications that run in ProjectStage.Production, Apache Trinidad by default
+obfuscates the Javascript it delivers to the client, as well as stripping
+comments and whitespace. This dramatically reduces the size of our Javascript
+download, but also makes it tricky to debug the Javascript. In other stages the
+default value is TRUE. However, a user can override the ProjectStage behavior
+by using this flag.
</p>
</subsection>
<subsection name="org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION">
<p>
-Apache Trinidad by default compresses the style class names inside the css that
-is generated on the server. However, when developing custom Trinidad skins, it
-is much easier to work with the non-compressed style class names, which much more
-directly relate to those used in the skin css file. This flag can be set to turn
-off automatic compression of style class names.
+For applications that run in ProjectStage.Production, Apache Trinidad by default
+compresses the style class names inside the css that is generated on the server.
+However, when developing custom Trinidad skins, it is much easier to work with
+the non-compressed style class names, which much more directly relate to those
+used in the skin css file. There for in all other stages (like Development) the
+compression is turned off. However, a user can override the ProjectStage
+behavior by using this flag.
</p>
</subsection>
<subsection name="org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION">
@@ -437,7 +440,9 @@
check the modification date of your JSPs and skinning CSS files, and discard saved
state when they change; this makes development easier,
but adds overhead that should be avoided when your application
-is deployed.
+is deployed. For applications that run in ProjectStage.Production, the value is
+"false" and all other stages use "true" as their default value. However, a user
+can override the ProjectStage behavior by using this flag.
</p>
</subsection>
<subsection name="org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS">
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java Mon Dec 21 13:00:38 2009
@@ -36,10 +36,14 @@
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
+import javax.faces.application.ProjectStage;
import javax.faces.context.FacesContext;
import javax.faces.context.FacesContextFactory;
import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -403,11 +407,120 @@
debug = config.getServletContext().getInitParameter(DEBUG_INIT_PARAM);
}
- _debug = "true".equalsIgnoreCase(debug);
+ // private call to get the used JSF 2.0 ProjectStage as we don't have
+ // access to the FacesContext object here...
+ ProjectStage currentStage = _getFacesProjectStage(config.getServletContext());
+
+ if (debug != null)
+ {
+ _debug = "true".equalsIgnoreCase(debug);
+ }
+ else
+ {
+ // if the DDEBUG_INIT_PARAM parameter has NOT been specified, let us
+ // apply the DEFAULT values for the certain Project Stages:
+ // -PRODUCTION we want this value to be FALSE;
+ // -other stages we use TRUE
+ _debug = !(ProjectStage.Production.equals(currentStage));
+ }
+
if (_debug)
{
- _LOG.info("RESOURCESERVLET_IN_DEBUG_MODE",DEBUG_INIT_PARAM);
+ // If DEBUG_INIT_PARAM is TRUE on Production-Stage, we
+ // generate a WARNING msg
+ if (ProjectStage.Production.equals(currentStage))
+ {
+ _LOG.warning("RESOURCESERVLET_IN_DEBUG_MODE",DEBUG_INIT_PARAM);
+ }
+ else
+ {
+ _LOG.info("RESOURCESERVLET_IN_DEBUG_MODE",DEBUG_INIT_PARAM);
+ }
+ }
+ }
+
+ /**
+ * private version of the <code>Application.getProjectStage()</code>. See the
+ * original JavaDoc for a description of the underlying algorithm.
+ *
+ * It is written as we do not have access to the FacesContext object at the point
+ * of executing this method.
+ *
+ * This code comes from the <b>Apache MyFaces 2.0</b> implementation.
+ */
+ private ProjectStage _getFacesProjectStage(ServletContext servletContext)
+ {
+ if (_projectStage == null)
+ {
+ String stageName = null;
+ // Look for a JNDI environment entry under the key given by the
+ // value of ProjectStage.PROJECT_STAGE_JNDI_NAME (a String)
+ try
+ {
+ Context ctx = new InitialContext();
+ Object temp = ctx.lookup(ProjectStage.PROJECT_STAGE_JNDI_NAME);
+ if (temp != null)
+ {
+ if (temp instanceof String)
+ {
+ stageName = (String) temp;
+ }
+ else
+ {
+ if (_LOG.isSevere())
+ {
+ _LOG.severe("Invalid JNDI lookup for key " + ProjectStage.PROJECT_STAGE_JNDI_NAME);
+ }
+ }
+ }
+ }
+ catch (NamingException e)
+ {
+ // no-op we need to ignore this...
+ }
+
+ /*
+ * If found, continue with the algorithm below, otherwise, look for an entry in the initParamMap of the
+ * ExternalContext from the current FacesContext with the key ProjectStage.PROJECT_STAGE_PARAM_NAME
+ */
+ if (stageName == null)
+ {
+ stageName = servletContext.getInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME);
+ }
+
+ // If a value is found found
+ if (stageName != null)
+ {
+ /*
+ * see if an enum constant can be obtained by calling ProjectStage.valueOf(), passing the value from the
+ * initParamMap. If this succeeds without exception, save the value and return it.
+ */
+ try
+ {
+ _projectStage = ProjectStage.valueOf(stageName);
+ return _projectStage;
+ }
+ catch (IllegalArgumentException e)
+ {
+ _LOG.severe("Couldn't discover the current project stage", e);
+ }
+ }
+ else
+ {
+ if (_LOG.isInfo())
+ {
+ _LOG.info("Couldn't discover the current project stage, using " + ProjectStage.Production);
+ }
+ }
+ /*
+ * If not found, or any of the previous attempts to discover the enum constant value have failed, log a
+ * descriptive error message, assign the value as ProjectStage.Production and return it.
+ */
+
+ _projectStage = ProjectStage.Production;
}
+
+ return _projectStage;
}
/**
@@ -548,4 +661,5 @@
private Map<String, ResourceLoader> _loaders;
private FacesContextFactory _facesContextFactory;
private Lifecycle _lifecycle;
+ private ProjectStage _projectStage;
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java Mon Dec 21 13:00:38 2009
@@ -36,6 +36,7 @@
import java.util.Set;
import javax.faces.FacesException;
+import javax.faces.application.ProjectStage;
import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;
import javax.faces.component.UIViewRoot;
@@ -394,18 +395,48 @@
{
if (_checkTimestamp == null)
{
+ boolean checkTimestampParam;
String checkTimestamp =
context.getExternalContext().getInitParameter(Configuration.CHECK_TIMESTAMP_PARAM);
+
+ if (checkTimestamp != null)
+ {
+ checkTimestampParam = "true".equals(checkTimestamp);
+ }
+ else
+ {
+ // if the CHECK_TIMESTAMP_PARAM parameter has NOT been specified, let us
+ // apply the DEFAULT values for the certain Project Stages:
+ // -PRODUCTION we want this value to be FALSE;
+ // -other stages we use TRUE
+ checkTimestampParam = !(context.isProjectStage(ProjectStage.Production));
+ }
+
// Detect when we're running inside of the JDeveloper embedded OC4J
// environment - and there, always use timestamp checking
- // TODO: come up with a non-proprietary way of checking this?
- boolean performCheck = "true".equals(checkTimestamp) ||
+ // TODO: come up with a non-proprietary way of checking this? (see TRINIDAD-1661)
+ boolean developmentStage = context.isProjectStage(ProjectStage.Development) ||
"development".equals(System.getProperty("oracle.application.environment"));
+
+ // if Apache MyFaces Trinidad is running in production stage CHECK_TIMESTAMP_PARAM should
+ // be FALSE, otherwise we generate a WARNING message
+ boolean productionStage = developmentStage || context.isProjectStage(ProjectStage.Production);
+
+ boolean performCheck = checkTimestampParam || developmentStage;
_checkTimestamp = Boolean.valueOf(performCheck);
- if ("true".equals(checkTimestamp))
+
+ if (checkTimestampParam)
{
- _LOG.info("TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION",
- Configuration.CHECK_TIMESTAMP_PARAM);
+ if (productionStage)
+ {
+ _LOG.warning("TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION",
+ Configuration.CHECK_TIMESTAMP_PARAM);
+ }
+ else
+ {
+ _LOG.info("TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION",
+ Configuration.CHECK_TIMESTAMP_PARAM);
+ }
}
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java Mon Dec 21 13:00:38 2009
@@ -33,6 +33,7 @@
import java.util.Set;
import java.util.TimeZone;
+import javax.faces.application.ProjectStage;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -223,8 +224,29 @@
@Override
public boolean isDebugOutput()
{
- return Boolean.TRUE.equals(
- _bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY));
+ // FALSE is the default value...
+ boolean debugOutput = Boolean.TRUE.equals(
+ _bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY));
+
+ FacesContext fc = FacesContext.getCurrentInstance();
+
+ if (fc.isProjectStage(ProjectStage.Production))
+ {
+ // on production we always want FALSE, unless the
+ // user explicitly set the config to TRUE, but
+ // generate a WARNING message for that.
+ if (debugOutput)
+ {
+ _LOG.warning("DEBUG_OUTPUT_TRUE_IN_PRODUCTION_STAGE");
+ return true;
+ }
+
+ return false;
+ }
+ else
+ {
+ return debugOutput;
+ }
}
@Override
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java Mon Dec 21 13:00:38 2009
@@ -22,6 +22,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
+import javax.faces.application.ProjectStage;
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.context.AccessibilityProfile;
@@ -33,7 +34,6 @@
import org.apache.myfaces.trinidad.style.Styles;
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.HtmlRenderer;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.StyleSheetRenderer;
import org.apache.myfaces.trinidadinternal.share.config.Configuration;
import org.apache.myfaces.trinidadinternal.skin.SkinStyleProvider;
import org.apache.myfaces.trinidadinternal.style.StyleContext;
@@ -111,9 +111,16 @@
}
public boolean checkStylesModified()
{
+ // TODO: similar code is present in the ViewHanlder;
+ // this needs to be factored out into a common util.
+ // See TRINIDAD-1662
+
FacesContext context = FacesContext.getCurrentInstance();
String checkTimestamp =
context.getExternalContext().getInitParameter(Configuration.CHECK_TIMESTAMP_PARAM);
+
+ // in production stage we don't want TRUE here;
+ // a WARNING will be triggered by the ViewHandlerImpl.java
return "true".equals(checkTimestamp);
}
@@ -154,7 +161,7 @@
/**
*
* @return true if we should disable style compression. e.g.,
- * if StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION is true or the skin is a portlet skin
+ * if Configuration.DISABLE_CONTENT_COMPRESSION is true or the skin is a portlet skin
* or we are in portlet mode and not doing skin sharing.
*/
public boolean isDisableStyleCompression()
@@ -164,14 +171,38 @@
FacesContext context = FacesContext.getCurrentInstance();
String disableContentCompression =
context.getExternalContext().
- getInitParameter(StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION);
- boolean disableContentCompressionBoolean = "true".equals(disableContentCompression);
+ getInitParameter(Configuration.DISABLE_CONTENT_COMPRESSION);
+ boolean disableContentCompressionBoolean;
+
+ // what value has been specified for the DISABLE_CONTENT_COMPRESSION param?
+ if (disableContentCompression != null)
+ {
+ disableContentCompressionBoolean = "true".equals(disableContentCompression);
+ }
+ else
+ {
+ // if the DISABLE_CONTENT_COMPRESSION parameter has NOT been specified, let us
+ // apply the DEFAULT values for the certain Project Stages:
+ // -PRODUCTION we want this value to be FALSE;
+ // -other stages we use TRUE
+ disableContentCompressionBoolean = !(context.isProjectStage(ProjectStage.Production));
+ }
// the user wants to explicitly disable the content compression and show the full styleclass
// names
if (disableContentCompressionBoolean)
+ {
_isDisableStyleCompression = Boolean.TRUE;
+ // if Apache MyFaces Trinidad is running in production stage and
+ // running with content compression disabled we generate a WARNING
+ // message
+ if (context.isProjectStage(ProjectStage.Production))
+ {
+ _LOG.warning("DISABLE_CONTENT_COMPRESSION_IN_PRODUCTION_STAGE");
+ }
+ }
+
// we still need to check if we don't want to compress even if the disable content
// compression flag is true
if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(_arc.getOutputMode()))
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java Mon Dec 21 13:00:38 2009
@@ -44,21 +44,6 @@
*/
public class StyleSheetRenderer extends XhtmlRenderer
{
- /**
- * Disables optimizations that are normally performed by the
- * Trinidad Renderers to reduce content size.
- * <p>
- * This Boolean property controls whether or not Trinidad Renderer
- * implementations should attempt to reduce the size of generated
- * content, for example, by compressing style class names. These
- * optimizations are enabled by default. In general,
- * users should not need to disable these optimizations. However,
- * users who want to build custom skins for Trinidad will find this
- * setting essential. Use Boolean.TRUE to disable compression.
- */
- static public final String DISABLE_CONTENT_COMPRESSION =
- "org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION";
-
public StyleSheetRenderer()
{
this(CoreStyleSheet.TYPE);
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/LibraryScriptlet.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/LibraryScriptlet.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/LibraryScriptlet.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/LibraryScriptlet.java Mon Dec 21 13:00:38 2009
@@ -21,6 +21,8 @@
import java.io.IOException;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
+import javax.faces.application.ProjectStage;
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
@@ -184,15 +186,37 @@
{
String debugJavascript = context.
getExternalContext().getInitParameter(_DEBUG_JAVASCRIPT);
- if ((debugJavascript != null) &&
- debugJavascript.equalsIgnoreCase("true"))
+
+ if (debugJavascript != null)
{
- _debugJavascript = Boolean.TRUE;
- _LOG.info("RUNNING_DEBUG_JAVASCRIPT");
+ if (debugJavascript.equalsIgnoreCase("true"))
+ {
+ _debugJavascript = Boolean.TRUE;
+
+ // if Apache MyFaces Trinidad is running in production stage
+ // running with JavaScript debugging is not desired, therefore
+ // we generate a WARNING message; otherwise we just inform the user
+ if (context.isProjectStage(ProjectStage.Production))
+ {
+ _LOG.warning("RUNNING_DEBUG_JAVASCRIPT_IN_PRODUCTION_STAGE");
+ }
+ else
+ {
+ _LOG.info("RUNNING_DEBUG_JAVASCRIPT");
+ }
+ }
}
else
{
- _debugJavascript = Boolean.FALSE;
+ // if the _DEBUG_JAVASCRIPT parameter has NOT been specified, let us
+ // apply the DEFAULT values for the certain Project Stages:
+ // -PRODUCTION we want this value to be FALSE;
+ // -other stages we use TRUE
+ _debugJavascript = !(context.isProjectStage(ProjectStage.Production));
+ if (_debugJavascript)
+ {
+ _LOG.info("RUNNING_DEBUG_JAVASCRIPT");
+ }
}
}
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java Mon Dec 21 13:00:38 2009
@@ -35,6 +35,7 @@
import javax.el.ELContext;
import javax.el.ValueExpression;
+import javax.faces.application.ProjectStage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -921,9 +922,37 @@
// else return false.
private boolean _isDisableContentCompressionParameterTrue(FacesContext context)
{
- ExternalContext external = context.getExternalContext();
+ // TODO: this section needs to be MOVED up, perhaps to API,
+ // as the StyleContextIMPL.java has exactly the same code;
+ // this will be fixed with the advent of "TRINIDAD-1662".
+
+ String disableContentCompression = context.getExternalContext().
+ getInitParameter(Configuration.DISABLE_CONTENT_COMPRESSION);
- return "true".equals(external.getInitParameter(Configuration.DISABLE_CONTENT_COMPRESSION));
+ boolean disableContentCompressionBoolean;
+
+ // what value has been specified for the DISABLE_CONTENT_COMPRESSION param?
+ if (disableContentCompression != null)
+ {
+ disableContentCompressionBoolean = "true".equals(disableContentCompression);
+ }
+ else
+ {
+ // if the DISABLE_CONTENT_COMPRESSION parameter has NOT been specified, let us
+ // apply the DEFAULT values for the certain Project Stages:
+ // -PRODUCTION we want this value to be FALSE;
+ // -other stages we use TRUE
+ disableContentCompressionBoolean = !(context.isProjectStage(ProjectStage.Production));
+ }
+
+ // if Apache MyFaces Trinidad is running in production stage and
+ // running with content compression disabled we generate a WARNING
+ // message
+ if (disableContentCompressionBoolean && context.isProjectStage(ProjectStage.Production))
+ {
+ _LOG.warning("DISABLE_CONTENT_COMPRESSION_IN_PRODUCTION_STAGE");
+ }
+ return disableContentCompressionBoolean;
}
// a TranslationSource fills in the keyValueMap differently depending upon
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts?rev=892807&r1=892806&r2=892807&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts Mon Dec 21 13:00:38 2009
@@ -372,7 +372,7 @@
<resource key="TREE_COMPONENT_MUST_INSIDE_FORM">The tree component must be used inside of a form.</resource>
<!-- CANNOT_FIND_SCRIPTLET -->
-<resource key="CANNOT_FIND_SCRIPTLET">Couldn''t find scriptlet: {0}</resource>
+<resource key="CANNOT_FIND_SCRIPTLET">Could not find scriptlet: {0}</resource>
<!-- UNABLE_GET_RESOURCE -->
<resource key="UNABLE_GET_RESOURCE">Unable to get resource {0}</resource>
@@ -380,6 +380,15 @@
<!-- RUNNING_DEBUG_JAVASCRIPT -->
<resource key="RUNNING_DEBUG_JAVASCRIPT">Apache Trinidad is running with debug javascript. Do not use in a production environment. See the "org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT" parameter in /WEB-INF/web.xml</resource>
+<!-- RUNNING_DEBUG_JAVASCRIPT_IN_PRODUCTION_STAGE -->
+<resource key="RUNNING_DEBUG_JAVASCRIPT_IN_PRODUCTION_STAGE">Your environment is configured as production and Apache Trinidad is running with debug javascript. See the "org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT" parameter in /WEB-INF/web.xml</resource>
+
+<!-- DISABLE_CONTENT_COMPRESSION_IN_PRODUCTION_STAGE -->
+<resource key="DISABLE_CONTENT_COMPRESSION_IN_PRODUCTION_STAGE">Your environment is configured as production and Apache Trinidad is running with debug javascript. See the "org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT" parameter in /WEB-INF/web.xml</resource>
+
+<!-- DEBUG_OUTPUT_TRUE_IN_PRODUCTION_STAGE -->
+<resource key="DEBUG_OUTPUT_TRUE_IN_PRODUCTION_STAGE">Your environment is configured as production and Apache Trinidad is running with debug-output TRUE. See the "debug-output" element in trinidad-config.xml file.</resource>
+
<!-- ILLEGAL_VALUE -->
<resource key="ILLEGAL_VALUE">Illegal value:{0} for {1}</resource>