本文整理汇总了Java中org.apache.catalina.deploy.ApplicationParameter.getOverride方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationParameter.getOverride方法的具体用法?Java ApplicationParameter.getOverride怎么用?Java ApplicationParameter.getOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.deploy.ApplicationParameter
的用法示例。
在下文中一共展示了ApplicationParameter.getOverride方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addApplicationParameter
import org.apache.catalina.deploy.ApplicationParameter; //导入方法依赖的package包/类
/**
* Add a new application parameter for this application.
*
* @param parameter The new application parameter
*/
@Override
public void addApplicationParameter(ApplicationParameter parameter) {
synchronized (applicationParametersLock) {
String newName = parameter.getName();
for (ApplicationParameter p : applicationParameters) {
if (newName.equals(p.getName()) && !p.getOverride())
return;
}
ApplicationParameter results[] = Arrays.copyOf(
applicationParameters, applicationParameters.length + 1);
results[applicationParameters.length] = parameter;
applicationParameters = results;
}
fireContainerEvent("addApplicationParameter", parameter);
}
示例2: addApplicationParameter
import org.apache.catalina.deploy.ApplicationParameter; //导入方法依赖的package包/类
/**
* Add a new application parameter for this application.
*
* @param parameter
* The new application parameter
*/
@Override
public void addApplicationParameter(ApplicationParameter parameter) {
synchronized (applicationParametersLock) {
String newName = parameter.getName();
for (ApplicationParameter p : applicationParameters) {
if (newName.equals(p.getName()) && !p.getOverride())
return;
}
ApplicationParameter results[] = Arrays.copyOf(applicationParameters, applicationParameters.length + 1);
results[applicationParameters.length] = parameter;
applicationParameters = results;
}
fireContainerEvent("addApplicationParameter", parameter);
}
示例3: getApplicationInitParams
import org.apache.catalina.deploy.ApplicationParameter; //导入方法依赖的package包/类
@Override
public List<ApplicationParam> getApplicationInitParams(Context context) {
/*
* We'll try to determine if a parameter value comes from a deployment descriptor or a context
* descriptor.
*
* Assumption: context.findParameter() returns only values of parameters that are declared in a
* deployment descriptor.
*
* If a parameter is declared in a context descriptor with override=false and redeclared in a
* deployment descriptor, context.findParameter() still returns its value, even though the value
* is taken from a context descriptor.
*
* context.findApplicationParameters() returns all parameters that are declared in a context
* descriptor regardless of whether they are overridden in a deployment descriptor or not or
* not.
*/
/*
* creating a set of parameter names that are declared in a context descriptor and can not be
* overridden in a deployment descriptor.
*/
Set<String> nonOverridableParams = new HashSet<>();
for (ApplicationParameter appParam : context.findApplicationParameters()) {
if (appParam != null && !appParam.getOverride()) {
nonOverridableParams.add(appParam.getName());
}
}
List<ApplicationParam> initParams = new ArrayList<>(20);
ServletContext servletCtx = context.getServletContext();
for (String paramName : Collections.list(servletCtx.getInitParameterNames())) {
ApplicationParam param = new ApplicationParam();
param.setName(paramName);
param.setValue(servletCtx.getInitParameter(paramName));
/*
* if the parameter is declared in a deployment descriptor and it is not declared in a context
* descriptor with override=false, the value comes from the deployment descriptor
*/
param.setFromDeplDescr(
context.findParameter(paramName) != null && !nonOverridableParams.contains(paramName));
initParams.add(param);
}
return initParams;
}