// 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 ovevridden in a deployment descriptor.
Set nonOverridableParams = new HashSet();
ApplicationParameter[] appParams = context.findApplicationParameters();
for (int i = 0; i < appParams.length; i++) {
if (appParams[i] != null && ! appParams[i].getOverride()) {
nonOverridableParams.add(appParams[i].getName());
}
}
List initParams = new ArrayList();
ServletContext servletCtx = context.getServletContext();
for (Enumeration e = servletCtx.getInitParameterNames(); e.hasMoreElements(); ) {
String paramName = (String) e.nextElement();
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;
}