KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > web > controller > ChooseCommand


1 package com.genimen.djeneric.web.controller;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 import org.w3c.dom.Document JavaDoc;
10
11 import com.genimen.djeneric.repository.DjExtent;
12 import com.genimen.djeneric.repository.exceptions.DjenericException;
13 import com.genimen.djeneric.web.renderers.FilterRenderer;
14 import com.genimen.djeneric.web.renderers.tree.WebTree;
15 import com.genimen.djeneric.web.util.DjenericSessionManager;
16 import com.genimen.djeneric.web.util.DjenericXSLTransform;
17
18 public class ChooseCommand
19 {
20   FilterRenderer _renderer = new FilterRenderer();
21
22   public void get(DjenericSessionManager sessionManager, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
23       throws IOException JavaDoc, ServletException JavaDoc, DjenericException
24   {
25     try
26     {
27       WebTree tree = sessionManager.getTree();
28
29       response.setContentType("text/html; charset=UTF-8");
30
31       String JavaDoc extentName = request.getParameter("extent");
32       if (extentName != null)
33       {
34         DjExtent extent = sessionManager.getExtent(extentName);
35
36         DjenericXSLTransform xsl = sessionManager.getTransformer();
37
38         Document JavaDoc doc = _renderer.asXml(extent, sessionManager.getPrimarySession(), null);
39
40         String JavaDoc page = xsl.transform(doc, "dialogs/choose.xsl");
41         response.getWriter().print(page);
42       }
43       else throw new DjenericException("No nodeid parameter specified");
44     }
45     catch (Exception JavaDoc e)
46     {
47       throw new ServletException JavaDoc(e);
48     }
49   }
50
51   public void post(DjenericSessionManager sessionManager, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
52   {
53
54   }
55 }
56
Popular Tags