KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ashkelon > pages > APIPage


1 package org.ashkelon.pages;
2
3 import org.ashkelon.*;
4 import org.ashkelon.util.*;
5
6 import java.util.*;
7 import java.sql.*;
8
9
10 /**
11  * @author Eitan Suez
12  */

13 public class APIPage extends Page
14 {
15    public APIPage()
16    {
17       super();
18    }
19    
20    public String JavaDoc handleRequest() throws SQLException
21    {
22       int apiId = Integer.parseInt(ServletUtils.getRequestParam(request, "id"));
23       Integer JavaDoc apiId_obj = new Integer JavaDoc(apiId);
24
25       Object JavaDoc apis_obj = app.getAttribute("apis");
26       Hashtable apis = null;
27       if (apis_obj == null)
28       {
29          apis = new Hashtable();
30       }
31       else
32       {
33          apis = (Hashtable) apis_obj;
34          Object JavaDoc api_object = apis.get(apiId_obj);
35          if (api_object != null)
36          {
37             API api = (API) api_object;
38             request.setAttribute("api", api);
39
40             return null;
41          }
42       }
43        
44       API api = API.makeAPIFor(conn, apiId);
45       apis.put(apiId_obj, api);
46       app.setAttribute("apis", apis);
47       request.setAttribute("api", api);
48
49       return null;
50    }
51
52 }
53
Popular Tags