@ SuppressWarnings ( "unchecked" ) private StringBuffer getInterfaceScript ( String scriptName , ServletContext servletContext ) { StringBuffer sb = new StringBuffer ( ENGINE_INIT ) ; // List all containers to find all DWR interfaces List < Container > containers = ContainerUtil . getAllPublishedContainers ( servletContext ) ; boolean found = false ; for ( Iterator < Container > it = containers . iterator ( ) ; it . hasNext ( ) && ! found ; ) { Container container = it . next ( ) ; // The creatormanager holds the list of beans CreatorManager ctManager = ( CreatorManager ) container . getBean ( CreatorManager . class . getName ( ) ) ; if ( null != ctManager ) { // The remoter builds interface scripts. Remoter remoter = ( Remoter ) container . getBean ( Remoter . class . getName ( ) ) ; String path = getPathReplacementString ( container ) ; try { String script = remoter . generateInterfaceScript ( scriptName , path ) ; found = true ; // Must remove the engine init script to avoid unneeded duplication script = removeEngineInit ( script ) ; sb . append ( script ) ; } catch ( SecurityException ex ) { throw new BundlingProcessException ( ex ) ; } } } if ( ! found ) throw new IllegalArgumentException ( "The DWR bean named '" + scriptName + "' was not found in any DWR configuration instance." ) ; return sb ; }
Returns a script with a specified DWR interface