當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。