What is Caapi?

Caapi is a framework for a J2EE based system. It provides some of the infrastructure to handle HTTP requests and collate the response. It uses XML to specify config files that control behaviour and to encapsulate the data to be displayed. Using XML provides benefits in easy configuration and eases the cooperative development process between programmers and graphic designers.

Where does Caapi Fit in?

To see where Caapi fits in, let us look at a typical J2EE architecture.

A user may use a browser to make an HTTP request. The incoming request is handled by the web server and may be passed on to the application server. This is where all the action happens. The application server talks to a database to save or retrieve data. The application server then puts together a page for display and send it. The page is then displayed in the browser.

Within the application server, a servlet handles the request. It may collect data using EJBs and encapsulate it in a data bean. It then passes it on to a JSP which renders the data in HTML. Caapi covers the functions implemented by the servlet, data bean, JSP components. It does not cover the EJB portion.

What does Caapi do?

Caapi is the framework that sits inside the application server. It may call EJBs to store and/or collect the data.

Within Caapi, the request reaches a servlet called the Dispatcher. All HTTP requests are routed through this servlet. Therefore, the same URL is used for all functions within the system. The actual function is determined by the value of a particular parameter, in this case, called cmd. The dispatcher examines the value of this parameter and calls a method in a class. This class is called the Controller. The application may have one such class for each function or group of functions. The controller will put together all data required to be displayed to the user. It may call one or more EJBs to do this. The data is encapsulated in a Data Bean. The data bean is then forwarded to a viewing component. This component is usually a JSP. A set of custom JSP tags are part of Caapi. These tags render the data and can access the data encapsulated in the data bean. The JSP can use these custom tags to help render the data into HTML.

Updated on 26 Mar 2001. Feedback to Prashant Bhandary