int propFindType) {
this(resource.getHref(), null, TYPE_PROPSTAT);
// only property names requested
if (propFindType == PROPFIND_PROPERTY_NAMES) {
PropContainer status200 =
getPropContainer(DavServletResponse.SC_OK, true);
for (DavPropertyName propName : resource.getPropertyNames()) {
status200.addContent(propName);
}
// all or a specified set of property and their values requested.
} else {
PropContainer status200 =
getPropContainer(DavServletResponse.SC_OK, false);
// Collection of missing property names for 404 responses
Set<DavPropertyName> missing =
new HashSet<DavPropertyName>(propNameSet.getContent());
// Add requested properties or all non-protected properties,
// or non-protected properties plus requested properties
// (allprop/include)
if (propFindType == PROPFIND_BY_PROPERTY) {
for (DavPropertyName propName : propNameSet) {
DavProperty<?> prop = resource.getProperty(propName);
if (prop != null) {
status200.addContent(prop);
missing.remove(propName);
}
}
} else {
for (DavProperty<?> property : resource.getProperties()) {
boolean allDeadPlusRfc4918LiveProperties =
propFindType == PROPFIND_ALL_PROP
|| propFindType == PROPFIND_ALL_PROP_INCLUDE;
boolean wasRequested = missing.remove(property.getName());
if ((allDeadPlusRfc4918LiveProperties
&& !property.isInvisibleInAllprop())
|| wasRequested) {
status200.addContent(property);
}
}
}
if (!missing.isEmpty() && propFindType != PROPFIND_ALL_PROP) {
PropContainer status404 =
getPropContainer(DavServletResponse.SC_NOT_FOUND, true);
for (DavPropertyName propName : missing) {
status404.addContent(propName);
}
}
}
}