import java.io.IOException;

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class test extends HttpServlet {

    public String getServletInfo() {
     return "Test Servlet  $Revision: 1.0 $.\nTest Servlet by Al Williams " ;
    }

    /**	
    * Service the request.
 	*
 	* @exception ServletException If a ServletException occurred
	*
	*/
    public void service(HttpServletRequest request,
			HttpServletResponse response)
	 throws IOException, ServletException
    {

	response.setContentType("text/html");

	ServletOutputStream out = response.getOutputStream();
	// set the title and the HTML preamble
	out.println("<HTML>");
	out.println("<HEAD><TITLE>Test Servlet</TITLE></HEAD>");
	out.println("<BODY>");

	// greet user with host and IP name
	out.println("<H1>You bet you are at " +
		    request.getHeader("Host") + "</H1>");
	out.println("<P>How are things at "
+request.getRemoteAddr()+"?</P>");
	// Print query string, if any
	String s=request.getQueryString();
	if (s!="") out.println(s);
	// Enumerate all headers
	Enumeration e=request.getHeaderNames();
	while (e.hasMoreElements())
	  {
	    s=(String)e.nextElement();
	    out.println("<p>"+s+": " + request.getHeader(s)+"</p>");
	  }
	// Close out HTML
	out.println("</BODY>");
	out.println("</HTML>");

    }

}