|
|
|
Additional information about the project
Using static HTML pages
- If your application
requires the use of static HTML pages and/or forms, i.e. not created dynamically by servlets or CGI scripts, you may use our Apache Web Server on uml. In order to do this, you need to create a public_html directory in your home directory. For example, if your home directory is /home/majors/smith, your public_html directory should be in /home/majors/smith/public_html. Your home directory and the created public_html directory must be searchable (the x bit must be on for all users). Moreover, any pages to be served by the web server on uml must be readable to all.
- Alternatively, you may use our departmental server, www.cs.uga.edu. In this case, you should deploy your HTML forms and/or static pages in your public_html directory on odin.cs.uga.edu. Of course, any forms deployed there should specify URLs pointing to our JBoss servlet container (in case you are using Java), or to CGI scripts residing on uml (if your team is using C++).
- Finally, it is possible to include static web pages with the deployed servlets, in the WAR files (see below). The downside is that their URL addresses would have to include the non-standard WWW port (8080).
Runing servlets
Please, read the following instructions carefully.
- You will be deploying servlets on our installation of JBoss on uml.cs.uga.edu. Our installation of JBoss supports dynamic deployment of Web applications. In general, you will not have to wait for the system restart to begin using your newly deployed Web application.
- Our installation is on uml in the directory /opt/jboss-6.1.0.Final (a symbolic link /opt/jboss is also available).
- In order to deploy your Web application, you should create and compile all of the necessary Java classes and create all the necessary jar files.
- Remember to never make a call to System.exit() from within your Java application.
- Create the required directory structure for your Web application. In there, you
will need to create the WEB-INF subdirectory and in it sub-directories: classes and lib (if you want
to use jar files).
- Create a suitable web.xml file
and place it in your WEB-INF directory. An example web.xml file is available here.
- Create a WAR archive of your application using the jar command. Your WAR file must have the name beginning with teamN_ and end with the suffix .war. For example, team 5 would create their application war file with the name team5_ecomm.war. If you would like to experiment with your own servlets, you must name your war file using the convention firstname_lastname_mywebapp.war.
- Copy the created war file into the default server on our JBoss. Simply, use the UNIX cp command to copy your war file to directory
/opt/jboss-6.1.0.Final/server/default/deploy,
of course, on uml.
Remember to set the permissions of the copied war file as world readable and accessible.
- Your servlets will be available on uml as:
http://uml.cs.uga.edu:8080/your_war_file_name/your_servlet_name,
for example:
http://uml.cs.uga.edu:8080/team5_college/AddCategory
- To compile your servlets, you need to provide access to the
Servlet API jar file file and, most likely,
the MySQL JDBC driver. You should set up your CLASSPATH environment
variable to make the necessary jar files available to the Java compiler.
For example, set your CLASSPATH to
.:classes:/opt/classes/servlet-api.jar:/opt/classes/mysql-connector-java-5.1.18-bin.jar
The above jar files are available only on uml -- they are not available on odin.
- In case your servlet malfunctions in some way, you should examine the JBoss
server log file, which is in:
/opt/jboss-6.1.0.Final/server/default/log/server.log.
This log file will
likely contain information on what had happened with your servlet.
Running CGI scripts
- Create a subdirectory cgi-bin in your public_html directory (see Using static HTML pages above). For example, for a CS major with the user name smith, the directory should be: /home/majors/smith/public_html/cgi-bin.
- Your cgi scripts should all have the suffix .cgi to operate properly. For example: /home/majors/smith/public_html/cgi-bin/MyScript.cgi.
Remembers that just like with the static HTML pages, your cgi-bin directory itself and all your cgi scripts must have bits r and x on, i.e. be readable and executable to all.
- The scripts can be executed using the following URL:
http://uml.cs.uga.edu/~your_user_name/cgi-bin/your_script.cgi
For example:
http://uml.cs.uga.edu/~smith/cgi-bin/MyScript.cgi
- If your script is implemented using C or C++ and depends on additional libraries not residing in the standard library directory /usr/lib to run (for example, cgicc, or some template library you would like to use), you will have to link your script program with the location of such libraries built into the script executable itself.
For example, to compile a script requiring the cgicc library, which on uml is located in the directory /opt/lib, the command is:
g++ -I/opt/include -L/opt/lib -o script.cgi -lcgicc -Xlinker -rpath -Xlinker /opt/lib script.cpp
The two -Xlinker options are used to supply the -rpath /opt/lib option to the linker, which is invoked by C++. Since this option has two components (-rpath and /opt/lib), the Xlinker C++ option has to be used twice. Please consult the C++ manual for details.
Using MySQL on uml
- MySQL programs and utilities are in directory /usr/bin, so you should not have to do anything special to use them.
- The Java MySQL connector driver is in the directory /opt/classes.
- To access MySQL from a C++ program, the necessary header files are in /usr/include/mysql and the libraries are in the directory /usr/lib64/mysql.
- Remember to always close all database connections which you open within your application (either Java or C++).
Using SVN, CVS and ANT on uml
- Our installation of SVN is available via the HTTP/WebDAV protocol. I will explain the proper use of SVN in class.
- The CVS program and utilities are in the directory /usr/bin.
- The ANT program is in the directory /usr/bin.
HTML Templates
- You may want to use a Java template library to speed up the development
and future modifications of your HTML screens. Experiment with FreeMarker,
a Java template library. FreeMarker 2.3.18 has been installed on uml in /opt/freemarker-2.3.18. You
need to have /opt/classes/freemarker.jar listed on your CLASSPATH.
- Check out a simple HTMLTemplate class for use with C++ projects. It is available in my csx050 directory on uml.
- You may also consider using ClearSilver, a library for using HTML templates in C/C++. It is installed on uml. The include files are in the directory /opt/include, while the libraries are in /opt/lib and /opt/lib64.
|
|