
     Time zone web application using a web service

The code in this folder demonstrates a very simple "web application"
that makes use of a simple "web service".

Here is a diagram of a web browser communicating with a web server that
is executing a web application for the browser and the web application
is communicating with a web service. The "web service" is in fact just
another web server but it is not a general purpose web server. The web
service is a web server that only responds to certain kinds of requests
and it responds with data instead of HTML pages.


 browser.exe                    server.exe            java.exe                   server.exe            java.exe
 +---------+                   +---------+   pipe   +----------+                +---------+   pipe   +----------+
 |         |       http        | port    |--------->| stdin    |     http       | port    |--------->| stdin    |
 |         |<=================>| 8080    |<---------| stdout   |<==============>| 9090    |<---------| stdout   |
 |         |   tcp connection  |         |<---------| stderr   | tcp connection |         |<---------| stderr   |
 |         |                   |         |   pipe   |          |                |         |   pipe   |          |
 +---------+                   +---------+          +----------+                +---------+          +----------+
      |                                  \          /                                     \          /
      |                                   \        /                                       \        /
      |                                    \      /                                         \      /
   +-----+                                 +------+                                         +------+
   |     |                                 |      |                                         |      |
   |     |                                 |      |                                         |      |
   +-----+                                 +------+                                         +------+
    local                                   local                                            local
    file                                    file                                             file
    system                                  system                                           system


When the browser is asked to access a URL like this,

   http://localhost:8080/TimeZoneWebApp_v2/TimeZoneApp.class?timeZone=Rome

the browser sends to the server an HTTP request like this.

GET  /TimeZoneWebApp_v2/TimeZoneApp.class?timeZone=Rome  HTTP/1.1
Host: localhost:8080

The web server will run the web application program which expects the name
of a city in its standard input stream. The web application will take the
name of the city and forward it to the web server running the web service
with an HTTP request like this.

GET  /TimeZoneWebService/TimeZoneService.class?Rome  HTTP/1.1
Host: localhost:9090

That web server will see that it must run a Java class file so it will start
an instance of the JVM running the web service program. The web server will
write the name of the city to the stream connected to the standard input
stream of the JVM. The web service program will take the city name from its
standard input stream and look up the city in Java's built-in database of
time zones. The result of the lookup will be written to the standard output
stream of the JVM. The web server will take that result and send it over the
tcp connection to the web application program which will use the web service's
result to finish its work.

The results from the web application program are sent over the JVM's standard
output stream to the web server. The web server sends those results over the
tcp connection to the browser as the response to the browser's HTTP GET request.
The browser displays those results as a web page.


To run this web application, copy the package folder
   TimeZoneWebApp_v2
into the root folder of the web server. Then compile and run the
web server that runs the web service program. Then access this URL.

      http://localhost:8080/TimeZoneWebApp_v2/
