當前位置: 首頁>>代碼示例>>Java>>正文


Java FacesContext.isProjectStage方法代碼示例

本文整理匯總了Java中javax.faces.context.FacesContext.isProjectStage方法的典型用法代碼示例。如果您正苦於以下問題:Java FacesContext.isProjectStage方法的具體用法?Java FacesContext.isProjectStage怎麽用?Java FacesContext.isProjectStage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.context.FacesContext的用法示例。


在下文中一共展示了FacesContext.isProjectStage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isDebugOutput

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
@Override
public boolean isDebugOutput()
{
  // 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;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:28,代碼來源:RequestContextImpl.java

示例2: _warnClientIdCachingConfig

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
private static void _warnClientIdCachingConfig(FacesContext context)
{
  if (_CLIENT_ID_CACHING != ClientIdCaching.ON &&
       context.isProjectStage(ProjectStage.Production) &&
       !_warnedClientIdCachingConfig(context))
  {
    _LOG.warning(
      "The org.apache.myfaces.trinidad.CLIENT_ID_CACHING system property is set to: " +
       _CLIENT_ID_CACHING +
      ".  For best performance, client id caching should be ON in production environments.");

    _clientIdCachingConfigWarned(context);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:15,代碼來源:UIXComponentBase.java

示例3: _isDebug

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
static private boolean _isDebug(FacesContext context)
{
  if (_debugJavascript == null)
  {
    String debugJavascript = context.
        getExternalContext().getInitParameter(_DEBUG_JAVASCRIPT);

    if (debugJavascript != null)
    {
      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; 
      }
    }
    else
    {
      // 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"); 
      }
    }
  }

  return _debugJavascript.booleanValue();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:47,代碼來源:LibraryScriptlet.java

示例4: _isTimestampCheckEnabled

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
/**
 * Reads org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION context param and determines if
 * the flag is enabled or not.
 * If the context parameter is not specified, default value used is: "false" for
 * ProjectStage.Production and "true" for all other stages.
 * For InternalViews this method always return "false"
 *
 * @param context
 * @param viewId
 * @return
 */
private boolean _isTimestampCheckEnabled(FacesContext context, String viewId)
{
  if (_checkTimestamp == null)
  {
    boolean productionStage = context.isProjectStage(ProjectStage.Production);
    boolean checkTimestamp;
    String checkTimestampContextParam =
      context.getExternalContext().getInitParameter(Configuration.CHECK_TIMESTAMP_PARAM);
    
    if (checkTimestampContextParam != null)
    {
      checkTimestamp = "true".equals(checkTimestampContextParam);
    }
    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
      checkTimestamp = !productionStage;
    }

    _checkTimestamp = Boolean.valueOf(checkTimestamp);

    // if Apache MyFaces Trinidad is running in ProjectStage.Production,
    // then CHECK_TIMESTAMP_PARAM should be FALSE, otherwise we generate a WARNING message
    if (productionStage && checkTimestamp)
    {
      _LOG.warning("TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION",
          Configuration.CHECK_TIMESTAMP_PARAM);
    }
  }

  // Even if _isTimestampCheckEnabled is TRUE, we do not want to perform the check for the InternalViews
  if (_checkTimestamp
        && getViewDeclarationLanguage(context, viewId) instanceof InternalViewHandlingStrategy)
  {
    return false;
  }

  return _checkTimestamp;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:54,代碼來源:ViewHandlerImpl.java

示例5: _isContentCompressionDisabled

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
private boolean _isContentCompressionDisabled(FacesContext context, RenderingContext arc)
{
  // 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".
  ExternalContext ec = context.getExternalContext();

  // first check to see if the DISABLE_CONTENT_COMPRESSION flag is
  // set on the request.
  String disableContentCompression = (String)ec.getRequestMap().get(Configuration.DISABLE_CONTENT_COMPRESSION);
  
  if(null == disableContentCompression || !("true".equals(disableContentCompression) || "false".equals(disableContentCompression)))
  {
    //Either nothing is set on the request or we have an invalid value that is NOT true or false.  This means we go with the ini setting.
    disableContentCompression = ec.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 not design time and
  // running with content compression disabled we generate a WARNING
  // message
  if (disableContentCompressionBoolean && context.isProjectStage(ProjectStage.Production)
        && !arc.isDesignTime())
  {
    _LOG.warning("DISABLE_CONTENT_COMPRESSION_IN_PRODUCTION_STAGE");
  }
  return disableContentCompressionBoolean;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:44,代碼來源:SkinImpl.java


注:本文中的javax.faces.context.FacesContext.isProjectStage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。