code: private void loginForm(HttpServletResponse response) throws IOException {
          response.reset();
          response.addHeader("WWW-Authenticate",
                             "Basic realm=\"!!Fedora Repository Server\"");
          response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
          OutputStream out = response.getOutputStream();
          out.write("Fedora: 401 ".getBytes());
          out.flush();
          out.close();
      }
docs: Sends a 401 error to the browser. This forces a login box to be displayed
  allowing the user to login.
  
  @param response
  the response to set the headers and status