}
}
if (!authorized) {
HttpChallenge challenge =
security.getChallenge(acl.getName(), princ);
Reply e = null;
if ( request.isProxy() ) {
e = request.makeReply(HTTP.PROXY_AUTH_REQUIRED);
e.setProxyAuthenticate(challenge);
} else {
e = request.makeReply(HTTP.UNAUTHORIZED);
e.setWWWAuthenticate(challenge);
}
HtmlGenerator g = new HtmlGenerator("Unauthorized");
g.append ("<h1>Unauthorized access</h1>"+
"<p>You are denied access to this resource.");
e.setStream(g);
request.skipBody();
throw new HTTPException (e);
} else {
security.updateRequestStates(request, princ);
}