ECLIPSE and TOMCAT (web applications)

Apache Tomcat & Eclipse Platform make a great Web development platform. Tutorials about this development environment are available on the following websites:

I use the Tomcat version 5.5.23 as localhost because this version is available on my hosted website provided by my ISP Visual Online. My Eclipse version is Galileo (3.5.2). The Java SDK is 1.6.

Web applications are deployed on the Tomcat server with a WAR file (which stands for “web application archive” ) A WAR file is a ZIP file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages that together constitute the Web application.

There are special files and directories within a WAR file.

  • The /WEB-INF/classes directory contains the .class files (servlets, …)
  • The /WEB-INF/lib directory contains the .jar files with the Java librairies
  • The /WEB-INF directory contains a file named web.xml which defines the structure of the web application

The main elements of the web.xml file are shown below :

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_ID” version=”2.4″ xmlns=”http://java.sun.com/xml/ns/j2ee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”>

<display-name>MyExampleWebProject</display-name>
<description>Describe What the application is doing and add comments</description>

<servlet>

<servlet-name>MyServlet</servlet-name>
<servlet-class>saraproft.com.servlet.FirstApp</servlet-class>
<description>Une application très simple</description>

<init-param>
<param-name>size</param-name>
<param-value>123</param-value>
</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>echo</url-pattern>
</servlet-mapping>

</web-app>

The elements of a web.xml file are :

  • the name of the application : <display name>
  • the name, class and parameters of the servlet : <servlet>
  • the mapping of the servlet : <servlet-mapping>
  • context parameters : <context-param>
  • session parameters : <session-config>
  • list of index files : <welcome-file-list>
  • MIME mapping : <mime-mapping>
  • other parameters referring to security, errors, filters, …

The other files (html, jsp, iamges, …) are stored in the root or in folders located in the root of the WAR file. They can’t be included in the WEB-INF directory.

The Apache CouchDB Project

Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution. CouchDB provides a RESTful JSON API than can be accessed from any environment that allows HTTP requests.

CouchDB is written in Erlang, a robust functional programming language ideal for building concurrent distributed systems. Erlang allows for a flexible design that is easily scalable and readily extensible.