public static String [ ] addConfigurationClasses ( String [ ] configurationClasses , AdditionalWebAppJettyConfigurationClass [ ] optionalAdditionalsWebappConfigurationClasses ) { List < String > newConfigurationClasses = new ArrayList <> ( Arrays . asList ( configurationClasses ) ) ; for ( AdditionalWebAppJettyConfigurationClass additionalWebappConfigurationClass : optionalAdditionalsWebappConfigurationClasses ) { if ( additionalWebappConfigurationClass . getClasses ( ) == null || additionalWebappConfigurationClass . getPosition ( ) == null ) { LOG . warn ( "Bad support class name" ) ; } else { if ( ClassUtil . classesExists ( additionalWebappConfigurationClass . getClasses ( ) ) ) { int index = 0 ; if ( additionalWebappConfigurationClass . getReferenceClass ( ) == null ) { if ( additionalWebappConfigurationClass . getPosition ( ) == Position . AFTER ) { index = newConfigurationClasses . size ( ) ; } } else { index = newConfigurationClasses . indexOf ( additionalWebappConfigurationClass . getReferenceClass ( ) ) ; if ( index == - 1 ) { if ( additionalWebappConfigurationClass . getPosition ( ) == Position . AFTER ) { LOG . warn ( "[{}] reference unreachable, add at the end" , additionalWebappConfigurationClass . getReferenceClass ( ) ) ; index = newConfigurationClasses . size ( ) ; } else { LOG . warn ( "[{}] reference unreachable, add at the top" , additionalWebappConfigurationClass . getReferenceClass ( ) ) ; index = 0 ; } } else { if ( additionalWebappConfigurationClass . getPosition ( ) == Position . AFTER ) { index ++ ; } } } newConfigurationClasses . addAll ( index , additionalWebappConfigurationClass . getClasses ( ) ) ; for ( String className : additionalWebappConfigurationClass . getClasses ( ) ) { LOG . debug ( "[{}] support added" , className ) ; } } else { for ( String className : additionalWebappConfigurationClass . getClasses ( ) ) { LOG . debug ( "[{}] not available" , className ) ; } } } } // List configurations for ( String configurationClasse : newConfigurationClasses ) { LOG . trace ( "Jetty WebAppContext Configuration => " + configurationClasse ) ; } return newConfigurationClasses . toArray ( new String [ newConfigurationClasses . size ( ) ] ) ; }
Add the optionalAdditionalsWebappConfigurationClasses to the configurationClasses if available