1 package org.jfox.ioc.management.http; 2 3 import javax.servlet.http.HttpServletRequest ; 4 5 import org.apache.velocity.context.Context; 6 import org.jfox.ioc.ComponentMeta; 7 import org.jfox.ioc.ComponentName; 8 import org.jfox.ioc.ext.ManagableComponent; 9 import org.jfox.ioc.management.ManagementInfo; 10 11 14 15 public class ViewServlet extends SuperServlet { 16 17 public String getTemplate() { 18 return "view.vm"; 19 } 20 21 public void buildContext(HttpServletRequest request, Context ctx) throws Exception { 22 request.getSession(true).setAttribute("A","B"); 24 25 String _componentName = request.getParameter("componentname"); 26 ComponentName componentName = ComponentName.parseString(_componentName,getRegistry().getClassLoaderRepository()); 27 28 ComponentMeta meta = getRegistry().getComponentMeta(componentName); 29 30 ctx.put("title","Component View"); 31 ctx.put("componentMeta",meta); 32 33 if(!ManagableComponent.class.isAssignableFrom(meta.getComponentImplementation())) { 34 ctx.put("managable",false); 35 } 36 else { 37 ctx.put("managable",true); 38 ManagementInfo mgtInfo = meta.getManagementInfo(); 39 ctx.put("managementInfo",mgtInfo); 40 } 41 42 } 43 44 public static void main(String [] args) { 45 46 } 47 } 48 49 | Popular Tags |