Composition by Script

While PicoContainer Web's composition abstraction - the WebappComposer interface - does not mandate the use of any script, the user may choose to use PicoContainer Script to leverage script support to compose the content of a script directly to a webapp scope. To this end, the ScriptedWebappComposer is provided. By default, it assumes XML as the scripting metadata (using "pico-application.xml", "pico-session.xml", "pico-request.xml" as the conventional names of the three scoped scripts), but any script supported by PicoContainer Script can be used. For example, to use Ruby as the scripting language simply define a composer like:

    public class RubyWebappComposer extends ScriptedWebappComposer {

        public RubyWebappComposer(){
            super(JRubyContainerBuilder.class.getName(), "pico-application.rb", "pico-session.rb", "pico-request.rb");
        }
    }   
Equally, if the user wishes to use other names or paths in the classpath for the scripts:
    public class MyXMLWebappComposer extends ScriptedWebappComposer {

        public MyXMLWebappComposer(){
            super(XMLContainerBuilder.class.getName(), "config/application.xml", "config/session.xml", "config/request.xml");
        }
    }