16.12. A Debugging Web Server

This section presents a mini “Web server” that is useful when you are trying to understand the behavior of HTML forms. I used it for many of the examples earlier in the chapter. It simply reads all the HTTP data sent to it by the browser, then returns a Web page with those lines embedded within a PRE element. This server is also extremely useful for debugging servlets. When something goes wrong, the first task is to determine if the problem lies in the way in which you collect data or the way in which you process it. Starting the EchoServer on, say, port 8088 of your local machine, then changing your forms to specify http://localhost:8088/ lets you see if the data being collected is in the format you expect.

EchoServer ...

Get Core Servlets and JavaServer Pages™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.