import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.security.*;
public class MyServlet extends HttpServlet {
public void init(ServletConfig cfg) throws ServletException
{
super.init(cfg);
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("");
out.println("User Authentication");
out.println("");
out.println("");
out.println("");
out.println("User Authentication
");
String type = request.getAuthType();
out.println("Welcome to this secure page.
");
out.println("Authentication mechanism: " + type + "
");
Principal principal = request.getUserPrincipal();
out.println("Your username is: " + principal.getName() + "
");
out.println("");
out.println("");
}
}
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
MyServletName
MyServlet
MyServletName
/index.html