WebCallbackHandler webcallback = new WebCallbackHandler(request);
LoginContext lcontext = null;
boolean loginSuccess = true;
try{
lcontext = new LoginContext( "WebLogin",webcallback );
lcontext.login();
} catch (LoginException lge){
loginSuccess = false;
}
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("<html><head><title>Thanks for logging in</title></head><body>");
out.println("<h2>Your logged in status</h2>");
out.println(""+ ( loginSuccess ? "Logged in" : "Failed Login" ));
out.println("</body></html>");