code: static public void sendAuthRequiredError(HttpServletResponse response, String realm) throws IOException {
  		response.setHeader("WWW-Authenticate", "Basic realm=\""+realm+"\"");
  		response.setHeader("Cache-Control", "no-cache,must-revalidate");
  		response.setDateHeader("Expires", (new Date()).getTime());
  		response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authorization Required");
  	}
docs: Sends a response to the client stating that authorization is required.
  @param response Response used to send error message
  @param realm Realm that client should provide authorization for
  @throws IOException