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" ) ; }
Sends a response to the client stating that authorization is required .