class BasicAuthenticationHttpContext extends DefaultHttpContext {

    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
        if (!authenticator.authenticate(request)) {
            response.setHeader("WWW-Authenticate",HttpServletRequest.BASIC_AUTH + " realm=\""+realm+"\"");
            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
            return false;
        } else {
            return true;
        }
    }

    public  BasicAuthenticationHttpContext(String pRealm, Authenticator pAuthenticator);

}