Jump to Real's How-to Main page

Ask for a password from a Servlet

public void askPassword(HttpServletResponse response) {
  response.setStatus(response.SC_UNAUTHORIZED); 
  response.setHeader("WWW-Authenticate",
     "BASIC realm=\"protected-area\"");
  }
then the browser will popup a dialog for username/password
If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]