// map's the path if a mapping is specified in the descriptor
path = descriptor.mapPath(path);
}
// third, authenticate the user
final Subject user = authenticate(request, response);
if (user == null) {
// You now get a challenge if there is no user
// response.sendError(HttpServletResponse.SC_FORBIDDEN,
// "Permission denied: unknown user " + "or password");
return;
}
// fourth, process the request
DBBroker broker = null;
try {
broker = getPool().get(user);
srvREST.doHead(broker, request, response, path);
} catch (final BadRequestException e) {
if (response.isCommitted()) {
throw new ServletException(e.getMessage(), e);
}
response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
} catch (final PermissionDeniedException e) {
// If the current user is the Default User and they do not have permission
// then send a challenge request to prompt the client for a username/password.
// Else return a FORBIDDEN Error
if (user != null && user.equals(getDefaultUser())) {
getAuthenticator().sendChallenge(request, response);
} else {
response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
}
} catch (final NotFoundException e) {