01: package org.nanocontainer.webcontainer.groovy;
02:
03: import groovy.util.NodeBuilder;
04:
05: import java.util.Map;
06:
07: import org.mortbay.jetty.servlet.ServletHolder;
08:
09: public class ServletHolderBuilder extends NodeBuilder {
10:
11: private ServletHolder servletHolder;
12:
13: public ServletHolderBuilder(ServletHolder servlet) {
14: this .servletHolder = servlet;
15: }
16:
17: protected Object createNode(Object name, Map map) {
18: if (name.equals("initParam")) {
19: return createInitParam(map);
20: }
21: return null;
22: }
23:
24: protected Object createInitParam(Map map) {
25: String name = (String) map.remove("name");
26: String value = (String) map.remove("value");
27: servletHolder.setInitParameter(name, value);
28: return null;
29: }
30:
31: }
|