public void addFilterModel ( final FilterModel model ) { if ( model . getUrlPatterns ( ) != null ) { try { filterLock . writeLock ( ) . lock ( ) ; associateBundle ( model . getContextModel ( ) . getVirtualHosts ( ) , model . getContextModel ( ) . getBundle ( ) ) ; for ( String virtualHost : resolveVirtualHosts ( model ) ) { for ( String urlPattern : model . getUrlPatterns ( ) ) { final UrlPattern newUrlPattern = new UrlPattern ( getFullPath ( model . getContextModel ( ) , urlPattern ) , model ) ; String fullPath = getFullPath ( model . getContextModel ( ) , urlPattern ) ; if ( filterUrlPatterns . get ( virtualHost ) == null ) { filterUrlPatterns . put ( virtualHost , new ConcurrentHashMap <> ( ) ) ; } Set < UrlPattern > urlSet = filterUrlPatterns . get ( virtualHost ) . get ( fullPath ) ; if ( urlSet == null ) { //initialize first urlSet = new HashSet <> ( ) ; } urlSet . add ( newUrlPattern ) ; filterUrlPatterns . get ( virtualHost ) . put ( fullPath , urlSet ) ; // final UrlPattern existingPattern = filterUrlPatterns.putIfAbsent( // getFullPath(model.getContextModel(), urlPattern), newUrlPattern); // if (existingPattern != null) { // // this should never happen but is a good assertion // LOG.error("Internal error (please report): Cannot associate url mapping " // + getFullPath(model.getContextModel(), urlPattern) + " to " + newUrlPattern // + " because is already associated to " + existingPattern); // } } } } finally { filterLock . writeLock ( ) . unlock ( ) ; } } }
Registers a filter model .