@Override
public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
for (FilterMapping srcFilterMapping : webFragment.getFilterMapping()) {
String filterName = srcFilterMapping.getFilterName();
FilterMapping targetFilterMapping = (FilterMapping) mergeContext.getAttribute(createFilterMappingKey(filterName));
if (targetFilterMapping == null) {
webApp.getFilterMapping().add(srcFilterMapping);
mergeContext.setAttribute(createFilterMappingKey(filterName), srcFilterMapping);
for (SubMergeHandler<FilterMapping, FilterMapping> subMergeHandler : subMergeHandlers) {
subMergeHandler.add(srcFilterMapping, mergeContext);
}
} else {
if (isFilterMappingFromWebXml(filterName, mergeContext)) {
continue;
}
if (isFilterMappingFromAnnotation(filterName, mergeContext)) {
//If the current url-patterns configurations are from annotations, so let's drop them
targetFilterMapping.getUrlPattern().clear();
targetFilterMapping.getDispatcher().clear();
targetFilterMapping.getServletName().clear();
mergeContext.removeAttribute(createFilterMappingSourceKey(filterName));
}
for (SubMergeHandler<FilterMapping, FilterMapping> subMergeHandler : subMergeHandlers) {
subMergeHandler.merge(srcFilterMapping, targetFilterMapping, mergeContext);
}