当前位置: 首页>>代码示例>>Java>>正文


Java ExternalContext.getApplicationMap方法代码示例

本文整理汇总了Java中javax.faces.context.ExternalContext.getApplicationMap方法的典型用法代码示例。如果您正苦于以下问题:Java ExternalContext.getApplicationMap方法的具体用法?Java ExternalContext.getApplicationMap怎么用?Java ExternalContext.getApplicationMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.context.ExternalContext的用法示例。


在下文中一共展示了ExternalContext.getApplicationMap方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getPprOptimization

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
 * Returns the value of the PPR optimization parameter.  We currently support "on" and "off"
 * @param context
 * @return
 */
private static String _getPprOptimization(FacesContext context)
{
  ExternalContext external = context.getExternalContext();
  
  Map<String, Object> applicationMap = external.getApplicationMap();
  
  // first check if this has been overridden at the application level
  String pprOptimization = (String)applicationMap.get(_PPR_OPTIMIZATION_PROP);
  
  if (pprOptimization == null)
  {
    // the value hasn't been set, so check the initialization parameter
    pprOptimization = external.getInitParameter(_PPR_OPTIMIZATION_PROP);
    
    // default to "off"
    if (pprOptimization == null)
      pprOptimization = "off";
    
    // cache in the application so that we don't need to fetch this again
    applicationMap.put(_PPR_OPTIMIZATION_PROP, pprOptimization);
  }
  
  return pprOptimization;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:30,代码来源:PartialPageUtils.java

示例2: setUp

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
@Override
protected void setUp() throws IOException
{
  MFacesContext ctx = new MFacesContext(MApplication.sharedInstance(), true);
  ExternalContext externalContext = ctx.getExternalContext();

  Map<String, Object> applicationMap = externalContext.getApplicationMap();
  applicationMap.put(TrinidadSkinProvider.TRINDIAD_SKIN_PROVIDER_KEY,
                     new TrinidadSkinProvider());
  applicationMap.put(ExternalSkinProvider.EXTERNAL_SKIN_PROVIDER_KEY,
                     new ExternalSkinProvider());
  applicationMap.put(SkinProvider.SKIN_PROVIDER_INSTANCE_KEY,
                     new SkinProviderRegistry());
  _facesContext = ctx;
  _externalContext = externalContext;
  _provider = SkinProvider.getCurrentInstance(_externalContext);

  if (SkinFactory.getFactory() == null)
    SkinFactory.setFactory(new SkinFactoryImpl());
  RenderKitBootstrap.setFactories(_facesConfigInfo);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:SkinProviderTest.java

示例3: getContentHandlerMap

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
* Returns the map of content handlers
* which hold the state of one XML tree.
* @param scopeMap
* @return
*/
 protected Map<Object, List<MenuContentHandler> > getContentHandlerMap()
 {
   FacesContext facesContext = FacesContext.getCurrentInstance();
   ExternalContext externalContext = facesContext.getExternalContext();
   Map<String, Object> scopeMap =
       externalContext.getApplicationMap();
  Object lock  = externalContext.getContext();
  
  // cannot use double checked lock here as
  // we cannot mark the reference as volatile
  // therefore any reads should happen inside
  // a synchronized block.
  synchronized (lock)
  {
    TransientHolder<Map<Object, List<MenuContentHandler> >> holder =  
      (TransientHolder<Map<Object, List<MenuContentHandler> >>) scopeMap.get(_CACHED_MODELS_KEY);
     Map<Object, List<MenuContentHandler>> contentHandlerMap = (holder != null) ? holder.getValue() : null;
     if (contentHandlerMap == null)
     {
       contentHandlerMap =
           new ConcurrentHashMap<Object, List<MenuContentHandler>>();
       scopeMap.put(_CACHED_MODELS_KEY, TransientHolder.newTransientHolder( contentHandlerMap) );
       scopeMap.put(_CACHED_MODELS_ID_CNTR_KEY,new AtomicInteger(-1));
     }
     return contentHandlerMap;
   }
   
 }
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:XMLMenuModel.java

示例4: getContentHandlerId

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
protected int getContentHandlerId()
{
  FacesContext facesContext = FacesContext.getCurrentInstance();
  ExternalContext externalContext = facesContext.getExternalContext();
  Map<String, Object> scopeMap =
      externalContext.getApplicationMap();
  AtomicInteger counter = (AtomicInteger) scopeMap.get(_CACHED_MODELS_ID_CNTR_KEY);
  return counter.getAndIncrement();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:XMLMenuModel.java

示例5: _warnedClientIdCachingConfig

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
private static boolean _warnedClientIdCachingConfig(FacesContext context)
{
  ExternalContext external = context.getExternalContext();
  Map<String, Object> appMap = external.getApplicationMap();

  return Boolean.TRUE.equals(appMap.get(_WARNED_CLIENT_ID_CACHING_KEY));
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:8,代码来源:UIXComponentBase.java

示例6: _clientIdCachingConfigWarned

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
private static void _clientIdCachingConfigWarned(FacesContext context)
{
  ExternalContext external = context.getExternalContext();
  Map<String, Object> appMap = external.getApplicationMap();

  appMap.put(_WARNED_CLIENT_ID_CACHING_KEY, Boolean.TRUE);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:8,代码来源:UIXComponentBase.java

示例7: _generateDesignTimeURL

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
 * This method returns the modified URL for design time to pick up the resources
 * from the Trinidad jar, and dynamic resources from temp cache directory.
 */
@SuppressWarnings("unchecked")
private static String _generateDesignTimeURL(
  UIXRenderingContext context,
  String baseURL
  )
{
  String designTimeURL;
  String tempCacheDirectory;
  String resourceDirectoryPath;

  Configuration configInfo = context.getConfiguration();
  ExternalContext external = context.getFacesContext().getExternalContext();

  String contextURI = external.getRequestContextPath();

  // Ignore javascripts for design time
  boolean isJavascript =
     (baseURL.indexOf((String)Configuration.JSLIBS_DIRECTORY)!=-1);

  if (!baseURL.equals(configInfo.getURI(Configuration.IMAGES_CACHE_DIRECTORY,
                                        contextURI))
      && !baseURL.equals(configInfo.getURI(Configuration.STYLES_CACHE_DIRECTORY,
                                           contextURI))
      && !isJavascript)
  {
     designTimeURL =
       (ClassLoaderUtils.getResource( _BASE_DIRECTORY + baseURL)).toString();
  }
  else
  {
    Map<String, Object> appMap = external.getApplicationMap();
    if (appMap.get("javax.servlet.context.tempdir")==null)
    {
      resourceDirectoryPath = baseURL.substring(baseURL.indexOf('/') + 1);
      tempCacheDirectory    = System.getProperty("java.io.tmpdir");

      designTimeURL = "file:" + File.separator + tempCacheDirectory
                       + resourceDirectoryPath;
    }
    else
    {
      resourceDirectoryPath = baseURL;
      tempCacheDirectory    =
        ((File)appMap.get("javax.servlet.context.tempdir")).getAbsolutePath();
      designTimeURL = tempCacheDirectory + resourceDirectoryPath;
    }
  }

  return designTimeURL;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:55,代码来源:BaseLafUtils.java

示例8: SerializationChecker

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
/**
 * Creates a SerializationChecker for this request
 * @param extContext               ExternalContext to use to initialize the SerializationChecker
 * @param checkSession If true check serializability of session attributes 
 * @param checkApplication if true, check serializability of application attributes
 * @param checkManagedBeanMutation if true, check for mutations to attributes in the session
 *                                 if checkSession is true and the application if
 *                                 checkApplication is true.
 */
private SerializationChecker(
  ExternalContext extContext,
  boolean checkSession,
  boolean checkApplication,
  boolean checkManagedBeanMutation,
  boolean checkSessionAtEnd)
{
  Map<String, Object> sessionMap = extContext.getSessionMap();
  Map<String, Object> applicationMap = extContext.getApplicationMap();
  
  if (checkManagedBeanMutation)
  {
    // note that the mutated bean checekd implicitly checks for attribute serialization as well.
    _sessionBeanChecker = new MutatedBeanChecker(sessionMap,
                                                 "Session",
                                                 extContext.getSession(true),
                                                 true);
    sessionMap = CollectionUtils.newMutationHookedMap(sessionMap, _sessionBeanChecker);
    
    // only check the application for mutations if the application checking is enabled
    if (checkApplication)
    {
      _applicationBeanChecker = new MutatedBeanChecker(applicationMap,
                                                       "Application",
                                                       extContext.getContext(),
                                                       false);
      applicationMap = CollectionUtils.newMutationHookedMap(applicationMap,
                                                            _applicationBeanChecker);
    }
    else
    {
      _applicationBeanChecker = null;
    }
  }
  else
  {
    _sessionBeanChecker     = null;
    _applicationBeanChecker = null;
    
    if (checkSession)
    {
      sessionMap = CollectionUtils.getCheckedSerializationMap(sessionMap, true);
    }

    if (checkApplication)
    {
      applicationMap =  CollectionUtils.getCheckedSerializationMap(applicationMap, false);
    }        
  }
        
  _sessionMap     = sessionMap;
  _applicationMap = applicationMap;
  _checkSessionAttrs = checkSessionAtEnd;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:64,代码来源:CheckSerializationConfigurator.java

示例9: Handler

import javax.faces.context.ExternalContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Handler(RequestContextBean bean, ExternalContext context)
{
    _applicationMap = context.getApplicationMap();
    _bean = bean;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:7,代码来源:ConfigParser.java


注:本文中的javax.faces.context.ExternalContext.getApplicationMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。