KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > management > http > InstantiateServlet


1 package org.jfox.ioc.management.http;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4
5 import org.apache.velocity.context.Context;
6 import org.jfox.ioc.Component;
7 import org.jfox.ioc.ComponentMeta;
8 import org.jfox.ioc.ComponentName;
9
10 /**
11  * @author <a HREF="mailto:yy.young@gmail.com">Young Yang</a>
12  */

13
14 public class InstantiateServlet extends SuperServlet {
15
16     public String JavaDoc getTemplate() {
17         return "instantiate.vm";
18     }
19
20     public void buildContext(HttpServletRequest JavaDoc request, Context ctx) throws Exception JavaDoc {
21         String JavaDoc _componentName = request.getParameter("componentname");
22         ComponentName componentName = ComponentName.parseString(_componentName,getRegistry().getClassLoaderRepository());
23
24         ComponentMeta meta = getRegistry().getComponentMeta(componentName);
25         Component component = getRegistry().getComponentInstance(componentName);
26
27         ctx.put("title","Instantiate Result View");
28         ctx.put("componentName",_componentName);
29         ctx.put("description",meta.getDescription());
30         ctx.put("component",component);
31
32     }
33
34     public static void main(String JavaDoc[] args) {
35
36     }
37 }
38
39
Popular Tags