Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The servlet also generates a random delay time and a random http status code. Using the async client, it connects to a remote url and passes these randomly generated values to it. The remote url is initialized from the servlet's <init-param> value.  Once the async client sends a request to the remote app, the servlet returns without waiting for a response from the remote app. This app is deployed on the Geronimo server we configured earlier. This   This app has a callback listener which holds the CometEvent object. When it receives the answer from the remote app, it gets the original response from the event object and passes the message to it.

Deploy this app on the Geronimo server we configured earlier using either the consoleor the command line

Code Block

$geronimo_home/bin>./deploy.sh deploy http-local-app-2.0-SNAPSHOT.war

The http-remote-app

A simple servlet in this app reads the two request parameters delay and code.  It sleeps for the amount of time specified in the delay. If the code is 200, it serves a file called dummy.html. For the status code 500, it does a divide by zero to throw a servlet exception. For other status codes, it sets the appropriate response code in the response.sendError(). It then returns. This simulates varous response times and return status codes from an external app. This app can be run on any other server and machine.