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


Java FacesContext.getAttributes方法代碼示例

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


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

示例1: isOptimizedPPREnabled

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
/**
 * Returns <code>true</code> if optimized PPR is enabled for this request.
 * @return <code>true</code> if optimized PPR is enabled for this request
 */
public static boolean isOptimizedPPREnabled(FacesContext context, boolean checkIsPPR)
{
  boolean optimizedPPREnabled = false;
        
  if (!checkIsPPR ||
      (PartialPageUtils.isPartialRequest(context) && PartialPageUtils.isPPRActive(context)))
  {
    Map<Object, Object> contextAttributes = context.getAttributes();
    
    Object optimizedPPR = contextAttributes.get(_OPTIMIZED_PPR_ENABLED_PROP);
    
    if (optimizedPPR != null)
    {
      optimizedPPREnabled = ((Boolean)optimizedPPR).booleanValue();
    }
    else
    {
      // default optimized ppr to off
      optimizedPPREnabled = "on".equalsIgnoreCase(_getPprOptimization(context));
      
      // cache the result into the context attributes
      contextAttributes.put(_OPTIMIZED_PPR_ENABLED_PROP, optimizedPPREnabled);
    }
  }
  
  return optimizedPPREnabled;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:32,代碼來源:PartialPageUtils.java

示例2: isSkipIterationVisit

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
/**
 * @param visitContext
 * @return <code>true</code> if this is a non-iterating visit.
 */
public static boolean isSkipIterationVisit(VisitContext visitContext)
{
  FacesContext context = visitContext.getFacesContext();
  Map<Object, Object> attrs = context.getAttributes();
  Object skipIteration = attrs.get("javax.faces.visit.SKIP_ITERATION");

  return Boolean.TRUE.equals(skipIteration);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:13,代碼來源:ComponentUtils.java

示例3: saveView

import javax.faces.context.FacesContext; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public Object saveView(FacesContext context)
{
  assert(context != null);

  // see if a view has been saved on the request
  Object viewState = _getCachedViewState(context);

  if (viewState != null)
  {
    // TODO gcrawfor
    //        when is this not null, meaning when is saveView being called multiple times
    //        per request?
    return viewState;
  }

  // if the root is transient don't state save
  UIViewRoot viewRoot = context.getViewRoot();

  if (viewRoot.isTransient())
  {
    return null;
  }

  String viewId = viewRoot.getViewId();
  StateManagementStrategy sms = _getStateManagementStrategy(context, viewId);
  Map<Object, Object> contextAttributes = context.getAttributes();
  
  try
  {
    contextAttributes.put(StateManager.IS_SAVING_STATE, Boolean.TRUE);
    
    if (sms != null)
    {
      // Force view root to use full state saving
      // This is necessary because we recreate the view root on postback when view root caching
      // is enabled and assume that that we can apply the full state
      if (_useViewRootCache(context, RequestContext.getCurrentInstance()))
      {
        viewRoot.clearInitialState();
      }
      
      viewState = sms.saveView(context);
    }
    else
    {
      // if there's no stateManagementStrategy handle saving the state ourselves
      _removeTransientComponents(viewRoot);

      Object structure = !_needStructure(context) ? null : new Structure(viewRoot);
      Object state = viewRoot.processSaveState(context);
      viewState = new Object[]{structure, state};

    }        
  }
  finally 
  {
    contextAttributes.remove(StateManager.IS_SAVING_STATE);
  }

  if (_saveAsToken(context, false))
  {
    viewState = _saveStateToCache(context, viewState, viewRoot);
  }

  _saveCachedViewState(context, viewState);
  return viewState;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:70,代碼來源:StateManagerImpl.java


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