Servlet Configuration

This 'Configuration' Menu has gone through Runtime (RT) and Database (DB) configuration mechanisms so far. These two configurations are vital for every module running with OpenGTS and if you plan to create your own modules you should always begin with (copy&paste) the initial lines found in various classes.

By creating war files in the build folder with ant OpenGTS is adding another type of applications. A main difference is that the war files are self contained and do not depend on GTS_HOME. All relevant files are copied into the war war files that can be copied/moved to Tomcat on your PC or a live portal running anywhere else. Of course the OpenGTS environment (Java, JDBC, mail, database...) has to be in place.

The servlet 2.3 specification has introduced listeners that can be added to a web application. By adding a listener to the deployment descriptor file web.xml code can be executed when the application is loaded:


So this full qualified classname (note that we are now moving into war packages and libraries) points us to the Java code initializing the web application. There we should also find our RT and DB configuration code analyzed earlier.

We will look at the RTConfigContextListener on the next page.

To request a servlet it must be mapped to an URL first:


The Track Servlet is basically the OpenGTS Frontend

Track extends CommonServlet extends HttpServlet

while the CommonServlet is a Servlet connected to OpenGTS providing common utils, configs and more. The HttpServlet belongs to the javax.servlet.http package with the classes HttpServletRequest and HttpServletResponse provides the bindings to run the Servlet in a standardized environment. Every servlet needs to add the doGet and doPost methods with the same arguments to process incoming and outgoing data. Usually it is common practice that doGet calls doPost.

In OpenGTS both methods call _doWork_wrapper:

/* GET request */
public void doGet(request, response) throws ServletException, IOException
this._doWork_wrapper(false, request, response);
/* POST request */
public void doPost(request, response) throws ServletException, IOException
this._doWork_wrapper(true, request, response);
/* handle POST/GET request */
private void _doWork_wrapper(isPost, request, response) 
throws ServletException, IOException
_doWork( ... )

 So in the end the method

/* handle POST/GET request */
private void _doWork(isPost, request, response, privLabel)
        throws ServletException, IOException

is the 'main' method of the Track Servlet receiving requests and forming responses with all relevant OpenGTS information of the private label.

With the RTConfigContextListener and the Track._doWork method we have found the entry points of the OpenGTS Servlets. The private Label concludes the basic configuration for all OpenGTS codes. Let's follow these three traces...


 « db config ContextListener »