    001    package org.nanocontainer.webcontainer.groovy;
    002
    003    import groovy.util.NodeBuilder;
    004
    005    import java.util.Map;
    006
    007    import org.mortbay.jetty.servlet.ServletHolder;
    008
    009    public class ServletHolderBuilder extends NodeBuilder {
    010
    011        private ServletHolder servletHolder;
    012
    013        public ServletHolderBuilder(ServletHolder servlet) {
    014            this.servletHolder = servlet;
    015        }
    016
    017        protected Object createNode(Object name, Map map) {
    018            if (name.equals("initParam")) {
    019                return createInitParam(map);
    020            }
    021            return null;
    022        }
    023
    024        protected Object createInitParam(Map map) {
    025            String name = (String) map.remove("name");
    026            String value = (String) map.remove("value");
    027            servletHolder.setInitParameter(name, value);
    028            return null;
    029        }
    030
    031    }