1 15 package org.apache.tapestry.describe; 16 17 import java.util.Iterator ; 18 19 import javax.servlet.Servlet ; 20 import javax.servlet.ServletConfig ; 21 22 import org.apache.tapestry.web.WebUtils; 23 24 28 public class ServletStrategy implements DescribableStrategy 29 { 30 31 public void describeObject(Object object, DescriptionReceiver receiver) 32 { 33 Servlet servlet = (Servlet ) object; 34 ServletConfig config = servlet.getServletConfig(); 35 36 receiver.title("HttpServlet"); 37 receiver.property("servletInfo", servlet.getServletInfo()); 38 receiver.property("servletName", config.getServletName()); 39 40 receiver.section("Initialization Parameters"); 41 42 Iterator i = WebUtils.toSortedList(config.getInitParameterNames()).iterator(); 43 while (i.hasNext()) 44 { 45 String key = (String ) i.next(); 46 47 receiver.property(key, config.getInitParameter(key)); 48 } 49 } 50 51 } | Popular Tags |