@Override
public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
for (FilterMappingType srcFilterMapping : webFragment.getFilterMappingArray()) {
String filterName = srcFilterMapping.getFilterName().getStringValue();
FilterMappingType targetFilterMapping = (FilterMappingType) mergeContext.getAttribute(createFilterMappingKey(filterName));
if (targetFilterMapping == null) {
targetFilterMapping = (FilterMappingType) webApp.addNewFilterMapping().set(srcFilterMapping);
mergeContext.setAttribute(createFilterMappingKey(filterName), targetFilterMapping);
for (SubMergeHandler<FilterMappingType, FilterMappingType> subMergeHandler : subMergeHandlers) {
subMergeHandler.add(targetFilterMapping, mergeContext);
}
} else {
if (isFilterMappingFromAnnotation(filterName, mergeContext)) {
//If the current url-patterns configurations are from annotations, so let's drop them
targetFilterMapping.setUrlPatternArray(new UrlPatternType[0]);
targetFilterMapping.setDispatcherArray(new DispatcherType[0]);
targetFilterMapping.setServletNameArray(new ServletNameType[0]);
mergeContext.removeAttribute(createFilterMappingSourceKey(filterName));
}
for (SubMergeHandler<FilterMappingType, FilterMappingType> subMergeHandler : subMergeHandlers) {
subMergeHandler.merge(srcFilterMapping, targetFilterMapping, mergeContext);
}