2.10. WebClient: Talking to Web Servers Interactively

This section presents the source code for the WebClient program discussed in Section 2.9 (Debugging Servlets) and used in Section 2.8 (An Example Using Servlet Initialization and Page Modification Dates) and extensively throughout Chapter 16 (Using HTML Forms). As always, the source code can be downloaded from the on-line archive at http://www.coreservlets.com/, and there are no restrictions on its use.

WebClient

This class is the top-level program that you would use. Start it from the command line, then customize the HTTP request line and request headers, then press “Submit Request.”

Listing 2.12. WebClient.java
 import java.awt.*; import java.awt.event.*; import java.util.*; /** * A graphical ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.