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


Java ExternalContext.getInitParameter方法代碼示例

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


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

示例1: TrinidadComponentHandler

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
public TrinidadComponentHandler(ComponentConfig config) 
{
  super(config);
  if (_markInitialState == null)
  {
    // Can't imagine why this wouldn't always run during
    // a Faces request...
    FacesContext context = FacesContext.getCurrentInstance();
    if (context != null)
    {
      ExternalContext external = context.getExternalContext();
      String restoreMode = external.getInitParameter(
                                                   StateManager.PARTIAL_STATE_SAVING_PARAM_NAME);
      
      if (Boolean.valueOf(restoreMode))
      {
        _markInitialState = Boolean.TRUE;
        _LOG.severe("PARTIAL_STATE_SAVING_NOT_SUPPORTED");
      }
      else
      {
        _markInitialState = Boolean.FALSE;
      }
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:TrinidadComponentHandler.java

示例2: _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

示例3: _getInitParamFileNamingStrategy

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private StyleSheetNamingStrategy _getInitParamFileNamingStrategy()
{
  ExternalContext external = _arc.getFacesContext().getExternalContext();
  String strategyParam = external.getInitParameter(_NAMING_STRATEGY_PARAM);
    
  if (strategyParam != null)
  {
    strategyParam = strategyParam.trim();

    if (strategyParam.length() > 0)
    {
      try
      {
        return StyleSheetNamingStrategy.valueOfDisplayName(strategyParam);
      }
      catch (IllegalArgumentException e)
      {
        _LOG.warning("INVALID_ENUM_IN_CONFIG",
                     new Object[] { strategyParam, _NAMING_STRATEGY_PARAM });;
      }
    }
  }

  return StyleSheetNamingStrategy.STABLE;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:StyleContextImpl.java

示例4: findInitializationVector

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static byte[] findInitializationVector(ExternalContext ctx)
{
    
    byte[] iv = null;
    String ivString = ctx.getInitParameter(INIT_ALGORITHM_IV);
    
    if(ivString == null)
    {
        ivString = ctx.getInitParameter(INIT_ALGORITHM_IV.toLowerCase());
    }
    
    if (ivString != null)
    {
        iv = new Base64().decode(ivString.getBytes());
    }
    
    return iv;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:19,代碼來源:StateUtils.java

示例5: findAlgorithmParams

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static String findAlgorithmParams(ExternalContext ctx)
{
    
    String algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM);
    
    if (algorithmParams == null)
    {
        algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM.toLowerCase());
    }
    
    if (algorithmParams == null)
    {
        algorithmParams = DEFAULT_ALGORITHM_PARAMS;
    }
    
    if (log.isLoggable(Level.FINE))
    {
        log.fine("Using algorithm paramaters " + algorithmParams);
    }
    
    return algorithmParams;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:23,代碼來源:StateUtils.java

示例6: shouldInterpretEmptyStringSubmittedValuesAsNull

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
/**
 * Checks if the <code>validate()</code> should interpret an empty
 * submitted value should be handle as <code>NULL</code>
 *
 * @return a (cached) boolean to identify the interpretation as null
 */
public static boolean shouldInterpretEmptyStringSubmittedValuesAsNull(FacesContext context)
{
  ExternalContext ec = context.getExternalContext();
  Boolean interpretEmptyStringAsNull = (Boolean)ec.getApplicationMap().get(TRINIDAD_EMPTY_VALUES_AS_NULL_PARAM_NAME);

  // not yet cached...
  if (interpretEmptyStringAsNull == null)
  {
    // parses the web.xml to get the "javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL" value
    String param = ec.getInitParameter(JSF_SPEC_EMPTY_VALUES_AS_NULL_PARAM_NAME);

    // evaluate the context parameter
    interpretEmptyStringAsNull = "true".equalsIgnoreCase(param);

    // cache the parsed value
    ec.getApplicationMap().put(TRINIDAD_EMPTY_VALUES_AS_NULL_PARAM_NAME, interpretEmptyStringAsNull);
  }

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

示例7: _getInternalView

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private InternalView _getInternalView(
  FacesContext context, 
  String       viewId)
{
  Object cached = _internalViewCache.get(viewId);
  if (cached != null)
  {
    return ((cached == _NOT_FOUND) ? null : (InternalView)cached);
  }
  
  InternalView internal = _internalViews.get(viewId);
  if (internal == null)
  {
    // If we're using suffix-mapping, then any internal viewId will
    // get affixed with ".jsp" or ".jspx";  try trimming that off
    // if present
    ExternalContext external = context.getExternalContext();
    
    // Only bother when using suffix-mapping (path info will always
    // be non-null for prefix-mapping)
    if (external.getRequestPathInfo() == null)
    {
      String suffix = external.getInitParameter("javax.faces.DEFAULT_SUFFIX");
      if (suffix == null)
        suffix = ".jspx";
      
      if (viewId.endsWith(suffix))
      {
        String viewIdWithoutSuffix = viewId.substring(
           0, viewId.length() - suffix.length());
        internal = _internalViews.get(viewIdWithoutSuffix);
      }
    }
  }
  
  _internalViewCache.put(viewId, (internal == null) ? _NOT_FOUND : internal);

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

示例8: getValue

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public String getValue(ExternalContext extCtx, String name)
{
  if (name == null)
  {
    throw new NullPointerException(_LOG.getMessage("NULL_CONFIG_PROPERTY_NAME"));
  }
  String result = extCtx.getInitParameter(name);
  return result;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:14,代碼來源:ServletConfigValueProvider.java

示例9: testConfiguration

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static void testConfiguration(ExternalContext ctx)
{

    String algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM);
    
    if (algorithmParams == null)
    {
        algorithmParams = ctx.getInitParameter(INIT_ALGORITHM_PARAM.toLowerCase());
    }
    String iv = ctx.getInitParameter(INIT_ALGORITHM_IV);
    
    if (iv == null)
    {
        iv = ctx.getInitParameter(INIT_ALGORITHM_IV.toLowerCase());
    }
    
    if (algorithmParams != null && algorithmParams.startsWith("CBC") )
    {
        if(iv == null)
        {
            throw new FacesException(INIT_ALGORITHM_PARAM +
                    " parameter has been set with CBC mode," +
                    " but no initialization vector has been set " +
                    " with " + INIT_ALGORITHM_IV);
        }
    }

}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,代碼來源:StateUtils.java

示例10: findAlgorithm

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static String findAlgorithm(ExternalContext ctx)
{
    
    String algorithm = ctx.getInitParameter(INIT_ALGORITHM);
    
    if (algorithm == null)
    {
        algorithm = ctx.getInitParameter(INIT_ALGORITHM.toLowerCase());
    }

    return findAlgorithm( algorithm );
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:13,代碼來源:StateUtils.java

示例11: findSecret

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static byte[] findSecret(ExternalContext ctx, String algorithm)
{
    String secret = ctx.getInitParameter(INIT_SECRET);
    
    if (secret == null)
    {
        secret = ctx.getInitParameter(INIT_SECRET.toLowerCase());
    }
    
    return findSecret(secret, algorithm);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:StateUtils.java

示例12: findMacSecret

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static byte[] findMacSecret(ExternalContext ctx, String algorithm)
{
    String secret = ctx.getInitParameter(INIT_MAC_SECRET);
    
    if (secret == null)
    {
        secret = ctx.getInitParameter(INIT_MAC_SECRET.toLowerCase());
    }
 
    return findMacSecret(secret, algorithm);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:12,代碼來源:StateUtils.java

示例13: _getViewRootStateRefFactoryHolder

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
/**
 * @return the holder for the factory to use for creating references to the UIViewRootState.  If
 * <code>null</code>, no UIViewRoot caching should be performed.
 */
private static AtomicReference<PseudoReferenceFactory<ViewRootState>> 
  _getViewRootStateRefFactoryHolder(FacesContext context, RequestContext trinContext)
{
  ConcurrentMap<String, Object> sharedAppMap = trinContext.getApplicationScopedConcurrentMap();

  AtomicReference<PseudoReferenceFactory<ViewRootState>> factoryHolder = 
     (AtomicReference<PseudoReferenceFactory<ViewRootState>>)sharedAppMap.get(CACHE_VIEW_ROOT_INIT_PARAM);
  
  if (factoryHolder != null)
  {
    return factoryHolder;
  }
  else
  {      
    ExternalContext extContext = context.getExternalContext();
  
    String viewRootCaching = extContext.getInitParameter(CACHE_VIEW_ROOT_INIT_PARAM);

    String caseInsensitiveViewRootCaching;
    
    if ((viewRootCaching != null) && (viewRootCaching.length() > 0))
    {
      caseInsensitiveViewRootCaching = viewRootCaching.toLowerCase();
    }
    else
    {
      // ViewRootCaching conflicts with jsf >= 2,2
      if (JsfUtils.IS_JSF_2_2)
      {
        caseInsensitiveViewRootCaching = "false";
      }
      else
      {
        caseInsensitiveViewRootCaching = "true"; // the default
      }
    }
    PseudoReferenceFactory<ViewRootState> factory;

    if ("false".equals(caseInsensitiveViewRootCaching))
    {
      factory = null;
    }
    else if ("strong".equals(caseInsensitiveViewRootCaching))
      factory = new StrongPseudoReferenceFactory<ViewRootState>();
    else if ("soft".equals(caseInsensitiveViewRootCaching))
      factory = new SoftPseudoReferenceFactory<ViewRootState>();
    else if ("true".equals(caseInsensitiveViewRootCaching))
    {
      factory = _instantiateDefaultPseudoReferenceFactory();
    }
    else
    {
      factory = _instantiatePseudoReferenceFactoryFromClass(viewRootCaching);
      
      if (factory == null)
      {
        // we had an error, so use the default
        factory = _instantiateDefaultPseudoReferenceFactory();
      }
    }
    
    // use a placeholder for null, since ConcurrentHashMap can't store null;
    factoryHolder = new AtomicReference<PseudoReferenceFactory<ViewRootState>>(factory);
    
    sharedAppMap.put(CACHE_VIEW_ROOT_INIT_PARAM, factoryHolder);
    
    return factoryHolder;
  }    
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:74,代碼來源:StateManagerImpl.java

示例14: _isContentCompressionDisabled

import javax.faces.context.ExternalContext; //導入方法依賴的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

示例15: findMacAlgorithm

import javax.faces.context.ExternalContext; //導入方法依賴的package包/類
private static String findMacAlgorithm(ExternalContext ctx)
{
    
    String algorithm = ctx.getInitParameter(INIT_MAC_ALGORITHM);
    
    if (algorithm == null)
    {
        algorithm = ctx.getInitParameter(INIT_MAC_ALGORITHM.toLowerCase());
    }

    return findMacAlgorithm( algorithm );

}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:14,代碼來源:StateUtils.java


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