本文整理汇总了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;
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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 );
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
示例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 );
}