Sample Applications

Sample Applications

The Sample project in your SAF installation directory contains the following applications:

Information /SAF/servlet/SkyServlet?handler=Information
Shows values of HTTP Header, Servlet Request, Servlet Session, and Servlet Config parameters.

AppTracker /SAF/servlet/SkyServlet?handler=AppTracker
Shows all the user sessions that are connected to the Sample application. Repeatedly refresh the browser and launch multiple browser sessions to see how the AppTracker keeps track of sessions.

ChartCreator /SAF/ChartCreator.html
Demonstrates how SAF applications can create dynamic images. ChartCreator creates bar charts based on data filled out by the user in ChartCreator form.

Deployment Descriptor (web.xml) for Sample Applications

The deployment descriptor of Sample applications and for any other SAF based applications are quite simple. Besides some standard stuff (such as mime type, servlet mapping, etc), they contain parameter values that are used by the SAF framework. SAF can currently be configured with following parameter values:

JDBC_DRIVER
Specifies the JDBC driver that will be used by SAF based application to carry out database operations. If this parameter is not present in the web.xml file, the application will not be able to carry out database operations.

        <!-- JDBC driver that will be used by this application -->
<init-param>
<param-name>JDBC_DRIVER</param-name>
<param-value>org.gjt.mm.mysql.Driver</param-value>
</init-param>

JDBC_URL
Specifies the JDBC url of the database that SAF will connect to on behalf of the application. All the database operations requested by the application will go to the database pointed by this JDBC url. If this parameter is not present in the web.xml file, the application will not be able to carry out database operations.

        <!-- JDBC url that will be used to connect to the database -->
<init-param>
<param-name>JDBC_URL</param-name>
<param-value>jdbc:mysql://localhost/interec</param-value>
</init-param>

SMTP_HOST
Specifies the host name of the mail server that will be used by SAF on behalf of the application to send emails. If this parameter is not present in the web.xml file, email functionality will not work.

        <!-- Mail server that will be used to send emails -->
<init-param>
<param-name>SMTP_HOST</param-name>
<param-value>interec.net</param-value>
</init-param>

FROM_EMAIL_ADDRESS
Any emails that SAF sends will appear to come from this email address. If this parameter is not present in the web.xml file, email functionality will not work.

        <!-- Senders email address in any emails that are sent -->
<init-param>
<param-name>FROM_EMAIL_ADDRESS</param-name>
<param-value>interec@interec.net</param-value>
</init-param>

MAX_JDBC_CONNECTIONS
Defines the maximum number of connections that will be maintained by SAF in the database connection pool. If this parameter is not defined in web.xml file, SAF will create a new connection for every database operation that the application performs and after the operation has been completed the database connection will be dropped. For better performance, use set the value of this parameter to at least 2.

        <!-- Maximum number of connections in the database connection pool -->
<init-param>
<param-name>MAX_JDBC_CONNECTIONS</param-name>
<param-value>7</param-value>
</init-param>

MAX_STMT_PER_JDBC_CONNECTION
Defines the maximum number of statements for each JDBC connection. In the context of SAF based application this number defines the upper limit of the number of separate SQL statements that you can have in a SAF based form. For example, if this variable is set to 5, then you cannot have more than five separate SQL statements in your form.

        <!-- Maximum number of statements per jdbc connection -->
<init-param>
<param-name>MAX_STMT_PER_JDBC_CONNECTION</param-name>
<param-value>5</param-value>
</init-param>

MAX_SESSIONS_TRACKED
upper limit on number of user sessions that are tracked by SAF.

        <!-- Used by SessionTracker. Maximum number of servlet sessions that are tracked. -->
<init-param>
<param-name>MAX_SESSIONS_TRACKED</param-name>
<param-value>10</param-value>
</init-param>

MAX_EVENT_PER_SESSION_TRACKED
For each user sessions, SAF will only track the latest events of any user session. This number defines the number of events per user session that SAF tracks. If number of events exceed this count, then older event will be dropped and will no longer appear in the tracking report.

        <!-- Maximum number of events that are tracked per servlet session. -->
<init-param>
<param-name>MAX_EVENTS_PER_SESSION_TRACKED</param-name>
<param-value>10</param-value>
</init-param>

SESSION_TRACKED_TIMEOUT
Number of milliseconds after which an idle user session will not be tracked.

        <!-- If a session is idle, it is no longer tracked after number of milliseconds given below. -->
<init-param>
<param-name>SESSION_TRACKED_TIMEOUT</param-name>
<param-value>300000</param-value>
</init-param>