Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
52
Chapter 2 First Servlets
get confused, especially when your only change is to a lower level
class, not to the top level servlet class. So, if it appears that
changes you make to your servlets are not reflected in the servlet's
behavior, try restarting the server. With the JSWDK and Tomcat,
you have to do this every time you make a change, since these
mini servers have no support for automatic servlet reloading.
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.coreserv
lets.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 com
mand 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 client that lets you interactively connect to
* Web servers and send custom request lines and
* request headers.
*/
public class WebClient extends CloseableFrame
implements Runnable, Interruptible, ActionListener {
public static void main(String[] args) {
new WebClient("Web Client");
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved