home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-18 | 1.7 KB | 54 lines |
- /*
- * @(#)SimpleServlet.java 1.21 97/05/22
- *
- * Copyright (c) 1996-1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * This software is the confidential and proprietary information of Sun
- * Microsystems, Inc. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Sun.
- *
- * 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.
- *
- * CopyrightVersion 1.0
- */
-
- import java.io.*;
-
- import javax.servlet.*;
- import javax.servlet.http.*;
-
-
- /**
- * This is a simple example of an HTTP Servlet. It responds to the GET
- * and HEAD methods of the HTTP protocol.
- */
- public class SimpleServlet extends HttpServlet {
-
- public void doGet (HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException
- {
- ServletOutputStream out = res.getOutputStream();
-
- // set content type and other response header fields first
- res.setContentType("text/html");
-
- // then write the data of the response
- out.println("<HEAD><TITLE> SimpleServlet Output </TITLE></HEAD><BODY>");
- out.println("<h1> SimpleServlet Output </h1>");
- out.println("<P>This is output from SimpleServlet.");
- out.println("</BODY>");
- out.close();
- }
-
- public String getServletInfo() {
- return "A simple servlet";
- }
- }
-