/* * @(#)HelloWorldServlet.java 1.4 96/11/03 Marianne Mueller * * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please refer to the file "copyright.html" * for further important copyright and licensing information. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.servlet.*; import java.io.*; /** * Hello World. This servlet simply says hi. * * This is useful for testing our servlet admin tool, since * this servlet isn't started up by default when Jeeves starts up. * Load it by going to http:///admin/servlet.html * and giving it the name "hello" and the class "HelloWorldServlet". * Then, invoke by using the URL http:///servlet/hello */ public class HelloWorldServlet extends GenericServlet { public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintStream out = new PrintStream(res.getOutputStream()); out.println(""); out.println("Hello World"); out.println(""); out.println("

Hello World

"); out.println(""); } public String getServletInfo() { return "Create a page that says Hello World and send it back"; } }