* @param resultModel
* @throws HandlerException
*/
private void removeNotMatchingLangAttach(Model resultModel,
EnhancedRequest ehRequest) throws HandlerException {
AcceptLanguagesIterator langIter = ehRequest.getAcceptLanguages();
/*Collection acceptedLang = new HashSet();
while (langIter.hasNext()) {
acceptedLang.add(langIter.nextAcceptLanguageHeader()
.getLocaleRange().getLocale().getLanguage());
}*/
StmtIterator attachments = resultModel.listStatements(null,
ATTACH.attachments, (Resource) null);
while (attachments.hasNext()) {
Seq currentSeq = attachments.nextStatement().getSeq();
for (int i = 1; i <= currentSeq.size(); i++) {
Resource currentAttachment;
try {
currentAttachment = currentSeq.getResource(i);
} catch (PropertyNotFoundException ex) {
log.warn("inconsisten seq");
continue;
}
Statement langStmt = currentAttachment.getProperty(DC.language);
if (langStmt == null) {
continue;
}
String lang = langStmt.getString();
Locale locale = new Locale(lang);
boolean matches = false;
while (langIter.hasNext()) {
if (langIter.nextAcceptLanguageHeader()
.getLocaleRange().match(locale)) {
matches = true;
}
}
if (!matches) {