当前位置: 首页>>代码示例>>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;未经允许,请勿转载。